Using ANTLR plugin to process separate lexer and parser grammars


(Heinrich Nirschl) #1

This is a follow up question to Using Gradle 2.10's ANTLR plugin to import an ANTLR 4 lexer grammar into another grammar
As suggested by @st_oehme I opened a new topic.

I took @jbduncan’s project and modified it to match my use case (see attachment). The difference is that in the original project the lexer grammar was imported as a grammar, while I just want to use separate lexer and parser grammars.

It works fine when the generated CommonLexerRules.tokens is copied to src/main/antlr/org/jbduncan but otherwise fails with

error(160): org/jbduncan/Expr.g4:4:11: cannot find tokens file /home/henry/tmp/antlr/antlr-example/src/generated/java/CommonLexerRules.tokens

antlr-example.zip (55.1 KB)