Class ProxyParseTreeListener

java.lang.Object
io.github.douira.glsl_transformer.generic.ProxyParseTreeListener
All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeListener

public class ProxyParseTreeListener extends Object implements org.antlr.v4.runtime.tree.ParseTreeListener
This class was taken from here and was added to the public domain by the author DaveJarvis Instances of this class allows multiple listeners to receive events while walking the parse tree. For example:
 ProxyParseTreeListener proxy = new ProxyParseTreeListener();
 ParseTreeListener listener1 = ... ;
 ParseTreeListener listener2 = ... ;
 proxy.add( listener1 );
 proxy.add( listener2 );
 ParseTreeWalker.DEFAULT.walk( proxy, ctx );
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new proxy without an empty list of listeners.
    ProxyParseTreeListener(List<org.antlr.v4.runtime.tree.ParseTreeListener> listeners)
    Creates a new proxy with the given list of listeners.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(org.antlr.v4.runtime.tree.ParseTreeListener listener)
    Adds the given listener to the list of event notification recipients.
    void
    enterEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)
     
    void
    exitEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)
     
    boolean
    Checks if the list of listeners is empty.
    boolean
    remove(org.antlr.v4.runtime.tree.ParseTreeListener listener)
    Removes the given listener to the list of event notification recipients.
    void
    setListeners(List<org.antlr.v4.runtime.tree.ParseTreeListener> listeners)
    Changes the list of listeners to receive events.
    void
    visitErrorNode(org.antlr.v4.runtime.tree.ErrorNode node)
     
    void
    visitTerminal(org.antlr.v4.runtime.tree.TerminalNode node)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProxyParseTreeListener

      public ProxyParseTreeListener()
      Creates a new proxy without an empty list of listeners. Add listeners before walking the tree.
    • ProxyParseTreeListener

      public ProxyParseTreeListener(List<org.antlr.v4.runtime.tree.ParseTreeListener> listeners)
      Creates a new proxy with the given list of listeners.
      Parameters:
      listeners - A list of listerners to receive events.
  • Method Details

    • enterEveryRule

      public void enterEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)
      Specified by:
      enterEveryRule in interface org.antlr.v4.runtime.tree.ParseTreeListener
    • exitEveryRule

      public void exitEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)
      Specified by:
      exitEveryRule in interface org.antlr.v4.runtime.tree.ParseTreeListener
    • visitErrorNode

      public void visitErrorNode(org.antlr.v4.runtime.tree.ErrorNode node)
      Specified by:
      visitErrorNode in interface org.antlr.v4.runtime.tree.ParseTreeListener
    • visitTerminal

      public void visitTerminal(org.antlr.v4.runtime.tree.TerminalNode node)
      Specified by:
      visitTerminal in interface org.antlr.v4.runtime.tree.ParseTreeListener
    • add

      public void add(org.antlr.v4.runtime.tree.ParseTreeListener listener)
      Adds the given listener to the list of event notification recipients.
      Parameters:
      listener - A listener to begin receiving events.
    • remove

      public boolean remove(org.antlr.v4.runtime.tree.ParseTreeListener listener)
      Removes the given listener to the list of event notification recipients.
      Parameters:
      listener - A listener to stop receiving events.
      Returns:
      false The listener was not registered to receive events.
    • setListeners

      public void setListeners(List<org.antlr.v4.runtime.tree.ParseTreeListener> listeners)
      Changes the list of listeners to receive events. If the given list of listeners is null, an empty list will be created.
      Parameters:
      listeners - A list of listeners to receive tree walking events.
    • isEmpty

      public boolean isEmpty()
      Checks if the list of listeners is empty.
      Returns:
      true if there are not listeners in the list