|
GXPARSE hosted by |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectca.gorman.util.scan.Modifier
public abstract class Modifier
Modifiers for constructing a new ScanRule instance from
other ScanRule instances.
This class is immutable with reentrant methods.
The modifiers in this class will create new possessive modifiers if they
are applied to ScanRule instances that possessively match
character sequences. However, some the modifiers will not create
greedy or reluctant ScanRule instances even when applied to
ScanRule instances that greedily or reluctantly match
character sequences.
| Constructor Summary | |
|---|---|
protected |
Modifier()
Prevent instantiation, but allow subclasses. |
| Method Summary | |
|---|---|
ScanRule |
anyOf(ScanRule... scanRule)
Alternation, recognize a character sequence that would be recognized by at least one of the ScanRule instances in a list. |
ScanRule |
atLeast(int count,
ScanRule scanRule)
Repetition, recognize a character sequence matched by count or more repetitions of a ScanRule. |
ScanRule |
capture(String key,
ScanRule scanRule)
Return the character sequence matched by another ScanRule
and simultaneously save the character sequence for later
retrieval. |
ScanRule |
concat(ScanRule... scanRule)
Concatenation, match a series of character sequences that would be matched consecutively by the ScanRule instances in a list. |
ScanRule |
lookahead(ScanRule scanRule)
Recognize a character sequence at the current point in the ScanBuffer without returning it and without removing
it from the ScanBuffer. |
ScanRule |
lookaheadNot(ScanRule scanRule)
Recognize the absence of a matching character sequence at the current point in the ScanBuffer. |
static Modifier |
newInstance()
Return an instance. |
ScanRule |
oneOrMore(ScanRule scanRule)
Optional repetition, recognize a character sequence matched by one or more repetitions of a ScanRule. |
ScanRule |
repeat(int min,
int max,
ScanRule scanRule)
Repetition, recognize a character sequence that matches at least min repetition of a ScanRule, but accept
no more than max repetitions. |
ScanRule |
repeat(int count,
ScanRule scanRule)
Repetition, recognize a character sequence that matches exactly count repetitions of a single ScanRule. |
ScanRule |
zeroOrMore(ScanRule scanRule)
Optional match, recognize a character sequence matched by zero or more repetitions of a ScanRule. |
ScanRule |
zeroOrOne(ScanRule scanRule)
Optional match, recognize a character sequence macthed by zero or one repetitions of a ScanRule. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Modifier()
Prevent instantiation, but allow subclasses.
| Method Detail |
|---|
public static Modifier newInstance()
Return an instance.
public ScanRule anyOf(ScanRule... scanRule)
Alternation, recognize a character sequence that would be recognized by
at least one of the ScanRule instances in a list.
The returned ScanRule instance accepts the character
sequence that matches the first successful ScanRule in the
list, even if a subsequent ScanRule would match a longer
character sequence. There is no backtracking to find the longest match.
scanRule - one or more ScanRule instances
ScanRule that will recognize any character
sequence that would be recognized by one of the
ScanRule instances in the parameter list
NullPointerException - if any parameter is nullpublic ScanRule concat(ScanRule... scanRule)
Concatenation, match a series of character sequences that would be
matched consecutively by the ScanRule instances in a list.
The returned ScanRule instance is equivalent to
testing each of the original ScanRule before proceding to
the next one. It may match fewer characters than would be possible by
using backtracking and treating the entire group of
ScanRule as a single larger test. It may fail to match at
all in some cases where backtracking would have allowed a successful
match.
scanRule - one or more ScanRule instances, in the
order of matching to a character sequence.
ScanRule that will recognize a series of
adjacent character sequences that would be recognized by the
corresponding ScanRule instances in the
parameter list
NullPointerException - if any parameter is null
public ScanRule repeat(int min,
int max,
ScanRule scanRule)
Repetition, recognize a character sequence that matches at least
min repetition of a ScanRule, but accept
no more than max repetitions.
ScanRule that returns a
MatchedText containing all the characters
matched when the original ScanRule matches
at least min times in succession but not accepting
more than max matches, or null when
the original ScanRule fails to match at least
min times.
NullPointerException - if any parameter is null
IndexOutOfBoundsException - if min is negative or
greater than max
public ScanRule repeat(int count,
ScanRule scanRule)
Repetition, recognize a character sequence that matches exactly
count repetitions of a single ScanRule.
ScanRule that returns a
MatchedText containing all the characters
matched when the original ScanRule matches
count times in succession, or null when the
original ScanRule fails to match
count times.
NullPointerException - if any parameter is null
IndexOutOfBoundsException - if count is negative
public ScanRule atLeast(int count,
ScanRule scanRule)
Repetition, recognize a character sequence matched by
count or more repetitions of a ScanRule.
ScanRule that returns a
MatchedText containing all the characters
matched when the original ScanRule matches
count or more times in succession, or null when
the original ScanRule fails to match at least
count times.
NullPointerException - if any object is null
IndexOutOfBoundsException - if count is negative.public ScanRule zeroOrOne(ScanRule scanRule)
Optional match, recognize a character sequence macthed by zero or one
repetitions of a ScanRule.
ScanRule that returns a
MatchedText containing all the characters
matched when the original ScanRule matches once
or a MatchedText of zero length when the original
ScanRule fails to match
NullPointerException - if any parameter is nullpublic ScanRule zeroOrMore(ScanRule scanRule)
Optional match, recognize a character sequence matched by zero or more
repetitions of a ScanRule.
ScanRule that returns a
MatchedText containing all the characters
matched when the original ScanRule matches one or
more times in succession, or a MatchedText of zero
length when the original ScanRule fails to match.
NullPointerException - if any parameter is nullpublic ScanRule oneOrMore(ScanRule scanRule)
Optional repetition, recognize a character sequence matched by one or
more repetitions of a ScanRule.
ScanRule that returns a
MatchedText containing all the characters
matched when the original ScanRule matches one or
more times in succession, or null when the original
ScanRule fails to match.
NullPointerException - if any parameter is nullpublic ScanRule lookahead(ScanRule scanRule)
Recognize a character sequence at the current point in the
ScanBuffer without returning it and without removing
it from the ScanBuffer.
ScanRule that returns a
MatchedText of zero length when the original
ScanRule matches, or null when the original
ScanRule fails to match.
NullPointerException - if any parameter is nullpublic ScanRule lookaheadNot(ScanRule scanRule)
Recognize the absence of a matching character sequence at the current
point in the ScanBuffer.
ScanRule that returns a
MatchedText of zero length when the original
ScanRule fails to match, or null when the original
ScanRule matches.
NullPointerException - if any parameter is null
public ScanRule capture(String key,
ScanRule scanRule)
Return the character sequence matched by another ScanRule
and simultaneously save the character sequence for later
retrieval.
The character sequences are only saved until the Scanner
completes the next
action.
ScanRule that matches the same character
sequences as the original ScanRule, but also
saves the sequences with a key for later retreival.
NullPointerException - if any parameter is null
|
GXPARSE download | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||