Class Term

java.lang.Object
com.oracle.truffle.regex.tregex.parser.ast.RegexASTNode
com.oracle.truffle.regex.tregex.parser.ast.Term
All Implemented Interfaces:
AbstractState<Term,ASTTransition>, JsonConvertible
Direct Known Subclasses:
MatchFound, PositionAssertion, QuantifiableTerm, RegexASTSubtreeRootNode

public abstract class Term extends RegexASTNode implements AbstractState<Term,ASTTransition>
A common supertype for all RegexASTNodes except Sequences.

Roughly corresponds to the goal symbol Term in the ECMAScript RegExp syntax. A Term (Term) can be either an Assertion (PositionAssertion or LookAroundAssertion) or an Atom (QuantifiableTerm.

  • Method Details

    • copy

      public abstract Term copy(RegexAST ast)
      Description copied from class: RegexASTNode
      Copy this node only, without any child nodes. The ID and minPath of the copied nodes is left unset.
      Specified by:
      copy in class RegexASTNode
      Parameters:
      ast - RegexAST the node should belong to.
      Returns:
      A shallow copy of this node.
    • copyRecursive

      public abstract Term copyRecursive(RegexAST ast, CompilationBuffer compilationBuffer)
      Description copied from class: RegexASTNode
      Recursively copy this subtree. This method should be used instead of CopyVisitor if the copying process is required to be thread-safe. The ID and minPath of the copied nodes is left unset.
      Specified by:
      copyRecursive in class RegexASTNode
      Parameters:
      ast - RegexAST the new nodes should belong to.
      Returns:
      A deep copy of this node.
    • getSeqIndex

      public int getSeqIndex()
    • setSeqIndex

      public void setSeqIndex(int seqIndex)
    • getSubTreeParent

      public RegexASTSubtreeRootNode getSubTreeParent()
      Description copied from class: RegexASTNode
      Returns the subtree root node that this node is a part of. If this node is nested inside several look-around assertion nodes, returns the innermost one that contains this node. Every AST node should have a subtree parent, but nodes implicitly generated by RegexAST.getNFAAnchoredInitialState(int) and RegexAST.getNFAUnAnchoredInitialState(int) technically don't belong to the AST, so they will return null.
      Specified by:
      getSubTreeParent in class RegexASTNode