Reputation: 77
I have a rather complex ANTLR grammar with a lot of custom handling code (which among other things is used for the creation of internal data structures and handling of data in general). What I'd like to know is if ANTLR provides any capability (or if there is any existing tool) for removing all the custom grammar handling (e.g. Java code, @init, @after sections, parameters, return types, etc) and leave me with the barebones grammar definition. I know that I could do this with some regex handling, but I imagined this could be a recurring task so there may already be something out there that does this.
Example:
rule[String blabla] returns [blabla]
scope{
blablabal;
}
@init{
blalbabla;
}
:
STRING COMMA STRING {blablabla code blablabla;}
;
would return
rule:
STRING COMMA STRING
;
Upvotes: 1
Views: 172