You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find that in ANTLR 4 I'm more likely to use separated grammars than combined grammars. However, I wish the names of listeners/visitors generated by the separated grammars to match those of the combined grammar. In particular, if (and only if) a parser grammar is named *Parser, I'd like to drop the Parser suffix as part of deriving the generated file names.
The text was updated successfully, but these errors were encountered:
This is particularly annoying if your project starts out with a combined grammar and you later need to convert it to separate lexer/parser grammars. Obviously you can't fix the default behavior without an incompatible change to the generated names, but you could add an option or options to enable some other behavior.
Note that if you name the parser grammar Foo then you get the mostly the same names as in the combined grammar with the exception of the parser class, which is just called Foo instead of FooParser. You can then create a subclass named FooParser to get pretty close to the combined grammar behavior.
Given that the primary problems are going to come about from going from a combined grammar to a split grammar and not the other way around, I think that providing an option to let you specify the name of the parser class might be sufficient.
Here is the current naming:
Combined
FooLexer
,FooParser
FooListener
,FooBaseListener
FooParseListener
,FooBaseParseListener
FooVisitor
,FooBaseVisitor
Separated
FooLexer
,FooParser
FooParserListener
,FooParserBaseListener
FooParserParseListener
,FooParserBaseParseListener
FooParserVisitor
,FooParserBaseVisitor
Request
I find that in ANTLR 4 I'm more likely to use separated grammars than combined grammars. However, I wish the names of listeners/visitors generated by the separated grammars to match those of the combined grammar. In particular, if (and only if) a parser grammar is named
*Parser
, I'd like to drop theParser
suffix as part of deriving the generated file names.The text was updated successfully, but these errors were encountered: