[antlr-interest] token ' leads to OutOfMemory Exceptions

Jim Idle jimi at temporal-wave.com
Mon Mar 23 07:47:56 PDT 2009


Anders Hessellund wrote:
> Hi,
>
> I've experienced a strange thing in my grammar. I need a token for the 
> special character '
>
> If I specify it like this:
>
> PLING
>     :    '\''
>     ;
>
> I get an OutOfMemoryException during parsing.
>
> But if I specify it like this
>
> PLING
>     :    '\u0027'
>     ;
>
> Everything works fine.
>
> Is this a bug or a feature?
It sounds like the interaction of this rule with some other rule. Do you 
perchance have another rule that can match an empty sequence? Something 
like:

ID : LETTER* ;

Which should be

ID : LETTER+:

We won't be able to help you with only the information you provide - 
best to post the grammar if you can.

Jim


More information about the antlr-interest mailing list