From 58634f3410db1ff16f6e21d9d0e1fcfaa17b2453 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 29 Jan 2010 20:03:21 -0500 Subject: Fix lexing error handling. --- dimension/lexer.l | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'dimension/lexer.l') diff --git a/dimension/lexer.l b/dimension/lexer.l index 90c5a6b..e456e24 100644 --- a/dimension/lexer.l +++ b/dimension/lexer.l @@ -261,7 +261,7 @@ unsigned long wchar; dmnsn_diagnostic(filename, yylineno, yycolumn, "Unrecognized character '%c' (0x%X)", (int)*yytext, (unsigned int)*yytext); - return 1; + return DMNSN_T_LEX_ERROR; } %% @@ -281,9 +281,10 @@ dmnsn_tokenize(FILE *file, const char *filename) while ((token.type = dmnsn_yylex_impl(&item, &location, filename, scanner)) != 0) { - if (token.type == 1 || token.type == 2) { + if (token.type == DMNSN_T_LEX_ERROR) { dmnsn_delete_tokens(tokens); tokens = NULL; + break; } else { token.value = item.value; token.filename = location.first_filename; -- cgit v1.2.3