Issue Details (XML | Word | Printable)

Key: MANTLR-1
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Sergey Kalinichenko
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Maven 2.x Antlr Plugin

ANTLR plugin does not track dependencies based on importVocab/exportVocab options

Created: 18/Nov/05 03:44 AM   Updated: 07/Jan/09 09:28 AM   Resolved: 07/Jan/09 09:28 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.2

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive bug.zip (0.7 kB)

Environment: Win-XP
Issue Links:
Related
 


 Description  « Hide

When ANTLR parsers (e.g. the text parser and the tree parser) share token vocabularies through the importVocab/exportVocab options, ANTLR plugin does not recognize this as a dependency. As the result, the generated sources may not work as expected if some new tokens are added or tokens are re-arranged in the file with the exportVocab option. I don't know of a work-around that does not involve manual deletion of files or a clean build.

See http://www.antlr.org/doc/vocab.html for information on importVocab/exportVocab.

Steps to reproduce the bug:

1. Create a maven project
2. Unzip the attached file into the src/main directory. This will create antlr directory with two files, bug.g and bugtree.g, in it.
3. Add maven-antlr-plugin to the POM with <grammars>bug.g,bugtree.g</grammars>
4. Run mvn compile
5. Find the BugTokensTokenTypes.java and BugTreeTokenTypes.java in the generated-sources directory; verify that in both files FALSE=4 and TRUE=5
6. Open bug.g file and uncomment the lines that define and reference the token called "NOTHING" (there are comments next to both places); save the file.
7. Run mvn compile again. Note that the plugin does not run antlr for bugtree.g, saying that the grammar is up to date
8. Verify that BugTokensTokenTypes.java and BugTreeTokenTypes.java set different values for the token TRUE: it is 6 in the newly generated BugTokensTokenTypes, but the old BugTreeTokenTypes still says TRUE=5.

Expected behavior:
Ideally, the plugin should recognize that the import vocabulary has changed and rerun the antlr for the file(s) with the corresponding importVocab option. Alternatively, rebuilding all grammars from the list when any of the sources is newer than its corresponding output grammar would be acceptable.



Paul Gier added a comment - 07/Jan/09 09:28 AM

This has been fixed in MANTLR-29