Search in sources :

Example 1 with RulePropertyRef

use of org.antlr.v4.codegen.model.chunk.RulePropertyRef in project antlr4 by antlr.

the class ActionTranslator method getRulePropertyRef.

RulePropertyRef getRulePropertyRef(Token x, Token prop) {
    Grammar g = factory.getGrammar();
    try {
        Class<? extends RulePropertyRef> c = rulePropToModelMap.get(prop.getText());
        Constructor<? extends RulePropertyRef> ctor = c.getConstructor(StructDecl.class, String.class);
        RulePropertyRef ref = ctor.newInstance(nodeContext, getRuleLabel(x.getText()));
        return ref;
    } catch (Exception e) {
        g.tool.errMgr.toolError(ErrorType.INTERNAL_ERROR, e, prop.getText());
    }
    return null;
}
Also used : RulePropertyRef(org.antlr.v4.codegen.model.chunk.RulePropertyRef) Grammar(org.antlr.v4.tool.Grammar)

Aggregations

RulePropertyRef (org.antlr.v4.codegen.model.chunk.RulePropertyRef)1 Grammar (org.antlr.v4.tool.Grammar)1