Open rimmartin opened 7 years ago
Did a test run, yes there is an error:
error(134): STParser.g4:48:0: symbol template conflicts with generated code in target language or runtime
But files are still generated. Personally I would just modify these places and get going.
In general, this is an interesting problem, suppose Antlr needs to support 2000+ different languages, each lang has a bunch of keywords, and we all know lang designers do the best to be "different", given time, all usable English words will be used as a keyword, then what do we do? :) @parrt
From my own limited experiences, maybe you can also keep a modified copy of the g4 files in your own repo, and target your CI/CD pipeline to that, rather than the upstream. Besides, those g4 files are not even correct in some places.
Yeah, we've been discussing. unfortunately there's no good solution to this.
Some languages (Swift, C#) support keywords escaping.
Also, see another discussion for details https://github.com/antlr/antlr4/issues/1851.
I suggest adding underscore symbol (_
) to the ending of conflicted words in grammar.
I thought about the same thing interestingly. There is nothing one underscore can't solve, if there is, use two. :)
What's the best workaround?
Alias in antlr somehow?
Or change name to maintemplate? A better name?
https://github.com/antlr/grammars-v4/blob/master/stringtemplate/STParser.g4#L42 https://github.com/antlr/grammars-v4/blob/master/stringtemplate/STGParser.g4#L58