Class Sequence
java.lang.Object
com.oracle.truffle.regex.tregex.parser.ast.RegexASTNode
com.oracle.truffle.regex.tregex.parser.ast.Sequence
- All Implemented Interfaces:
RegexASTVisitorIterable,JsonConvertible
A Sequence is a concatenation of
Terms.
Sequences are used as the alternatives in a Group. They are the only subtype of
RegexASTNode which does not extend Term. In order to coerce a Sequence into a
Term, wrap it in a Group (as its only alternative).
Corresponds to the goal symbol Alternative in the ECMAScript RegExp syntax.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCopy this node only, without any child nodes.copyRecursive(RegexAST ast, CompilationBuffer compilationBuffer) Recursively copy this subtree.booleanget(int i) intintGets the syntactic parent of this AST node.Returns the subtree root node that this node is a part of.getTerms()Returns the list of terms that constitute thisSequence.booleanisEmpty()booleanbooleanbooleanbooleanbooleanvoidvoidremoveTerm(int i, CompilationBuffer compilationBuffer) voidReplaces the term at positionindexwith the givenTerm.voidvoidsetParent(RegexASTNode parent) Sets the syntactic parent of this AST node.intsize()toJson()toString()visitorGetNext(boolean reverse) booleanMethods inherited from class com.oracle.truffle.regex.tregex.parser.ast.RegexASTNode
asAtomicGroup, asBackReference, asCharacterClass, asConditionalBackReferenceGroup, asGroup, asLookAheadAssertion, asLookAroundAssertion, asLookBehindAssertion, asMatchFound, asPositionAssertion, asQuantifiableTerm, asSequence, asSubexpressionCall, asSubtreeRootNode, astNodeId, endsWithDollar, getFlags, getId, getMaxPath, getMinPath, getPrefixLengthMax, getPrefixLengthMin, hasBackReferences, hasCaptureGroups, hasCaret, hasDollar, hasEmptyGuard, hasLookAheads, hasLookBehinds, hasLoops, hasQuantifiers, hasVariablePrefixLength, idInitialized, incMaxPath, incMaxPath, incMinPath, incMinPath, isAtomicGroup, isBackReference, isCaret, isCharacterClass, isConditionalBackReferenceGroup, isDead, isDollar, isExpandedQuantifier, isFlagSet, isGroup, isGroupWithGuards, isInLookAheadAssertion, isInLookBehindAssertion, isLookAheadAssertion, isLookAroundAssertion, isLookBehindAssertion, isMandatoryUnrolledQuantifier, isMatchFound, isPositionAssertion, isPrefix, isQuantifiableTerm, isQuantifierPassThroughSequence, isRoot, isSequence, isSubexpressionCall, isSubtreeRoot, markAsDead, setDead, setEmptyGuard, setEndsWithDollar, setEndsWithDollar, setExpandedQuantifier, setFlag, setFlag, setFlags, setHasBackReferences, setHasCaptureGroups, setHasCaret, setHasCaret, setHasDollar, setHasDollar, setHasLookAheads, setHasLookBehinds, setHasLoops, setHasLoops, setHasQuantifiers, setId, setMandatoryUnrolledQuantifier, setMaxPath, setMinPath, setPrefix, setPrefixLengthMax, setPrefixLengthMin, setQuantifierPassThroughSequence, setStartsWithCaret, setStartsWithCaret, startsWithCaret, toJson, toStringWithID
-
Method Details
-
copy
Description copied from class:RegexASTNodeCopy this node only, without any child nodes. The ID and minPath of the copied nodes is left unset.- Specified by:
copyin classRegexASTNode- Parameters:
ast- RegexAST the node should belong to.- Returns:
- A shallow copy of this node.
-
copyRecursive
Description copied from class:RegexASTNodeRecursively copy this subtree. This method should be used instead ofCopyVisitorif the copying process is required to be thread-safe. The ID and minPath of the copied nodes is left unset.- Specified by:
copyRecursivein classRegexASTNode- Parameters:
ast- RegexAST the new nodes should belong to.- Returns:
- A deep copy of this node.
-
getParent
Description copied from class:RegexASTNodeGets the syntactic parent of this AST node.- Overrides:
getParentin classRegexASTNode
-
setParent
Description copied from class:RegexASTNodeSets the syntactic parent of this AST node.- Overrides:
setParentin classRegexASTNode- Parameters:
parent-
-
getTerms
Returns the list of terms that constitute thisSequence.Note that elements should not be added or removed from this list. Use the methods
add(Term)andremoveLastTerm()instead. -
isEmpty
public boolean isEmpty() -
size
public int size() -
getFirstTerm
-
get
-
getLastTerm
-
add
-
replace
-
removeTerm
-
removeLastTerm
-
isFirstInGroup
public boolean isFirstInGroup() -
isLastInGroup
public boolean isLastInGroup() -
isPenultimateInGroup
public boolean isPenultimateInGroup() -
isLiteral
public boolean isLiteral() -
isSingleCharClass
public boolean isSingleCharClass() -
getEnclosedCaptureGroupsLow
public int getEnclosedCaptureGroupsLow() -
getEnclosedCaptureGroupsHigh
public int getEnclosedCaptureGroupsHigh() -
getSubTreeParent
Description copied from class:RegexASTNodeReturns 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 byRegexAST.getNFAAnchoredInitialState(int)andRegexAST.getNFAUnAnchoredInitialState(int)technically don't belong to the AST, so they will returnnull.- Specified by:
getSubTreeParentin classRegexASTNode
-
visitorHasNext
public boolean visitorHasNext()- Specified by:
visitorHasNextin interfaceRegexASTVisitorIterable
-
resetVisitorIterator
public void resetVisitorIterator()- Specified by:
resetVisitorIteratorin interfaceRegexASTVisitorIterable
-
visitorGetNext
- Specified by:
visitorGetNextin interfaceRegexASTVisitorIterable
-
equalsSemantic
- Specified by:
equalsSemanticin classRegexASTNode
-
toString
-
toJson
- Specified by:
toJsonin interfaceJsonConvertible
-