Bugzilla – Bug 2711
Parse error messages can be confusing
Last modified: 2017-07-08 11:23:19 CET
The define YYERROR_VERBOSE was turned on a while back, to give better error
messages for parse errors by listing the expected tokens. Since many
productions include TOK_LEX_EOF for error recovery, that token too is
considered expected, e.g:
foo.pike:parse error, expecting `TOK_LEX_EOF' or `'}'' or `')''
The TOK_LEX_EOF bit here is confusing and wrong. Ideally the error
reporting code should be overridden to fix this, but it seems like bison
doesn't allow that. Perhaps it's better to undefine YYERROR_VERBOSE again.
Better would perhaps be to upgrade to Bison 1.32?
Maybe, but that doesn't fix the problem per se:
foo.pike:6:parse error, unexpected TOK_LOR, expecting TOK_LEX_EOF or '}' or ')'
Now there's yet another internal token identifier visible..
Hmm, according to the release notes for Bison 1.31, it's possible to set the
token now. Maybe it's also possible to set the strings to identify the tokens?
foo.pike:6:parse error, unexpected '||', expecting '}' or ')'
Bison 3.0.4 does have support for setting the token strings. As does byacc.
It also seems this support has been there (albeit undocumented) for quite a
Fixed in Pike 8.1.
You need to
before you can comment on or make changes to this bug.