[antlr-interest] Possible bug?
Gavin Lambert
antlr at mirality.co.nz
Sat Feb 2 14:36:48 PST 2008
At 10:08 3/02/2008, Amal Khailtash wrote:
>COMMENT_T
>// : c='$comment' t=(options {greedy=false;} : .)* e='$end'
> : c='$comment' t=TEXT_T e='$end'
> {
> $c.setType(COMMENT);
> emit($c);
> $t.setType(TEXT);
> emit($t);
> $e.setType(END);
> emit($e);
> }
> ;
I can't really answer to the rest of your problem, but unless
something has changed when I wasn't looking, the above code
doesn't do what you seem to be trying to do. "emit" doesn't
actually emit a token, it simply sets which token will be emitted
when the rule ends. Thus you're only going to be emitting the END
token from that rule.
More information about the antlr-interest
mailing list