Search in sources :

Example 1 with ListenerDispatchMethod

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

the class AltLabelStructDecl method addDispatchMethods.

@Override
public void addDispatchMethods(Rule r) {
    dispatchMethods = new ArrayList<DispatchMethod>();
    if (factory.getGrammar().tool.gen_listener) {
        dispatchMethods.add(new ListenerDispatchMethod(factory, true));
        dispatchMethods.add(new ListenerDispatchMethod(factory, false));
    }
    if (factory.getGrammar().tool.gen_visitor) {
        dispatchMethods.add(new VisitorDispatchMethod(factory));
    }
}
Also used : VisitorDispatchMethod(org.antlr.v4.codegen.model.VisitorDispatchMethod) ListenerDispatchMethod(org.antlr.v4.codegen.model.ListenerDispatchMethod) ListenerDispatchMethod(org.antlr.v4.codegen.model.ListenerDispatchMethod) VisitorDispatchMethod(org.antlr.v4.codegen.model.VisitorDispatchMethod) DispatchMethod(org.antlr.v4.codegen.model.DispatchMethod)

Example 2 with ListenerDispatchMethod

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

the class StructDecl method addDispatchMethods.

public void addDispatchMethods(Rule r) {
    dispatchMethods = new ArrayList<DispatchMethod>();
    if (!r.hasAltSpecificContexts()) {
        // no enter/exit for this ruleContext if rule has labels
        if (factory.getGrammar().tool.gen_listener) {
            dispatchMethods.add(new ListenerDispatchMethod(factory, true));
            dispatchMethods.add(new ListenerDispatchMethod(factory, false));
        }
        if (factory.getGrammar().tool.gen_visitor) {
            dispatchMethods.add(new VisitorDispatchMethod(factory));
        }
    }
}
Also used : VisitorDispatchMethod(org.antlr.v4.codegen.model.VisitorDispatchMethod) ListenerDispatchMethod(org.antlr.v4.codegen.model.ListenerDispatchMethod) ListenerDispatchMethod(org.antlr.v4.codegen.model.ListenerDispatchMethod) VisitorDispatchMethod(org.antlr.v4.codegen.model.VisitorDispatchMethod) DispatchMethod(org.antlr.v4.codegen.model.DispatchMethod)

Aggregations

DispatchMethod (org.antlr.v4.codegen.model.DispatchMethod)2 ListenerDispatchMethod (org.antlr.v4.codegen.model.ListenerDispatchMethod)2 VisitorDispatchMethod (org.antlr.v4.codegen.model.VisitorDispatchMethod)2