public class LookBehindAssertion extends LookAroundAssertion
Corresponds to the ( ? <= Disjunction ) and ( ? <! Disjunction ) right-hand sides of the Assertion goal symbol in the ECMAScript RegExp syntax.
Currently, the fragment of regular expressions that TRegex supports in lookbehind assertions is
limited to so-called "literal" regular expressions, consisting only of concatenations and
character classes (which generalize literal characters). The method LookBehindAssertion.isLiteral() verifies
whether the body of the assertion (RegexASTSubtreeRootNode.getGroup()) is of this form.
FLAG_CHARACTER_CLASS_WAS_SINGLE_CHAR, FLAG_EMPTY_GUARD, FLAG_GROUP_EXPANDED_QUANTIFIER, FLAG_GROUP_LOOP, FLAG_HAS_LOOPS, FLAG_LOOK_AROUND_NEGATED| Modifier and Type | Method and Description |
|---|---|
LookBehindAssertion |
copy(RegexAST ast,
boolean recursive)
Copy this node, in one of the following ways:
if
recursive is true, recursively copy this subtree. |
boolean |
equalsSemantic(RegexASTNode obj,
boolean ignoreQuantifier) |
int |
getLength()
Returns the length of the words that can be matched by the body of this lookbehind assertion.
|
String |
getPrefix() |
boolean |
isLiteral()
Verifies that the contents of this assertion (
RegexASTSubtreeRootNode.getGroup()) are in "literal" form. |
JsonValue |
toJson() |
isNegated, setNegatedgetGroup, getMatchFound, resetVisitorIterator, setGroup, setMatchFound, toJson, toString, visitorGetNext, visitorHasNextequalsSemantic, getQuantifier, getSeqIndex, getSubTreeParent, hasQuantifier, quantifierToString, setQuantifier, setSeqIndexastNodeId, endsWithDollar, getId, getMaxPath, getMinPath, getParent, hasEmptyGuard, hasLoops, idInitialized, incMaxPath, incMaxPath, incMinPath, incMinPath, isDead, isFlagSet, isInLookAheadAssertion, isInLookBehindAssertion, isPrefix, markAsDead, setEmptyGuard, setEndsWithDollar, setEndsWithDollar, setFlag, setFlag, setHasLoops, setHasLoops, setId, setMaxPath, setMinPath, setParent, setPrefix, setStartsWithCaret, setStartsWithCaret, startsWithCaret, toStringWithIDpublic LookBehindAssertion copy(RegexAST ast, boolean recursive)
RegexASTNoderecursive is true, recursively copy this subtree. This method should
be used instead of CopyVisitor if the copying process is required to be thread-safe.
copy in class RegexASTSubtreeRootNodeast - RegexAST the new nodes should belong to.public boolean isLiteral()
RegexASTSubtreeRootNode.getGroup()) are in "literal" form.
This means that there is only a single alternative which is composed of a sequence of
CharacterClass nodes and terminated by a MatchFound node.public int getLength()
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.
public String getPrefix()
getPrefix in class RegexASTSubtreeRootNodepublic boolean equalsSemantic(RegexASTNode obj, boolean ignoreQuantifier)
equalsSemantic in class Termpublic JsonValue toJson()