public class CharacterClass extends Term
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 CharSets 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.
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 |
|---|---|
void |
addLookBehindEntry(RegexAST ast,
Group 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) |
CharSet |
getCharSet()
Returns the
CharSet representing the set of characters that can be matched by this
CharacterClass. |
Set<Group> |
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() |
void |
setCharSet(CharSet charSet) |
void |
setWasSingleChar() |
void |
setWasSingleChar(boolean value) |
JsonValue |
toJson() |
String |
toString() |
boolean |
wasSingleChar() |
equalsSemantic, getQuantifier, getSeqIndex, getSubTreeParent, hasQuantifier, quantifierToString, setQuantifier, setSeqIndexastNodeId, endsWithDollar, getId, getMaxPath, getMinPath, 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, toJson, toStringWithIDpublic 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.
public Sequence getParent()
RegexASTNodegetParent in class RegexASTNodepublic CharSet getCharSet()
CharSet representing the set of characters that can be matched by this
CharacterClass.public void setCharSet(CharSet charSet)
public boolean wasSingleChar()
public void setWasSingleChar()
public void setWasSingleChar(boolean value)
public boolean hasLookBehindEntries()
public Set<Group> 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 Termpublic JsonValue toJson()