On Tue, Jan 18, 2011 at 8:28 AM, Kevin Jackson <[email protected]> wrote:

> Hi,
>
> > pair
> >   :  LEFT_SQUARE IDENTIFIER QUOTED_TEXT RIGHT_SQUARE
> >   ;
> >
> > LEFT_SQUARE  : '[';
> > RIGHT_SQUARE : ']';
> > IDENTIFIER   : ('a'..'z'|'A'..'Z')+;
> > QUOTED_TEXT  : '"' ('a'..'z' | 'A'..'Z' | ' ' | ',' | '-')+ '"';
> > SPACES       : (' ' | '\t')+ {skip();};
>
> Thanks for the reply.  This nearly works!  However I don't want to
> retain the '"' (quotes) in the rewrite rule, so although the
> IDENTIFIER has fixed the first problem, I now have a problem with the
> QUOTED_TEXT.
>
> I should have mentioned that I suppose.
>
> Thanks,
> Kev
>

Try something like this:

QUOTED_TEXT
  :  '"' ('a'..'z' | 'A'..'Z' | ' ' | ',' | '-')+ '"'
{setText(getText().substring(0, getText().length()-1));}
  ;


to strip the quotes in the lexing-stage.

Regards,

Bart.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to