Class ProxyParseTreeListenerUtil


  • public class ProxyParseTreeListenerUtil
    extends Object
    Utility class that implements a helper method for achieving a delegation of parsed rules to multiple listeners. For example implementation of proxy parse tree listener see ANTLR issue about it.
    • Constructor Detail

      • ProxyParseTreeListenerUtil

        private ProxyParseTreeListenerUtil()
    • Method Detail

      • delegateEnterRule

        public static void delegateEnterRule​(org.antlr.v4.runtime.ParserRuleContext ctx,
                                             Collection<org.antlr.v4.runtime.tree.ParseTreeListener> listeners,
                                             Collection<ParsingException> errors)
        Delegates enter rule event to collection of parsing listeners and captures parsing exceptions that may appear.
        Parameters:
        ctx - enter rule context; may not be null
        listeners - collection of listeners; may not be null
        errors - collection of errors; may not be null
      • delegateExitRule

        public static void delegateExitRule​(org.antlr.v4.runtime.ParserRuleContext ctx,
                                            Collection<org.antlr.v4.runtime.tree.ParseTreeListener> listeners,
                                            Collection<ParsingException> errors)
        Delegates exit rule event to collection of parsing listeners and captures parsing exceptions that may appear.
        Parameters:
        ctx - exit rule context; may not be null
        listeners - collection of listeners; may not be null
        errors - collection of errors; may not be null
      • visitErrorNode

        public static void visitErrorNode​(org.antlr.v4.runtime.tree.ErrorNode node,
                                          Collection<org.antlr.v4.runtime.tree.ParseTreeListener> listeners,
                                          Collection<ParsingException> errors)
        Delegates visit error node event to collection of parsing listeners and captures parsing exceptions that may appear.
        Parameters:
        node - error node; may not be null
        listeners - collection of listeners; may not be null
        errors - collection of errors; may not be null
      • visitTerminal

        public static void visitTerminal​(org.antlr.v4.runtime.tree.TerminalNode node,
                                         Collection<org.antlr.v4.runtime.tree.ParseTreeListener> listeners,
                                         Collection<ParsingException> errors)
        Delegates visit terminal event to collection of parsing listeners and captures parsing exceptions that may appear.
        Parameters:
        node - terminal node; may not be null
        listeners - collection of listeners; may not be null
        errors - collection of errors; may not be null