public interface NfaParserView
is the interface to be used by an ReParser
to fill an
Nfa
. The class Nfa
implements this interface
to provide a parser-specific, slightly restricted view to the
Nfa
that allows for efficient and controlled built-up
of the finite automaton graph.
The interface provides a stack-automaton for evaluation of
expressions creating the Nfa
step by step. Once
parsing has finished, the stack must contain exactly one
element.
Modifier and Type | Method and Description |
---|---|
void |
allPrefixes()
performs the equivalent of
Nfa.allPrefixes() on the top
element of the expression stack. |
void |
dup()
creates a copy of the top stack element and pushes it
|
void |
invert()
performs the equivalent of
Nfa.invert() on the top
element of the expression stack. |
boolean |
markAsSub()
performs the equivalent of
Nfa.markAsSub() on the top
element of the expression stack. |
void |
not() |
void |
optional()
performs the equivalent of
Nfa.optional() on the top
element of the expression stack. |
void |
or()
performs the equivalent of
Nfa.or(Nfa) on the two top
elements on the expression stack. |
void |
plus()
performs the equivalent of
Nfa.plus() on the top
element of the expression stack. |
void |
pushCharSet(java.lang.CharSequence pairs,
boolean invert)
pushes an automaton representation on the expression stack that
recognizes a string of length 1 made up of one character from a
character set.
|
void |
pushDot()
is a convenience method that calls
pushCharSet(java.lang.CharSequence, boolean) such
that all characters are specified. |
void |
pushString(java.lang.CharSequence str)
pushes an automaton representation on the expression stack that
recognizes exactly the given character sequence.
|
void |
seq()
performs the equivalent of
Nfa.seq(Nfa) on the two top
elements on the expression stack. |
void |
shortest()
performs the equivalent of
Nfa.shortest() on the top
element of the expression stack. |
void |
star()
performs the equivalent of
Nfa.star() on the top
element of the expression stack. |
void |
swap()
swaps the two top level elements on the expression stack.
|
void pushCharSet(java.lang.CharSequence pairs, boolean invert)
pushes an automaton representation on the expression stack that
recognizes a string of length 1 made up of one character from a
character set. The character set is specified in
pairs
as an even number of characters. Every pair of
characters (from,to) denotes an inclusive range of
allowed characters. The ranges may overlap, and if from
is greater than to, their order is silently
reversed. The set specified is the union of all character ranges
specified by the pairs. If invert
is
true
, the complement of the resulting character set
is used.
If the specified character set is empty, the resulting automaton will not recognize anything.
pairs
- may be null
or an empty sequence or
must have an even number of charactersinvert
- requests to invert the character set before usevoid pushDot()
is a convenience method that calls pushCharSet(java.lang.CharSequence, boolean)
such
that all characters are specified.
void pushString(java.lang.CharSequence str)
pushes an automaton representation on the expression stack that recognizes exactly the given character sequence.
NOTE: the given CharSequence
is not parsed
as a regular expression.
str
- may not be null
or emptyvoid or()
performs the equivalent of Nfa.or(Nfa)
on the two top
elements on the expression stack.
void seq()
performs the equivalent of Nfa.seq(Nfa)
on the two top
elements on the expression stack.
void star()
performs the equivalent of Nfa.star()
on the top
element of the expression stack.
void plus()
performs the equivalent of Nfa.plus()
on the top
element of the expression stack.
void optional()
performs the equivalent of Nfa.optional()
on the top
element of the expression stack.
void dup()
void allPrefixes() throws CompileDfaException
performs the equivalent of Nfa.allPrefixes()
on the top
element of the expression stack.
CompileDfaException
void not() throws CompileDfaException
CompileDfaException
void invert() throws CompileDfaException
performs the equivalent of Nfa.invert()
on the top
element of the expression stack.
CompileDfaException
void shortest() throws CompileDfaException
performs the equivalent of Nfa.shortest()
on the top
element of the expression stack.
CompileDfaException
void swap()
swaps the two top level elements on the expression stack.
boolean markAsSub()
performs the equivalent of Nfa.markAsSub()
on the top
element of the expression stack.