[antlr-interest] Need help regarding lexer
Stefan Bucur
stefan.bucur at gmail.com
Wed Mar 19 07:30:34 PDT 2008
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
More information about the antlr-interest
mailing list