antlr / antlr/antlr4

Imported grammars are not validated for file name matching the grammar name

Open
#892 0 comments 0 reactions 0 assignees View on GitHub
comp:tool type:bug
Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

In reviewing [this test](https://github.com/antlr/antlr4/blob/37fb7a71fbb5a8f820644c977419ef3506e23141/tool/test/org/antlr/v4/test/rt/java/TestCompositeParsers.java#L136), it seems the slave grammar **T.g4** contains an invalid header (for grammar `S`). A test should be added which verifies imported grammars meet the same requirements as top-level grammars for file/parser name consistency.

Contributor guide

Open the contributing guide

Research direction

Start with tool/test/org/antlr/v4/test/rt/java/TestCompositeParsers.java at the linked test and inspect how the imported grammar T.g4 is handled. Add coverage showing imported grammars enforce file/parser name consistency like top-level grammars; done means the test fails for the invalid header and passes for valid imported grammar names.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.