[antlr-interest] Lexer rule for strings with quoted strings within
Bart Kiers
bkiers at gmail.com
Thu Mar 25 06:52:39 PDT 2010
On Thu, Mar 25, 2010 at 2:50 PM, Bart Kiers <bkiers at gmail.com> wrote:
>
>
> On Thu, Mar 25, 2010 at 2:01 PM, Anders Sollander <
> Anders.Sollander at mathworks.de> wrote:
>
>> Hi,
>>
>> I've been trying to write a lexer rule for strings with strings in them,
>> like
>>
>> "This has a ""quoted string"" within"
>>
>> Is there a simple lexer rule for this, or do I need some kind of look
>> ahead?
>>
>>
> You could enable the `backtrack` option:
>
> String
> options { backtrack = true; }
> : '"' ('""' | ~'"')+ '"'
> ;
>
> Regards,
>
> Bart.
>
>
Sorry, I should first test what I propose, it doesn't seem to work...
Regards,
Bart.
More information about the antlr-interest
mailing list