[antlr-interest] Rule returning values and lists of rules

Luca Belluccini lucabelluccini at gmail.com
Fri Aug 6 16:54:48 PDT 2010


Example:

ruleOne: r2+=ruleTwo+ 'END';
{

ListIterator<Token> li = $r2.listIterator();
while(li.hasNext()){

System.out.println("MyText = " + li.next().myText); // ERROR HERE

}

}
ruleTwo returns [ String myText ]: id1=ID '::' id2=ID
{

$myText = new String($id2.text + "..." + $id1.text);

}

Te correct way to access returned values?


More information about the antlr-interest mailing list