[antlr-interest] Read multiple times
Hiten R
antlr3 at gmail.com
Sat Mar 19 01:03:47 PDT 2011
Thanks John for a prompt reply. Appreciate your response but your example
was bit hard for me to understand though 'Putting it in the Loop' made
sense.
So this is what I did... now I can sleep like a baby :)
parse
: ('Basket' basket)*
;
basket
@init {
Basket basket;
String state= "";
String employee= "";
String phone= "";
String zip= "";
}
@after {
basket= new Basket(state, employee);
basket.setPhone(phone);
this.somelist.addBakets(basket);
print(basket.toString());
//start again
//parse(); --------? Is this right approach /// Not a right approach
}
: ('state' st=TOKEN { state= $st.text; }
| 'employee' et=TOKEN { employee= $et.text; }
| 'phone' pt=TOKEN { phone= $pt.text; }
| 'zip')* //For looop
;
More information about the antlr-interest
mailing list