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

Jared Bunting jared.bunting at peachjean.com
Mon Dec 15 13:23:01 PST 2008


The plugin from codehaus (I'm assuming this based on version 1.0) 
doesn't support antlr 3.1 and later.  The code has since been merged 
into the antlr project.

Instead, use:

<plugin>
  <groupId>org.antlr</groupId>
  <artifactId>antlr3-maven-plugin</artifactId>
  <version>3.1.1.2</version>
</plugin>

-Jared

James Abley wrote:
> Hi,
>
> My grammar contains the following rule:
>
> stringLiteral	:	'"'  (~'"')* '"'
> 	|	'\'' (~'\'')* '\''
> 	;
>
>
> I'm building my project using maven 2 and the antlr3-maven-plugin 1.0.
> Using the ANTLR 3.0.1 runtime, I'm seeing unexpected behaviour in that
> having certain characters; e.g. '?', '!'; in my literal strings are
> proving problematic.
>
> line 1:27 no viable alternative at character '!'
> line 1:61 no viable alternative at character '?'
>
> Please can someone help point out the gaps in my understanding of what
> the above productions actually mean?
>
> Secondly, if I try to use the ANTLR 3.1.1 runtime to build my project,
> I get compile errors:
>
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
>
> /home/jabley/work/eclipse/main-3.4/contentoptimizer/contentoptimizer-core/target/generated-sources/antlr/com/example/contentoptimizer/expression/ExprParser.java:[88,17]
> cannot find symbol
> symbol  : variable _fsp
> location: class com.example.contentoptimizer.expression.ExprParser
>
>
> Am I missing some configuration, or is this a known issue with the plugin?
>
> Cheers,
>
> 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