summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-21 06:38:05 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-21 06:38:05 -0800
commit7515303c46d2e4e0b18544d1fe5acd942163ef42 (patch)
tree0bd4c859da29c3e6c66784cb32e479759b1e3d01 /parser.y
parent14a83fa427a4fad99b7a5bc288c47a7e0bcc95f3 (diff)
downloadtxr-7515303c46d2e4e0b18544d1fe5acd942163ef42.tar.gz
txr-7515303c46d2e4e0b18544d1fe5acd942163ef42.tar.bz2
txr-7515303c46d2e4e0b18544d1fe5acd942163ef42.zip
Bug #35139
* parser.y (yybadtoken): The current token (yychar) is 0 on byacc rather than YYEOF or YYEMPTY, so we have to handle that.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y6
1 files changed, 3 insertions, 3 deletions
diff --git a/parser.y b/parser.y
index 08fe1c96..d28acd69 100644
--- a/parser.y
+++ b/parser.y
@@ -1012,8 +1012,8 @@ void yybadtoken(int tok, val context)
else
yyerrorf(lit("unexpected ~a"), problem, nao);
else
- if (context)
- if (tok == YYEOF || tok == YYEMPTY)
+ if (context) /* Byacc sets yychar to 0 */
+ if (tok == YYEOF || tok == YYEMPTY || tok == 0)
yyerrorf(lit("unterminated ~a"), context, nao);
else if (tok == '\n')
yyerrorf(lit("newline in ~a"), context, nao);
@@ -1022,7 +1022,7 @@ void yybadtoken(int tok, val context)
else
if (tok == YYEOF)
yyerrorf(lit("unexpected end of input"), nao);
- else if (tok == YYEMPTY)
+ else if (tok == YYEMPTY || tok == 0)
return;
else
yyerrorf(lit("unexpected ~s"), chr(tok), nao);