[antlr-interest] ids+=ID question

Jim Idle jimi at temporal-wave.com
Wed Jul 25 14:09:40 PDT 2007



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of John Connett
> 
> Many thanks.  I am using Java (but I'm not an experienced Java
> programmer). 

How about... (and note that I changed that to + rather than * as I don't
like rules that match nothing, you should use jText? instead :-)

jText returns [String text]
@init {$text = ""}
         :
		(       id=(STRING | EQUALS | PIPE | SPACE)
                 {
                     $text = $text + $id.text;
                 }
		)+
         ;


Jim


More information about the antlr-interest mailing list