Class RegExpTree
java.lang.Object
com.google.javascript.jscomp.regex.RegExpTree
An AST for JavaScript regular expressions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
protected abstract void
Appends this regular expression source to the given buffer.abstract List<? extends RegExpTree>
children()
The children of this node.abstract boolean
True if the regular expression contains an anchor :^
or$
.abstract boolean
final boolean
True if the regular expression contains capturing groups.abstract int
hashCode()
abstract boolean
True if the presence or absence of an"i"
flag would change the meaning of this regular expression.static boolean
matchesWholeInput
(RegExpTree t, String flags) True if, but not necessarily always when the, given regular expression must match the whole input or none of it.abstract int
The number of capturing groups.static RegExpTree
parseRegExp
(String pattern, String flags) Parses a regular expression to an AST.abstract RegExpTree
Returns a simpler regular expression that is semantically the same assuming the given flags.final String
final String
toString()
-
Constructor Details
-
RegExpTree
public RegExpTree()
-
-
Method Details
-
simplify
Returns a simpler regular expression that is semantically the same assuming the given flags.- Parameters:
flags
- Regular expression flags, e.g."igm"
.
-
isCaseSensitive
public abstract boolean isCaseSensitive()True if the presence or absence of an"i"
flag would change the meaning of this regular expression. -
containsAnchor
public abstract boolean containsAnchor()True if the regular expression contains an anchor :^
or$
. -
hasCapturingGroup
public final boolean hasCapturingGroup()True if the regular expression contains capturing groups. -
numCapturingGroups
public abstract int numCapturingGroups()The number of capturing groups. -
children
The children of this node. -
appendSourceCode
Appends this regular expression source to the given buffer. -
appendDebugInfo
-
toString
-
toDebugString
-
equals
-
hashCode
public abstract int hashCode() -
parseRegExp
Parses a regular expression to an AST.- Parameters:
pattern
- Thefoo
From/foo/i
.flags
- Thei
From/foo/i
.
-
matchesWholeInput
True if, but not necessarily always when the, given regular expression must match the whole input or none of it.
-