[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6889]
This commit is contained in:
parrt 2010-05-23 16:56:33 -08:00
parent f89ad35e1b
commit 259ec8f693
2 changed files with 21 additions and 1 deletions

View File

@ -33,6 +33,10 @@ public class RuleFunction extends OutputModelObject {
public OrderedHashSet<Decl> decls; public OrderedHashSet<Decl> decls;
public SrcOp code; public SrcOp code;
public RuleFunction(OutputModelFactory factory) {
super(factory);
}
public RuleFunction(OutputModelFactory factory, Rule r) { public RuleFunction(OutputModelFactory factory, Rule r) {
super(factory); super(factory);
this.name = r.name; this.name = r.name;

View File

@ -1,11 +1,27 @@
package org.antlr.v4.codegen.src; package org.antlr.v4.codegen.src;
import org.antlr.v4.codegen.OutputModelFactory; 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 org.antlr.v4.tool.Rule;
import java.util.ArrayList;
/** */ /** */
public class StartRuleFunction extends RuleFunction { public class StartRuleFunction extends RuleFunction {
public StartRuleFunction(OutputModelFactory factory, Rule r) { 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<String>();
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();
}
} }
} }