[antlr-interest] gathering any character until specified char

Jim Idle jimi at temporal-wave.com
Sat Aug 20 08:19:14 PDT 2011


You need $auth+ for a start.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Gokulakannan Somasundaram
> Sent: Saturday, August 20, 2011 2:27 AM
> To: Ben Corne
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] gathering any character until specified
> char
>
> Try and check the following steps.
> a) Make the WS Token, as above and set $channel = HIDDEN.
> b) make until_separator as a token with (~(WS|SEPERATOR))*.
> c) Try with the same rule for authors.
>
> On Mon, Aug 15, 2011 at 5:26 PM, Ben Corne <ben.corne at gmail.com> wrote:
>
> > Here's another try:
> > authors
> > : auth+=until_separator (',' auth+=until_separator)*  -> ^(AGAUTHORS
> > $auth) ;
> >
> > until_separator
> > : (~SEPARATOR)*
> >  ;
> >
> > SEPARATOR : ',' ;
> >
> > This results again in empty values.
> > Is there an option I need to toggle to make sure the characters get
> > accounted for?
> >
> > 2011/8/14 Ben Corne <ben.corne at gmail.com>
> >
> > > HI all
> > >
> > > I'm trying to create a list of any characters but trailing
> > > whitespaces separated by comma's.
> > > Here are the rules for a specific case where I need this kind of
> list:
> > >
> > > authors
> > > : (auth+=(.*)) WS* (',' WS* auth+=(.*) WS*)  -> ^(AGAUTHORS $auth)
> ;
> > > WS  :   ( ' '
> > >         | '\t'
> > >         | '\r'
> > >         | '\n'
> > >         )
> > >     ;
> > >
> > > Input: Ben Corne ,  An antlr FAN
> > > Parse tree should look like this:
> > > authors
> > > |------------ 'Ben Corne'
> > > |------------ WS
> > > |------------ ','
> > > |------------ WS
> > > |------------ 'An antlr FAN'
> > >
> > > Instead I get one that doesn't seem to gather any character but the
> ','
> > > (tested in debugger)
> > > Anyone know what I'm doing wrong here?
> > >
> > > Kind regards
> > > Ben Corne
> > >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe:
> > http://www.antlr.org/mailman/options/antlr-interest/your-email-
> address
> >
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list