java.lang.Object
io.github.douira.glsl_transformer.ast.node.basic.ASTNode
Direct Known Subclasses:
Identifier, InnerASTNode, VersionStatement

public abstract class ASTNode extends Object
  • Constructor Details

    • ASTNode

      public ASTNode()
  • Method Details

    • accept

      public abstract <R> R accept(ASTVisitor<R> visitor)
    • getParent

      public ASTNode getParent()
    • getParentSetter

      public Consumer<ASTNode> getParentSetter()
    • replaceInParent

      public boolean replaceInParent(ASTNode replacement)
    • removeFromParent

      public boolean removeFromParent()
    • getNthParent

      public ASTNode getNthParent(int n)
    • getFirstOfType

      public ASTNode getFirstOfType(int limit, Class<? extends ASTNode> type)
    • getFirstParentOfType

      public ASTNode getFirstParentOfType(int limit, Class<? extends ASTNode> type)
    • getRoot

      public Root getRoot()
    • setParent

      public boolean setParent(ASTNode parent, Consumer<? extends ASTNode> setter)
      Sets the parent of this node and handles registration.
      Parameters:
      parent - The parent value to set, cannot be null.
      Returns:
      true if the parent was changed, false otherwise.
    • detachFromParent

      public void detachFromParent()
      To be called after removing this node from its parent. This unregisters it and all its children from the parent's root. Use a simple setParent(ASTNode, Consumer) to move a subtree from one node to the other.
    • setup

      public <NodeType extends ASTNode> NodeType setup(NodeType node, Consumer<? extends NodeType> setter)
    • updateParents

      public <NodeType extends ASTNode> void updateParents(NodeType currentNode, NodeType newNode, Consumer<? extends NodeType> setter)