help-bison
[Top][All Lists]
Advanced

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

unexpected $undefined (raw characters don't make it from the lexer)


From: Hal
Subject: unexpected $undefined (raw characters don't make it from the lexer)
Date: Tue, 17 Jan 2006 10:02:35 -0800

Hi

I'm using a C++ bison parser with a C++ flex lexer (thanks to Akim for
showing me that lex-param doesn't work until 2.1!)

In my lexer, I have a single rule that returns character codes:
   [-=*/+!<>$~)(\]\[}{`]    return yytext[0];
as well as plenty of rules that return tokens defined in the header
generated by the bison grammar (-d option).

The compiled parser runs fine as long as only the #defined tokens are
returned by the lexer; as soon as the lexer produces a single character via
the above rule, the parser fails with the following message:
   1.0: syntax error, unexpected $undefined, expecting {
The "undefined" character in this case was indeed '{', and I've added
debugging output to the lexer to make sure that it really is producing the
appropriate character code (123 in this case).

Why would the parser be failing to understand the meaning of the lexer's
return value when it is a character code, but managing fine when it is a
predefined token?

Thanks for your help!

Hal
--


reply via email to

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