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

James Abley james.abley at gmail.com
Mon Dec 15 12:41:04 PST 2008


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


More information about the antlr-interest mailing list