public abstract class Regular extends Object
Regular represent concrete
regular expressions. They are immutable objects,
and have therefore value semantics.| Modifier and Type | Class and Description |
|---|---|
static class |
Regular.Alternate
Instances of regular expressions that represent a choice
a | b between two regular expressions. |
static class |
Regular.Binding
Instances of regular expressions that represent
expressions whose matchers will be bound to
a specified name
|
static class |
Regular.Characters
Instances of regular expressions that match exactly
one character amongst a set of possible characters.
|
static class |
Regular.Eof
The singleton class that stands for the regular expression
matching the "end of input", or EOF, which only matches
when the input string has been entirely consumed.
|
static class |
Regular.Epsilon
The singleton class that stands for the empty
regular expression ε, which only matches the empty string.
|
static interface |
Regular.Folder<V>
An instance of
Regular.Folder is a set of methods to
apply to the various cases of a regular expression, depending
on its form, as part of a (possibly) recursive traversal of
the regular expression structure. |
static class |
Regular.Gen
Generates random regular expressions based on a
probability configuration
and a random number generator
|
static class |
Regular.Kind
Enumeration which describes the different kinds of
concrete implementations of
Regular. |
static class |
Regular.Repetition
Instances of regular expressions that represent the Kleene
closure
r* of some regular expression r,
i.e. matching zero, one or more repetitions of r |
static class |
Regular.Sequence
Instances of regular expressions that represent the
concatenation
ab of two regular expressions. |
| Modifier and Type | Field and Description |
|---|---|
static Regular.Eof |
EOF
The regular expression matching the end-of-file/end-of-input
|
static Regular.Epsilon |
EPSILON
The empty regular expression ε
|
boolean |
hasBindings
Whether this regular expressions has any
bound submatching group or not
|
Regular.Kind |
kind
Specifies what kind of regular expression
this is |
boolean |
nullable
Whether this regular expression matches the empty string.
|
int |
size
If
size >= 0, all strings matching this
regular expression have the specified size. |
| Modifier and Type | Method and Description |
|---|---|
static Regular.Binding |
binding(Regular reg,
Located<String> name) |
static Regular |
chars(CSet chars) |
abstract <V> V |
fold(Regular.Folder<V> folder) |
static Regular.Gen |
generator() |
Regular.Kind |
getKind()
Only there for the quick-assist based on
Hierarchy. |
static Regular |
or(Regular reg1,
Regular... regs) |
static Regular |
or(Regular lhs,
Regular rhs) |
static Regular |
plus(Regular reg) |
static Regular |
repeat(Regular reg,
int occ) |
static Regular |
repeat(Regular reg,
int min,
int max) |
static Regular |
seq(Regular... regs) |
static Regular |
seq(Regular first,
Regular second) |
static Regular |
star(Regular reg) |
static Regular |
string(String s) |
abstract @NonNull String |
toString() |
public final Regular.Kind kind
this ispublic final int size
size >= 0, all strings matching this
regular expression have the specified size.
If size is negative, then no size is
guaranteed.public final boolean hasBindings
public final boolean nullable
Note that the end-of-file regular expression does not match the empty string, it matches a special character instead.
public static final Regular.Epsilon EPSILON
public static final Regular.Eof EOF
public final Regular.Kind getKind()
Hierarchy.
You should probably use the field kind directly.kindpublic abstract <V> V fold(Regular.Folder<V> folder)
folder - Regular.Folder
to the receiverpublic static Regular chars(CSet chars)
chars - must not contain CSet.EOFcharspublic static Regular string(String s)
s - spublic static Regular or(Regular lhs, Regular rhs)
lhs - rhs - lhs and rhs,
in this orderpublic static Regular or(Regular reg1, Regular... regs)
reg1 - regs - (((reg1 || regs[0]) || regs[1]) ... || regs[n-1]public static Regular seq(Regular first, Regular second)
first - second - first and second,
in this orderpublic static Regular seq(Regular... regs)
regs - regs, in orderpublic static Regular star(Regular reg)
reg - regpublic static Regular plus(Regular reg)
reg - regpublic static Regular repeat(Regular reg, int occ)
reg - occ - occ occurrences of regpublic static Regular repeat(Regular reg, int min, int max)
reg - min - max - reg between min and
max, inclusivepublic static Regular.Binding binding(Regular reg, Located<String> name)
reg - name - namepublic static Regular.Gen generator()