Dear antlr community, I have created a minimal project, which illustrates three "challenges" I currently have. I attached the source, but hope to make myself clear enough in this email as well.
*1) How to deal with priorities*?
I have a rule like the below 'operation', where Command1 ('am') can also
occur within the 'identifier' rule.
operation
: Command1 Space LowerCase SemiColon
| Id Space identifier SemiColon
;
Below is the current output. It goes wrong if 'am' is part of the
identifier. I tried to fix this by moving
the order of some rules, but without success.
Running org.myantlr.test.parsers.a.TestATest
test: am e;id "some nice gAme";
--> test passed.
test: am e;id "some nice game";
BR.recoverFromMismatchedToken
MismatchedTokenException(9!=4)
at org.antlr.runtime.BaseRecognizer.mismatch(BaseRecognizer.java:117)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:99)
at
org.myantlr.test.parsers.a.TestAParser.identifier(TestAParser.java:81)
at
org.myantlr.test.parsers.a.TestAParser.operation(TestAParser.java:224)
at org.myantlr.test.parsers.a.TestAParser.parse(TestAParser.java:155)
at org.myantlr.test.parsers.a.TestATest.test(TestATest.java:33)
at org.myantlr.test.parsers.a.TestATest.test2(TestATest.java:19)
*2) grammar hierarchy?*
I read about the import statement in antlr. But I was not successful in
getting these two grammers to import a Base.g.
*3) configure output directory*
After running 'mvn package' all generated sources are in the 'b' package. I
expected TestA files to be generated in the 'a' package.
Is that a bug in the antlr3-maven-plugin, or am I doing something wrong?
./target/generated-sources/antlr/org/myantlr/test/parsers
./target/generated-sources/antlr/org/myantlr/test/parsers/b
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestA.tokens
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestA__.g
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestALexer.java
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestAParser.java
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestB.tokens
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestB__.g
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestBLexer.java
./target/generated-sources/antlr/org/myantlr/test/parsers/b/TestBParser.java
Thanks,
Jonne.
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
my-antlr-test.tgz
Description: GNU Zip compressed data
-- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
