[antlr-interest] newbie question
Karl Meissner
meissnersd at yahoo.com
Fri Jun 20 07:46:29 PDT 2003
Hi I am new to ANTLR. I have just started working on a grammar.
I have a lot of lexical token rules defined already and a simple top level parser rule of the form
topParseRule : ( TokenRule1 | TokenRule2 ) + ;
It eats token 1 and 2 but then it hit a token type 3. It finds the token but then the
parse rule does not accept it. I have default error set to true.
When the rule did not accept token 3, I expected the parse rule
to throw an recognition exception. Instead it silently exited. When I stepped through the
generated topParseRule function, it was finding token3 but then sending it to the default case
in the switch which just broken out of the for loop with no other action.
So...is this expected behavior? Is there a way I can put a throw in the default case from the
grammar definition?
The other idea I had was just checking if there were tokens left on the input stream. What is the
call to examine the queue of unprocessed tokens?
I am using 2.7.2 and the C# language implementation if it makes any difference.
Thanks for any help
Karl
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list