Closed ammachado closed 7 months ago
I don't think this is good point - one should specify package in .g4 grammar (not using path)
The .g4 file location is not a reliable source for inferring the package name parameter. So I agree with @petrbel.
I also agree with @petrbel , but can we reserve the directory structrue if antlr4PackageName
is not configured? Consider that I have multiple grammars and want to keep them in different package. Currently I need to keep antlr4PackageName
as its default value None
and specify package in each .g4 files so that the generated .java files (note that they are all located in the root of target base directory in this case) could have different package declarations. Although the compiler can generate .class files with right package layout finally, it's weird to see all generated .java files are in the same folder. @petrbel
Instead of specify package name parameter, infer the package name from the file path, as
src/main/antlr4/org/sample/grammar.g4
generates package nameorg.sample