[antlr-interest] Need help regarding lexer
elango m
go2elango at gmail.com
Wed Mar 19 09:08:32 PDT 2008
Hi Stefan and Victor,
Thanks a lot!!!. Following worked.
STR_LITERAL: '\'' (~('\'') | '\'\'')* '\'';
I am just curious why STR_LITERAL : '\'' ('\'\'')* ~('\'')* '\'' ; didn't
worked???
-EM-
On Wed, Mar 19, 2008 at 8:00 PM, Stefan Bucur <stefan.bucur at gmail.com>
wrote:
> On Wed, Mar 19, 2008 at 3:24 PM, elango m <go2elango at gmail.com> wrote:
> > Hi,
> >
> > I have defined a lexer like this.
> >
> > STR_LITERAL : '\'' ('\'\'')* ~('\'')* '\'' ;
> >
> > But lexer is not respecting ('\'\'')*. It just takes the first '. For
> ex.
> > for input string 'a''bc', it resolves only 'a', but I want resolve
> 'a''bc'
> > as a single token .Could any one please help me what I am missing.
> >
> > Thanks in advance.
> > -EM-
> >
>
> Hello!
>
> Perhaps you would like something like:
>
> STR_LITERAL: '\'' (~('\'') | '\'\'')* '\'';
>
> which means: match any number of elements between qoutes, and these
> elements are either not a qoute, or are a double qoute.
>
> Hope this helps!
>
> Stefan Bucur
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080319/c9c5cc1d/attachment.html
More information about the antlr-interest
mailing list