Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvergnaud committed Sep 7, 2022
1 parent 965cf47 commit e1de8c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tool/src/org/antlr/v4/codegen/CodeGenPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public void process() {
writeRecognizer(parser, gen, false);
}

g.removeParserHeader();

if ( g.tool.gen_listener ) {
if (gen.getTarget().needsHeader()) {
ST listener = gen.generateListener(true);
Expand Down
5 changes: 5 additions & 0 deletions tool/src/org/antlr/v4/tool/Grammar.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ public void defineAction(GrammarAST atAST) {
}
}

public void removeParserHeader() {
namedActions.remove("header");
}

/**
* Define the specified rule in the grammar. This method assigns the rule's
* {@link Rule#index} according to the {@link #ruleNumber} field, and adds
Expand Down Expand Up @@ -1364,4 +1368,5 @@ public ParserInterpreter createParserInterpreter(TokenStream tokenStream) {

return new ParserInterpreter(fileName, getVocabulary(), Arrays.asList(getRuleNames()), deserializedATN, tokenStream);
}

}

0 comments on commit e1de8c7

Please sign in to comment.