Class ExtendedTerminalNode
java.lang.Object
org.antlr.v4.runtime.tree.TerminalNodeImpl
io.github.douira.glsl_transformer.tree.ExtendedTerminalNode
- All Implemented Interfaces:
MoveCheckable,TreeMember,ParseTree,SyntaxTree,TerminalNode,Tree
- Direct Known Subclasses:
ASTNode,EmptyTerminalNode
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
ConstructorsConstructorDescriptionCreates a null-token and parentless terminal node.ExtendedTerminalNode(ExtendedContext parent)Creates a null-token terminal node that has an extended context as a parent.ExtendedTerminalNode(ParserRuleContext parent, Token symbol)Creates a new extended terminal node with a parent node and a token as the symbol. -
Method Summary
Modifier and TypeMethodDescriptionOverride to make type more specificReturns the node that this node replaced during a tree transformation.voidOmits the tokens this node encompasses from the next local root.voidsetPreviousNode(ParseTree previousNode)Allows the transformation phase to tell this node which node it replaces.Methods inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl
accept, getChild, getChildCount, getPayload, getSourceInterval, getSymbol, getText, setParent, toString, toStringTree, toStringTreeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.antlr.v4.runtime.tree.ParseTree
accept, getChild, getText, setParent, toStringTreeMethods inherited from interface org.antlr.v4.runtime.tree.SyntaxTree
getSourceIntervalMethods inherited from interface org.antlr.v4.runtime.tree.Tree
getChildCount, getPayload, toStringTree
-
Constructor Details
-
ExtendedTerminalNode
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
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 a node's addChild method will attach it as a parent.
-
-
Method Details
-
getParent
Override to make type more specific- Specified by:
getParentin interfaceParseTree- Specified by:
getParentin interfaceTree- Specified by:
getParentin interfaceTreeMember- Overrides:
getParentin classTerminalNodeImpl
-
processRemoval
public void processRemoval()Description copied from interface:TreeMemberOmits 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:
processRemovalin interfaceTreeMember
-
getPreviousNode
Description copied from interface:MoveCheckableReturns the node that this node replaced during a tree transformation.- Specified by:
getPreviousNodein interfaceMoveCheckable- Returns:
- The replaced node
-
setPreviousNode
Description copied from interface:MoveCheckableAllows the transformation phase to tell this node which node it replaces.- Specified by:
setPreviousNodein interfaceMoveCheckable- Parameters:
previousNode- The node to set as the previous node in this position in the parent's child array that this node replaces
-