[antlr4, maven testing] Fix for #4569: predefined.tokens interfering with testing. #4570
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for #4569.
The file predefined.tokens, introduced in #4424, breaks Maven testing of the whole repo, which is accomplished by typing
mvn clean testin the root directory. Not only does this test each grammar, but it also tests the root pom.xml. Users still test using Maven. So, we are going to reintroduce Maven testing, but in a more "incremental" way.In this PR, the
predefined.tokensfile is replaced with an ordered list of tokens in the grammar. I would recommend the file be removed, but it can be kept for reference; the option to include the file is still there, but commented out. In addition, I noticed an error in the file:TOKEN_REFis listed twice.grammars-v4/antlr/antlr4/predefined.tokens
Lines 9 to 10 in 1dc19f1
I changed the file to remove the duplicate. The order of token types is not a requirement for most tools that use this grammar, but antlr-ng does. This change works at least for the Antlr4 Tool because the token vocabulary is imported prior to processing the grammar. https://github.com/antlr/antlr4/blob/6a15cc32dea4e1ec4aa2abbdc90e1b54cf288c58/tool/src/org/antlr/v4/tool/Grammar.java#L360-L362 I don't know whether this works in antlr-ng because the code deviates from that of Antlr4 Tool. https://github.com/antlr-ng/antlr-ng/blob/54a9460f1cdcdb1aa0b7f90420a9f0dab820351a/src/tool/Grammar.ts#L269-L273
tool.process()was moved.mvn clean testat root now works.