Symbol conflicts for "NULL" are not detected for C++ target.
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
If in the antlr grammar there is a lexical rules has the symbol "NULL", the code generated for \Parser.h is like this:
```
enum {
... , NULL = 3, ...
};
```
where NULL has been defined in macro to 0, and results in a compile error.
I know ANTLR will throw an error if "class" is used as a symbol, like
`error(134): c:\path\to\grammar.g4:8:37: symbol class conflicts with generated code in target language or runtime`
So maybe consider throw an error for "NULL" as well? I suppose it should be a minor change.
Contributor guide
Research direction
Start with the C++ target's generated Parser.h output and the existing diagnostic for symbols such as "class" that conflict with generated code. Reproduce the issue with a grammar containing a lexical rule named "NULL", then verify that the conflict is reported before generated code produces a compile error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100