forked from jasder/antlr
clean up
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6889]
This commit is contained in:
parent
f89ad35e1b
commit
259ec8f693
|
@ -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;
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue