public class CharacterClass extends QuantifiableTerm
Term that matches characters belonging to a specified set of characters.
Corresponds to the right-hand sides PatternCharacter, . and CharacterClass of the goal symbol Atom and the right-hand sides CharacterClassEscape and CharacterEscape of the goal symbol AtomEscape in the ECMAScript RegExp syntax.
Note that CharacterClass nodes and the CodePointSets that they rely on can only
match characters from the Basic Multilingual Plane (and whose code point fits into 16-bit
integers). Any term which matches characters outside of the Basic Multilingual Plane is expanded
by RegexParser into a more complex expression which matches the individual code units
that would make up the UTF-16 encoding of those characters.
| Modifier and Type | Method and Description |
|---|---|
void |
addLookBehindEntry(RegexAST ast,
LookBehindAssertion lookBehindEntry) |
CharacterClass |
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) |
void |
extractSingleChar(char[] literal,
char[] mask,
int i) |
void |
extractSingleChar(CharArrayBuffer literal,
CharArrayBuffer mask) |
CodePointSet |
getCharSet()
Returns the
CodePointSet representing the set of characters that can be matched by
this CharacterClass. |
Set<LookBehindAssertion> |
getLookBehindEntries()
Returns the (fixed-length) look-behind assertions whose first characters can match the same
character as this node.
|
Sequence |
getParent()
Gets the syntactic parent of this AST node.
|
boolean |
hasLookBehindEntries() |
boolean |
isUnrollingCandidate()
Returns
true iff the parser should try to unroll this term's quantifier. |
void |
setCharSet(CodePointSet charSet) |
void |
setWasSingleChar() |
void |
setWasSingleChar(boolean value) |
JsonValue |
toJson() |
String |
toString() |
boolean |
wasSingleChar() |
equalsSemantic, getQuantifier, getSubTreeParent, hasNotUnrolledQuantifier, hasQuantifier, quantifierToString, setQuantifiergetSeqIndex, setSeqIndexasBackReference, asCharacterClass, asGroup, asLookAheadAssertion, asLookAroundAssertion, asLookBehindAssertion, asMatchFound, asPositionAssertion, asQuantifiableTerm, asSequence, astNodeId, endsWithDollar, getFlags, getId, getMaxPath, getMinPath, hasBackReferences, hasCaptureGroups, hasCaret, hasDollar, hasEmptyGuard, hasLookAheads, hasLookBehinds, hasLoops, hasQuantifiers, idInitialized, incMaxPath, incMaxPath, incMinPath, incMinPath, isBackReference, isCaret, isCharacterClass, 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, setParent, setPrefix, setStartsWithCaret, setStartsWithCaret, startsWithCaret, toJson, toStringWithIDclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetIdpublic CharacterClass 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 QuantifiableTermast - RegexAST the new nodes should belong to.public Sequence getParent()
RegexASTNodegetParent in class RegexASTNodepublic CodePointSet getCharSet()
CodePointSet representing the set of characters that can be matched by
this CharacterClass.public void setCharSet(CodePointSet charSet)
public boolean wasSingleChar()
public void setWasSingleChar()
public void setWasSingleChar(boolean value)
public boolean isUnrollingCandidate()
QuantifiableTermtrue iff the parser should try to unroll this term's quantifier.isUnrollingCandidate in class QuantifiableTermpublic void addLookBehindEntry(RegexAST ast, LookBehindAssertion lookBehindEntry)
public boolean hasLookBehindEntries()
public Set<LookBehindAssertion> getLookBehindEntries()
Group bodies of the
LookBehindAssertion nodes, not the LookBehindAssertion nodes themselves.public void extractSingleChar(CharArrayBuffer literal, CharArrayBuffer mask)
public void extractSingleChar(char[] literal,
char[] mask,
int i)
public boolean equalsSemantic(RegexASTNode obj, boolean ignoreQuantifier)
equalsSemantic in class QuantifiableTermpublic JsonValue toJson()