public final class Sequence extends RegexASTNode implements RegexASTVisitorIterable
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.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Term term)
|
Sequence |
copy(RegexAST ast)
Copy this node only, without any child nodes.
|
Sequence |
copyRecursive(RegexAST ast,
CompilationBuffer compilationBuffer)
Recursively copy this subtree.
|
boolean |
equalsSemantic(RegexASTNode obj) |
Term |
get(int i) |
int |
getEnclosedCaptureGroupsHigh() |
int |
getEnclosedCaptureGroupsLow() |
Term |
getFirstTerm() |
Term |
getLastTerm() |
Group |
getParent()
Gets the syntactic parent of this AST node.
|
RegexASTSubtreeRootNode |
getSubTreeParent()
Returns the subtree root node that this node is a part of.
|
ArrayList<Term> |
getTerms()
Returns the list of terms that constitute this
Sequence. |
boolean |
isEmpty() |
boolean |
isFirstInGroup() |
boolean |
isLastInGroup() |
boolean |
isLiteral() |
boolean |
isPenultimateInGroup() |
boolean |
isSingleCharClass() |
void |
removeLastTerm()
|
void |
removeTerm(int i,
CompilationBuffer compilationBuffer) |
void |
replace(int index,
Term term)
Replaces the term at position
index with the given Term. |
void |
resetVisitorIterator() |
void |
setParent(RegexASTNode parent)
Sets the syntactic parent of this AST node.
|
int |
size() |
JsonValue |
toJson() |
String |
toString() |
RegexASTNode |
visitorGetNext(boolean reverse) |
boolean |
visitorHasNext() |
asAtomicGroup, asBackReference, asCharacterClass, asConditionalBackReferenceGroup, asGroup, asLookAheadAssertion, asLookAroundAssertion, asLookBehindAssertion, asMatchFound, asPositionAssertion, asQuantifiableTerm, asSequence, 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, isInLookAheadAssertion, isInLookBehindAssertion, isLookAheadAssertion, isLookAroundAssertion, isLookBehindAssertion, isMatchFound, isPositionAssertion, isPrefix, isQuantifiableTerm, isRoot, isSequence, isSubtreeRoot, markAsDead, setDead, setEmptyGuard, setEndsWithDollar, setEndsWithDollar, setExpandedQuantifier, setFlag, setFlag, setFlags, setHasBackReferences, setHasCaptureGroups, setHasCaret, setHasCaret, setHasDollar, setHasDollar, setHasLookAheads, setHasLookBehinds, setHasLoops, setHasLoops, setHasQuantifiers, setId, setMaxPath, setMinPath, setPrefix, setPrefixLengthMax, setPrefixLengthMin, setStartsWithCaret, setStartsWithCaret, startsWithCaret, toJson, toStringWithIDpublic Sequence copy(RegexAST ast)
RegexASTNodecopy in class RegexASTNodeast - RegexAST the node should belong to.public Sequence copyRecursive(RegexAST ast, CompilationBuffer compilationBuffer)
RegexASTNodeCopyVisitor if
the copying process is required to be thread-safe. The ID and minPath of the copied nodes is
left unset.copyRecursive in class RegexASTNodeast - RegexAST the new nodes should belong to.public Group getParent()
RegexASTNodegetParent in class RegexASTNodepublic void setParent(RegexASTNode parent)
RegexASTNodesetParent in class RegexASTNodepublic ArrayList<Term> getTerms()
Sequence.
Note that elements should not be added or removed from this list. Use the methods
Sequence.add(Term) and Sequence.removeLastTerm() instead.
public boolean isEmpty()
public int size()
public Term getFirstTerm()
public Term get(int i)
public Term getLastTerm()
public void add(Term term)
term - public void replace(int index,
Term term)
index with the given Term.term - public void removeTerm(int i,
CompilationBuffer compilationBuffer)
public void removeLastTerm()
public boolean isFirstInGroup()
public boolean isLastInGroup()
public boolean isPenultimateInGroup()
public boolean isLiteral()
public boolean isSingleCharClass()
public int getEnclosedCaptureGroupsLow()
public int getEnclosedCaptureGroupsHigh()
public RegexASTSubtreeRootNode getSubTreeParent()
RegexASTNodeRegexAST.getNFAAnchoredInitialState(int) and
RegexAST.getNFAUnAnchoredInitialState(int) technically don't belong to the AST, so
they will return null.getSubTreeParent in class RegexASTNodepublic boolean visitorHasNext()
visitorHasNext in interface RegexASTVisitorIterablepublic void resetVisitorIterator()
resetVisitorIterator in interface RegexASTVisitorIterablepublic RegexASTNode visitorGetNext(boolean reverse)
visitorGetNext in interface RegexASTVisitorIterablepublic boolean equalsSemantic(RegexASTNode obj)
equalsSemantic in class RegexASTNodepublic JsonValue toJson()
toJson in interface JsonConvertible