Class LookAroundAssertion
java.lang.Object
com.oracle.truffle.regex.tregex.parser.ast.RegexASTNode
com.oracle.truffle.regex.tregex.parser.ast.Term
com.oracle.truffle.regex.tregex.parser.ast.RegexASTSubtreeRootNode
com.oracle.truffle.regex.tregex.parser.ast.LookAroundAssertion
- All Implemented Interfaces:
AbstractState<Term,,ASTTransition> RegexASTVisitorIterable,JsonConvertible
- Direct Known Subclasses:
LookAheadAssertion,LookBehindAssertion
An assertion that succeeds depending on whether or not text surrounding the current position
matches a given regular expression.
See its two subclasses, LookAheadAssertion and LookBehindAssertion.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanintReturns the length of the words that can be matched by the body of this lookbehind assertion.booleanChecks if the contents of this assertion (RegexASTSubtreeRootNode.getGroup()) are in "literal" form.booleanIndicates whether this is a negative lookaround assertion (written as(?!...)(?<!...)) or a positive one (written as(?=...)or(?<=)).booleanvoidsetNegated(boolean negated) booleanMethods inherited from class com.oracle.truffle.regex.tregex.parser.ast.RegexASTSubtreeRootNode
copy, getAnchoredFinalState, getAnchoredInitialState, getGlobalSubTreeId, getGroup, getMatchFound, getPrefix, getSubTreeId, getSubtrees, getUnAnchoredInitialState, globalSubTreeIdInitialized, resetVisitorIterator, setAnchoredFinalState, setAnchoredInitialState, setGlobalSubTreeId, setGroup, setMatchFound, setSubTreeId, setUnAnchoredInitialState, subTreeIdInitialized, toJson, toString, visitorGetNext, visitorHasNextMethods inherited from class com.oracle.truffle.regex.tregex.parser.ast.Term
copyRecursive, getSeqIndex, getSubTreeParent, setSeqIndexMethods 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, equalsSemantic, getFlags, getId, getMaxPath, getMinPath, getParent, 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, setParent, setPrefix, setPrefixLengthMax, setPrefixLengthMin, setQuantifierPassThroughSequence, setStartsWithCaret, setStartsWithCaret, startsWithCaret, toStringWithIDMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.truffle.regex.tregex.automaton.AbstractState
getIdMethods inherited from interface com.oracle.truffle.regex.tregex.util.json.JsonConvertible
toJson
-
Method Details
-
isNegated
public boolean isNegated()Indicates whether this is a negative lookaround assertion (written as(?!...)(?<!...)) or a positive one (written as(?=...)or(?<=)).Positive lookaround assertions match if and only if the text around the current position matches the contents of the assertion. Negative lookaround assertions match if and only if the text around the current position does not match the contents of the assertion.
-
setNegated
public void setNegated(boolean negated) -
startsWithCharClass
public boolean startsWithCharClass() -
endsWithCharClass
public boolean endsWithCharClass() -
isLiteral
public boolean isLiteral()Checks if the contents of this assertion (RegexASTSubtreeRootNode.getGroup()) are in "literal" form. This means that there is only a single alternative which is composed of a sequence ofCharacterClassnodes. -
getLiteralLength
public int getLiteralLength()Returns the length of the words that can be matched by the body of this lookbehind assertion.Because we restrict the regular expressions used in lookbehind assertions to "literal" regular expressions, all strings that match the body of the assertion are guaranteed to be of the same length. This is critical to how lookbehind is implemented, because it tells us how much do we have to rewind when matching a regular expression with lookbehind assertions.
-
isSingleCCNonCapturingLiteral
public boolean isSingleCCNonCapturingLiteral()
-