use of org.antlr.v4.codegen.model.decl.ContextTokenGetterDecl in project antlr4 by antlr.
the class RuleFunction method getDeclForAltElement.
public List<Decl> getDeclForAltElement(GrammarAST t, String refLabelName, boolean needList, boolean optional) {
List<Decl> decls = new ArrayList<Decl>();
if (t.getType() == RULE_REF) {
Rule rref = factory.getGrammar().getRule(t.getText());
String ctxName = factory.getGenerator().getTarget().getRuleFunctionContextStructName(rref);
if (needList) {
if (factory.getGenerator().getTarget().supportsOverloadedMethods())
decls.add(new ContextRuleListGetterDecl(factory, refLabelName, ctxName));
decls.add(new ContextRuleListIndexedGetterDecl(factory, refLabelName, ctxName));
} else {
decls.add(new ContextRuleGetterDecl(factory, refLabelName, ctxName, optional));
}
} else {
if (needList) {
if (factory.getGenerator().getTarget().supportsOverloadedMethods())
decls.add(new ContextTokenListGetterDecl(factory, refLabelName));
decls.add(new ContextTokenListIndexedGetterDecl(factory, refLabelName));
} else {
decls.add(new ContextTokenGetterDecl(factory, refLabelName, optional));
}
}
return decls;
}
Aggregations