Skip to content

Commit

Permalink
antlr#3878 was missing some scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvergnaud committed Sep 12, 2022
1 parent c51aa8e commit 3f53baf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tool/src/org/antlr/v4/codegen/model/ListenerFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public ListenerFile(OutputModelFactory factory, String fileName) {
}
}
ActionAST ast = g.namedActions.get("header");
if ( ast!=null ) header = new Action(factory, ast);
if ( ast!=null && ast.getScope() == null)
header = new Action(factory, ast);
genPackage = g.tool.genPackage;
accessLevel = g.getOptionString("accessLevel");
exportMacro = g.getOptionString("exportMacro");
Expand Down
2 changes: 1 addition & 1 deletion tool/src/org/antlr/v4/codegen/model/VisitorFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class VisitorFile extends OutputFile {
public VisitorFile(OutputModelFactory factory, String fileName) {
super(factory, fileName);
Grammar g = factory.getGrammar();
namedActions = buildNamedActions(g);
namedActions = buildNamedActions(g, ast -> ast.getScope()==null);
parserName = g.getRecognizerName();
grammarName = g.name;
for (Rule r : g.rules.values()) {
Expand Down

0 comments on commit 3f53baf

Please sign in to comment.