Eventually, we'll want to be be able to print out warnings as well.
}
glcpp_error (&token->location, parser, "");
- glcpp_print (parser->errors, "Pasting \"");
- _token_print (&parser->errors, token);
- glcpp_print (parser->errors, "\" and \"");
- _token_print (&parser->errors, other);
- glcpp_print (parser->errors, "\" does not give a valid preprocessing token.\n");
+ glcpp_print (parser->info_log, "Pasting \"");
+ _token_print (&parser->info_log, token);
+ glcpp_print (parser->info_log, "\" and \"");
+ _token_print (&parser->info_log, other);
+ glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n");
return token;
}
parser->lex_from_node = NULL;
parser->output = talloc_strdup(parser, "");
- parser->errors = talloc_strdup(parser, "");
+ parser->info_log = talloc_strdup(parser, "");
return parser;
}
ret = glcpp_parser_parse (parser);
printf("%s", parser->output);
- fprintf(stderr, "%s", parser->errors);
+ fprintf(stderr, "%s", parser->info_log);
glcpp_parser_destroy (parser);
token_list_t *lex_from_list;
token_node_t *lex_from_node;
char *output;
- char *errors;
+ char *info_log;
};
glcpp_parser_t *
void
glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
{
- parser->errors = talloc_asprintf_append(parser->errors, "%u:%u(%u): "
- "preprocessor error: ",
- locp->source, locp->first_line,
- locp->first_column);
- va_list ap;
- va_start(ap, fmt);
- parser->errors = talloc_vasprintf_append(parser->errors, fmt, ap);
- va_end(ap);
- parser->errors = talloc_strdup_append(parser->errors, "\n");
+ parser->info_log = talloc_asprintf_append(parser->info_log,
+ "%u:%u(%u): "
+ "preprocessor error: ",
+ locp->source,
+ locp->first_line,
+ locp->first_column);
+ va_list ap;
+ va_start(ap, fmt);
+ parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap);
+ va_end(ap);
+ parser->info_log = talloc_strdup_append(parser->info_log, "\n");
}
extern int
glcpp_parser_parse (parser);
- errors = parser->errors[0] != '\0';
- printf("%s", parser->errors);
+ errors = parser->info_log[0] != '\0';
+ printf("%s", parser->info_log);
talloc_steal(talloc_ctx, parser->output);
*shader = parser->output;