I have a base grammar (FooBase.g
) and two grammar that include it:
lexer grammar FooVariantA;
import base = FooBase;
...
lexer grammar FooVariantB;
import base = FooBase;
...
If I put all three files into src/main/antlr
, the base grammar is compiled and this of course fails: it shouldn't be compiled, because it refers to some rules that are only defined in the "final" FooVariantA
and FooVariantB
grammars.
However, it seems I also cannot create src/main/antlr/imports
subdirectory as with Maven, as Gradle ANTLR plugin never looks there:
error(7): cannot find or open file: FooBase.g; reason: java.io.FileNotFoundException: /home/test/test/src/main/antlr/FooBase.g (No such file or directory)
How can I make only the two final grammars compile and still be able to find the imported base grammar?