Sam Barnett-Cormack wrote: > Hi all, > > Now, I know that there's no difference between the rule one wants to be > start rule and any other - you can call any of them as a function to > parse a token stream. > > However, it's usual to put EOF at the end of the start rule, so it makes > sure it matches the whole file. However, I'm doing some delayed parsing > of certain constructs (as detectable context cannot determine manner of > parsing, but using ANTLR should be easier than hand-coding a parser for > these token sequences), and I store a list of tokens and have written a > wrapper to make them a token stream. However, the rules I'll pass them > to won't match EOF.
You can match EOF in the code that calls the rule, not the rule itself, for example: parser.myRule(); parser.eof(); where "eof : EOF;" is a parser rule. -- David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com 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 -~----------~----~----~----~------~----~------~--~---
