[antlr-interest] Want PAID Antlr work?

Bart Kiers bkiers at gmail.com
Fri Dec 23 23:20:32 PST 2011


Hi James,

Try this:

STRING_LITERAL: '\'' (~'\'' | '\'\'')* '\'';

Note that the string above may contain line breaks. If you don't want that,
do:

STRING_LITERAL: '\'' (~('\'' | '\r' | '\n') | '\'\'')* '\'';

Regards,

Bart.


On Sat, Dec 24, 2011 at 5:03 AM, James Ladd <james_ladd at hotmail.com> wrote:

>
> I hope this isnt too trivial to post to the list but im wondering how to
> change
> my rule to capture nested quotes?
>
> STRING_LITERAL: '\'' .* '\'';
>
> A string can be anything enclosed in single quotes. However I also need to
> cater for
> a nested double quote. Eg: 'this string has a '' in it.'
>
> Rgs, James.
>
>
> 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