public abstract class RegExpTree
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RegExpTree.Alternation
Represents the possibilities ["foo", "bar" ] for a RegExp /foo|bar/
|
static class |
RegExpTree.Anchor
Represents an anchor, namely ^ or $.
|
static class |
RegExpTree.BackReference
Represents a reference to a previous group such as \1 or \2
|
static class |
RegExpTree.CapturingGroup
Represents a capturing group such as (asdf)
|
static class |
RegExpTree.Charset
Represents a set of possible characters structured as [a-zA-Z] or [^a-zA-Z]
|
static class |
RegExpTree.Concatenation
Represents a series of nodes chained one after another such as (?:...)[a-z]*(...)
|
static class |
RegExpTree.Empty
Represents an empty portion of a RegExp such as the middle of "||"
|
static class |
RegExpTree.LookaheadAssertion
Represents a lookahead assertion such as (?=...) or (?!...)
|
static class |
RegExpTree.LookbehindAssertion
Represents a lookbehind assertion such as
(?<=...) or (?<!...) |
static class |
RegExpTree.NamedBackReference
Represents a reference to a previous named group
|
static class |
RegExpTree.NamedCaptureGroup
Represents a named capture group
|
static class |
RegExpTree.RegExpTreeAtom
Represents a node that never has children such as an anchor or charset.
|
static class |
RegExpTree.Repetition
Represents a repeating item such as ...+, ...*, or ...{0,1}
|
static class |
RegExpTree.Text
Represents a run of non-special characters such as "foobar"
|
static class |
RegExpTree.UnicodePropertyEscape
Represents a Unicode Property Escape such as in /\p{Script=Greek}/u
|
static class |
RegExpTree.WordBoundary
Represents \b or \B
|
Constructor and Description |
---|
RegExpTree() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
appendDebugInfo(java.lang.StringBuilder sb) |
protected abstract void |
appendSourceCode(java.lang.StringBuilder sb)
Appends this regular expression source to the given buffer.
|
abstract java.util.List<? extends RegExpTree> |
children()
The children of this node.
|
abstract boolean |
containsAnchor()
True if the regular expression contains an anchor :
^ or $ . |
abstract boolean |
equals(java.lang.Object o) |
boolean |
hasCapturingGroup()
True if the regular expression contains capturing groups.
|
abstract int |
hashCode() |
abstract boolean |
isCaseSensitive()
True if the presence or absence of an
"i" flag would change the
meaning of this regular expression. |
static boolean |
matchesWholeInput(RegExpTree t,
java.lang.String flags)
True if, but not necessarily always when the, given regular expression
must match the whole input or none of it.
|
abstract int |
numCapturingGroups()
The number of capturing groups.
|
static RegExpTree |
parseRegExp(java.lang.String pattern,
java.lang.String flags)
Parses a regular expression to an AST.
|
abstract RegExpTree |
simplify(java.lang.String flags)
Returns a simpler regular expression that is semantically the same assuming
the given flags.
|
java.lang.String |
toString() |
public abstract RegExpTree simplify(java.lang.String flags)
flags
- Regular expression flags, e.g. "igm"
.public abstract boolean isCaseSensitive()
"i"
flag would change the
meaning of this regular expression.public abstract boolean containsAnchor()
^
or $
.public final boolean hasCapturingGroup()
public abstract int numCapturingGroups()
public abstract java.util.List<? extends RegExpTree> children()
protected abstract void appendSourceCode(java.lang.StringBuilder sb)
protected abstract void appendDebugInfo(java.lang.StringBuilder sb)
public final java.lang.String toString()
toString
in class java.lang.Object
public abstract boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public abstract int hashCode()
hashCode
in class java.lang.Object
public static RegExpTree parseRegExp(java.lang.String pattern, java.lang.String flags)
pattern
- The foo
From /foo/i
.flags
- The i
From /foo/i
.public static boolean matchesWholeInput(RegExpTree t, java.lang.String flags)
Copyright © 2009-2019 Google. All Rights Reserved.