aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lexer.l5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lexer.l b/src/lexer.l
index ec765d9..725e778 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -43,13 +43,16 @@ ws [ \t]
{ws}+ ;
+ /* Throw an error on an invalid token. When in interactive mode we
+ should slurp up all data on the current line after reporting the
+ error so that lexing/parsing doesn’t continue right after the
+ offending token but instead on the next line typed by the user. */
. {
user_error("%s:%d: Unrecognized character ‘%c’",
current_file, yylineno, *yytext);
BEGIN(error);
return YYerror;
}
-
<error>.* { BEGIN(0); }
%%