Skip to content

Commit

Permalink
- Output at most one generic lexer error
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15401 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 28, 2013
1 parent 3f1e6e9 commit 954c265
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Parser/parse.c
Expand Up @@ -161,10 +161,11 @@ static void handleLexerError(pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *
chars[1][20] = '\0';
line = lexer->getLine(lexer);
offset = lexer->getCharPositionInLine(lexer)+1;
if (*chars[1])
if (*chars[1] && !ModelicaParser_lexerError) {
c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Lexer got '%s' but failed to recognize the rest: '%s'", (const char**) chars, 2, line, offset, line, offset, false, ModelicaParser_filename_C_testsuiteFriendly);
else
} else if (!ModelicaParser_lexerError) {
c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Lexer failed to recognize '%s'", (const char**) chars, 1, line, offset, line, offset, false, ModelicaParser_filename_C_testsuiteFriendly);
}
ModelicaParser_lexerError = ANTLR3_TRUE;
free(chars[0]);
free(chars[1]);
Expand Down

0 comments on commit 954c265

Please sign in to comment.