help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why only one "expected"?


From: Duncan Murdoch
Subject: Why only one "expected"?
Date: Tue, 29 May 2007 10:05:35 -0400
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

We're using a GNU Bison 2.3 parser, with verbose error messages. However, we only see messages with a single "expected" token. For example, if a user forgets to give a function name in a function call and types "(1,1)" they'll get the error

syntax error, unexpected ',', expecting ')'

when in fact there are lots of legal tokens at that spot: any arithmetic operator would be fine, such as "(1+1)", "(1-1)", etc.

Looking through the generated code, it appears that the yysyntax_error function should be able to handle up to 4 expected tokens, and if there are more than that (as here), it should default to showing none at all. But that's not what's happening.

Can anyone suggest what we might be doing wrong, or is this a Bison bug?

If anyone is interested the full source is visible at

https://svn.r-project.org/R/trunk/src/main/gram.y

and the Bison output is at

https://svn.r-project.org/R/trunk/src/main/gram.c

but I'm willing to track this down myself, if I can get a hint about where to start looking.

Duncan Murdoch






reply via email to

[Prev in Thread] Current Thread [Next in Thread]