[antlr-interest] Problems defining StringLiteral processing in a grammar

Jim Idle jimi at temporal-wave.com
Mon Dec 15 14:26:31 PST 2008


On Mon, 15 Dec 2008 14:11:42 -0800, James Abley <james.abley at gmail.com>  
wrote:

> Thank you, that's cleared up my maven issue. I'm still getting the
> problem with the production though.
>
> My understanding is that it means a " character, then optionally
> anything that's not a " character, and then a closing " character, OR
> a ' character, then optionally anything not a ' character, and then a
> closing character.
>
> Is that correct?
>

Yes but you have made a parser rule not a lexer rule. Reade the getting  
started articles and the 5 minute tutorials.

Lexer rules start with UPPER case, paresr rules start with LOWER case.


>>>
>>> My grammar contains the following rule:
>>>
>>> stringLiteral   :       '"'  (~'"')* '"'
>>>        |       '\'' (~'\'')* '\''
>>>        ;
>>>

STRING   : ...etc

Jim


More information about the antlr-interest mailing list