Bug 2711 - Parse error messages can be confusing
: Parse error messages can be confusing
Status: RESOLVED FIXED
: Pike
Compiler
: 7.5
: All Other
: P4 (low) enhancement
: ---
Assigned To:
:
:
:
  Show dependency treegraph
 
Reported: 2002-01-24 22:00 CET by
Modified: 2017-07-08 11:23 CET (History)
Scrum Prio:
In scrum?: ---
Story included in sprints:
Unplanned in sprints:


Attachments


Description From 2002-01-24 22:00:32 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.
------- Comment #1 From 2002-01-25 10:28:43 CET -------
Better would perhaps be to upgrade to Bison 1.32?
------- Comment #2 From 2002-01-25 11:34:00 CET -------
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..
------- Comment #3 From 2002-01-25 11:43:15 CET -------
Hmm, according to the release notes for Bison 1.31, it's possible to set the
EOF
token now. Maybe it's also possible to set the strings to identify the tokens?
eg:

foo.pike:6:parse error, unexpected '||', expecting '}' or ')'
------- Comment #4 From 2017-07-07 12:25:10 CET -------
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
while.
------- Comment #5 From 2017-07-08 11:23:19 CET -------
Fixed in Pike 8.1.

Note

You need to log in before you can comment on or make changes to this bug.