bison-patches
[Top][All Lists]
Advanced

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

Re: FYI: Missing \n


From: Joel E. Denny
Subject: Re: FYI: Missing \n
Date: Wed, 17 Jan 2007 16:00:37 -0500 (EST)

On Wed, 17 Jan 2007, Akim Demaille wrote:

> I fell on a confusing error message from Bison because of
> 
> %token ID_COLON        "identifier:"
> 
> which looks like a good idea, but results in:
> 
> ~/src/bison % cat >/tmp/foo.y
> foo: bar baz;
> ~/src/bison % LC_ALL=C _build/tests/bison /tmp/foo.y            nostromo Err 1
> /tmp/foo.y:1.1-3: syntax error, unexpected identifier:
> 
> this really looks like an incomplete error message :)  Maybe for this
> one we should define
> 
> %token ID_COLON        "\"identifier:\""

That will be a little ugly to use elsewhere in the grammar.  Maybe 
yytnamerr (in the generated parser) should detect a trailing `:' (perhaps 
followed by whitespace) and not strip quotes for that case?

> * src/reduce.c (reduce_grammar): Warn about unused terminals.

Thanks.  I'm guessing there are a lot of existing grammars with 
intentionally unused terminals.  Thus, I wonder if we ought to leave this 
warning off by default and activate it with a --warning flag.




reply via email to

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