Greetings! On Fri, 2011-03-18 at 15:24 -0700, Hiten R wrote: > Hi everyone, > > I have a very simple problem described below and I don`t have a best way to > solve it. The idea is to parse values in each Basket and populate POJO > representing the Basket. > > Basket 200 > state California 246 > employee 678 > phone 555-9000 ext 90009 > zip 0909090 > Basket 300 > state NY 787 > emp..... > phone ....... > zip...... > > My parser parses the first line 'state California 246' and then moves to > another basket. I want to recursively parse each line under basket and at > the end populate POJO and then move to another basket. >
use a loop! your collection is apparently 1 or more baskets, thus collection : basket + EOF ; basket : bannerPhrase stateClause empClause phoneClause zipClause ; bannerPhrase : 'Basket' ... ; stateCaluse : 'state' ... ; empClause : 'employee' ... ; phoneClause : 'phone' ... ; zipClause : 'zip' ... ; and of course need to add appropriate actions in order to populate your data structure. However, from your supplied grammar fragment, i suspect you will have significant ambiguity issues with your definition of TOKEN. Hope this helps... -jbb 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.
