At 08:56 14/08/2009, [email protected] wrote:
 >Thanks for the tip! I marked the appropriate rules as fragments, 

 >however all the issues in the original post still stand. The
 >debugger simply generates a Parse Tree of root -> quiz, while
 >the Interpreter correctly generates the Parse Tree. Is this
 >possibly an issue with ANTLRWorks itself?

Try changing your quiz rule to this:

quiz:
          multiple_choice* EOF;

Without the EOF, you're saying to ANTLR "if you don't find 
something that matches multiple_choice, that's ok, just 
stop".  With it, you're saying "after you've matched all the 
multiple_choices you can, you must have no input left", which 
means that you'll get an error if there is unconsumed input (which 
would mean that your multiple_choice rule or its descendants 
aren't matching what you're expecting them to).

Tracing it through with either the debugger or a unit test should 
show where the problem lies.  A good thing to try is to write a 
unit test that simply pulls all the generated tokens off the lexer 
and verifies them; if your lexer isn't producing the tokens you're 
expecting then there's little chance the parser will work, and 
unfortunately the ANTLR/ANTLRworks environment isn't really set up 
to test the lexer properly.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to