Class ExtendedTerminalNode

java.lang.Object
org.antlr.v4.runtime.tree.TerminalNodeImpl
io.github.douira.glsl_transformer.generic.ExtendedTerminalNode
All Implemented Interfaces:
TreeMember, org.antlr.v4.runtime.tree.ParseTree, org.antlr.v4.runtime.tree.SyntaxTree, org.antlr.v4.runtime.tree.TerminalNode, org.antlr.v4.runtime.tree.Tree
Direct Known Subclasses:
ASTNode, EmptyTerminalNode

public class ExtendedTerminalNode extends org.antlr.v4.runtime.tree.TerminalNodeImpl implements TreeMember
The extended terminal node has additional functionality over the regular terminal node. Most importantly, it implements the functionality required to be a tree member.
  • Field Summary

    Fields inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl

    parent, symbol
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a null-token and parentless terminal node.
    Creates a null-token terminal node that has an extended context as a parent.
    ExtendedTerminalNode(org.antlr.v4.runtime.ParserRuleContext parent, org.antlr.v4.runtime.Token symbol)
    Creates a new extended terminal node with a parent node and a token as the symbol.
  • Method Summary

    Modifier and Type
    Method
    Description
    Override to make type more specific
    void
    Omits the tokens this node encompasses from the next local root.

    Methods inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl

    accept, getChild, getChildCount, getPayload, getSourceInterval, getSymbol, getText, setParent, toString, toStringTree, toStringTree

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.antlr.v4.runtime.tree.ParseTree

    accept, getChild, getText, setParent, toStringTree

    Methods inherited from interface org.antlr.v4.runtime.tree.SyntaxTree

    getSourceInterval

    Methods inherited from interface org.antlr.v4.runtime.tree.Tree

    getChildCount, getPayload, toStringTree
  • Constructor Details

    • ExtendedTerminalNode

      public ExtendedTerminalNode(org.antlr.v4.runtime.ParserRuleContext parent, org.antlr.v4.runtime.Token symbol)
      Creates a new extended terminal node with a parent node and a token as the symbol.
      Parameters:
      parent - The parent node. This is a parser rule context because the parser passes a parser rule context when it creates new terminal nodes.
      symbol - The token to contain with this terminal node
    • ExtendedTerminalNode

      public ExtendedTerminalNode(ExtendedContext parent)
      Creates a null-token terminal node that has an extended context as a parent. This should only be used when the node is a placeholder for something. It will not be printed since the token is null.
      Parameters:
      parent - The parent node
    • ExtendedTerminalNode

      public ExtendedTerminalNode()
      Creates a null-token and parentless terminal node. This is to be used when the node is a placeholder and it will be added to a parse tree node. Adding it as a child using the node's method will attach it as a parent.
  • Method Details

    • getParent

      public ExtendedContext getParent()
      Override to make type more specific
      Specified by:
      getParent in interface org.antlr.v4.runtime.tree.ParseTree
      Specified by:
      getParent in interface org.antlr.v4.runtime.tree.Tree
      Specified by:
      getParent in interface TreeMember
      Overrides:
      getParent in class org.antlr.v4.runtime.tree.TerminalNodeImpl
    • omitTokens

      public void omitTokens()
      Description copied from interface: TreeMember
      Omits the tokens this node encompasses from the next local root. For terminal nodes this is always at least the parent's local root. Other nodes may be their own local root.
      Specified by:
      omitTokens in interface TreeMember