From 259ec8f693e7ce10c2eef4b586415fc52214c1cc Mon Sep 17 00:00:00 2001 From: parrt Date: Sun, 23 May 2010 16:56:33 -0800 Subject: [PATCH] clean up [git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6889] --- .../org/antlr/v4/codegen/src/RuleFunction.java | 4 ++++ .../v4/codegen/src/StartRuleFunction.java | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/tool/src/org/antlr/v4/codegen/src/RuleFunction.java b/tool/src/org/antlr/v4/codegen/src/RuleFunction.java index 352adeb64..4c4ce11ba 100644 --- a/tool/src/org/antlr/v4/codegen/src/RuleFunction.java +++ b/tool/src/org/antlr/v4/codegen/src/RuleFunction.java @@ -33,6 +33,10 @@ public class RuleFunction extends OutputModelObject { public OrderedHashSet decls; public SrcOp code; + public RuleFunction(OutputModelFactory factory) { + super(factory); + } + public RuleFunction(OutputModelFactory factory, Rule r) { super(factory); this.name = r.name; diff --git a/tool/src/org/antlr/v4/codegen/src/StartRuleFunction.java b/tool/src/org/antlr/v4/codegen/src/StartRuleFunction.java index f704b451b..0945f9800 100644 --- a/tool/src/org/antlr/v4/codegen/src/StartRuleFunction.java +++ b/tool/src/org/antlr/v4/codegen/src/StartRuleFunction.java @@ -1,11 +1,27 @@ package org.antlr.v4.codegen.src; import org.antlr.v4.codegen.OutputModelFactory; +import org.antlr.v4.misc.Utils; +import org.antlr.v4.tool.GrammarAST; import org.antlr.v4.tool.Rule; +import java.util.ArrayList; + /** */ public class StartRuleFunction extends RuleFunction { public StartRuleFunction(OutputModelFactory factory, Rule r) { - super(factory, r); + super(factory); + this.name = r.name; + if ( r.modifiers!=null && r.modifiers.size()>0 ) { + this.modifiers = new ArrayList(); + for (GrammarAST t : r.modifiers) modifiers.add(t.getText()); + } + modifiers = Utils.nodesToStrings(r.modifiers); + + ctxType = factory.gen.target.getRuleFunctionContextStructName(r); + + if ( r.args!=null ) { + args = r.args.attributes.values(); + } } }