help-bison
[Top][All Lists]
Advanced

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

Not getting parse error


From: Rich Yonts
Subject: Not getting parse error
Date: Fri, 1 Feb 2002 14:46:55 -0700

Could someone explain this behavior?  I'm using DJGPP Bision.

I have this in the grammar file:


FieldList :
    FIELD ',' FieldList {} |
    FIELD {}
    ;

and in my lexer file:


[a-zA-Z][a-zA-Z_0-9]* {  /* Fields */
            return(FIELD);
      }


. {  /* miscellaneous characters */
            return(yytext[0]);
      }

My input looks like this:

quantity , size . color

which should return a parse error since '.' is not a valid token.  (When I
use a comma, it parses as I would expect.)  Why is bision not barking at me
with a parse error?  The debug output shows that it detects an invalid
token:

Reading a token: Next token is 259 (FIELD)
Shifting token 259 (FIELD), Entering state 22
Reducing via rule 9 (line 44), FieldList ',' FIELD
state stack now 0
Entering state 6
Reading a token: Next token is 46 ($undefined.)
Reducing via rule 2 (line 26), FieldList  -> Query

The parser returns a good condition, but shouldn't.  Can you direct me to
some help or documentation that explains why invalid input can be
tolerated?

Thanks,

Rich Yonts
address@hidden





reply via email to

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