Dan Baumberger wrote:
I am working with an ANTLR grammar for a custom language and have encountered a strange parsing issue. Here is a highly simplified grammar for the issue I've found:Well, it is doing what you asked it to :-) First, your prog rule only parses one block, then it seems a ';' which you have not catered for. Because you don;t have EOF as the last terminal of your prog rule, ANTLR assumes that you want it to stop. If you use: prog : b=ID '{' s=ID ';' '}' { System.out.println("Found block: " + $b.text);} EOF; Then it will give you a syntax error at ';' However, if you want it to go for another block, you will have to make your grammar look for multiple blocks of course. Jim --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~--- |
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
