At 09:37 6/10/2009, Kaleb Pederson wrote: >After some investigation, I found that the reason for the >failure was that EOF wasn't in the expected follow set, >which makes sense when I'm parsing the whole language. > >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?
Well, for starters, that rule above is better expressed like this: objectMember : (functionExpression | ID) EOF? ; Also, I haven't tested this, but you could try leaving the original rule unmodified and then adding another rule like so (not called by anything): test : (objectMember | everyOtherRuleToTest) EOF ; Then just call the original method (objectMember) in your unit tests. That might do the trick. 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 -~----------~----~----~----~------~----~------~--~---
