Closed dzavodnikov closed 10 years ago
Please include a description of the inputs you used, the current behavior, and the expected behavior.
It is not a bug, it is improvement.
Unfortunately, we won't be able to make this change for ANTLR 4 as it would break any existing build tools that are in place. I recommend that you use the Maven plugin or an Ant task to generate your grammars during your build process, as each of those tools automatically accounts for the -package
option and the directory structure required for Java source files.
The other issue is that that only makes sense for Java; For C++ or another language, all files might go in a single directory regardless of their package.
This situation is worse with the antlr4-maven-plugin, because it automatically adds the outputDirectory to the build class path (since it contains generated sources), but that directory can't be properly viewed as a source directory in an IDE, since the classes don't follow Java's rules about how to organize source files into package folders.
I think it's a mistake to not fix this. Just Google for this issue, and you find users complaining all over the internet, confused and struggling by this behavior.
When I want to generate lexer/parser into package
a.b.c
I am using following code:and get generated parser and lexer into
src
directory:src/ALexer.java
src/AParser.java
and etc. But I expect:
src/a/b/c/ALexer.java
src/a/b/c/AParser.java
To get it I should duplicate structure informatio into
-o
option:But It is not so useful as It can be.