Error reporting improvements.
Don't print more than 3 lines of source file context with errors. (Any more than that is almost certainly not the Right Thing to do.) Make some parsing error messages more clear.
This commit is contained in:
6
parse.yy
6
parse.yy
@@ -946,7 +946,7 @@ parameter_list
|
||||
else {
|
||||
std::vector<std::string> alternates = MatchStrings(yytext, builtinTokens);
|
||||
std::string alts = lGetAlternates(alternates);
|
||||
Error(@1, "Syntax error--token \"%s\" unknown.%s", yytext, alts.c_str());
|
||||
Error(@1, "Syntax error--token \"%s\" unexpected.%s", yytext, alts.c_str());
|
||||
}
|
||||
$$ = NULL;
|
||||
}
|
||||
@@ -1050,7 +1050,7 @@ statement
|
||||
else {
|
||||
std::vector<std::string> alternates = MatchStrings(yytext, builtinTokens);
|
||||
std::string alts = lGetAlternates(alternates);
|
||||
Error(@1, "Syntax error--token \"%s\" unknown.%s", yytext, alts.c_str());
|
||||
Error(@1, "Syntax error--token \"%s\" unexpected.%s", yytext, alts.c_str());
|
||||
}
|
||||
$$ = NULL;
|
||||
}
|
||||
@@ -1209,7 +1209,7 @@ translation_unit
|
||||
else {
|
||||
std::vector<std::string> alternates = MatchStrings(yytext, builtinTokens);
|
||||
std::string alts = lGetAlternates(alternates);
|
||||
Error(@1, "Syntax error--token \"%s\" unknown.%s", yytext, alts.c_str());
|
||||
Error(@1, "Syntax error--token \"%s\" unexpected.%s", yytext, alts.c_str());
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user