On Tue, Oct 6, 2009 at 7:13 AM, Daniels, Troy (US SSA) <[email protected]> wrote: > >> As a workaround, I changed my production, adding EOF as an >> optional terminal as follows: >> >> objectMember : functionExpression EOF? | ID EOF?; >> >> Everything now works but I'm curious if a better solution for >> testing individual grammar productions exists. Suggestions >> or alternatives? >> > > While it's not the best answer, you could change your test code so that > instead of passing "foo", it passed "foo junk". That way, your fix is > in the test code, and the production grammar says what you want it to > say. Better would be for Antlr to include EOF in the follow set if it's > possible.
Thanks for the suggestion Troy. You're right, that's certainly a valid workaround. I could look through the generated follow set and choose one of the permitted tokens, but that would clutter the tests and leave them less readable. Of course, if I don't clutter the tests with the extra symbol, I have to clutter the grammar with the extra EOF, but I'm preferential to that at the moment as it currently only occurs in that one production, but I'll keep your suggestion in mind. Thanks. --Kaleb http://twitter.com/kalebpederson http://kalebpederson.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 -~----------~----~----~----~------~----~------~--~---
