| java.lang.Object | ||
| ↳ | com.google.gdata.util.parser.Parser<T> | |
| ↳ | com.google.gdata.util.parser.Repeat<T> | |
The Repeat parser returns a successful match if its
subject parser matches at least min times, but not
more than max times. The Repeat parser is used to
implement the Parser.star() and Parser.plus()
methods by specifying appropriate values for min and
max.
The following matches a string of 1 to 3 letters:
Parse p = Chset.ALPHA.repeat(1, 3);
p.parse("") -> no match
p.parse("a") -> matches "a"
p.parse("aa") -> matches "aa"
p.parse("aaa") -> matches "aaa"
p.parse("aaaa") -> matches "aaa"
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gdata.util.parser.Parser
| |||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| max | |||||||||||
| min | |||||||||||
| subject | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Class constructor that is used for creating a
Repeat object
that will match its subject min or more times. | |||||||||||
Class constructor that is used for creating a
Repeat object
that will match its subject at least min times
but not more than max times. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Matches the
subject parser against the prefix of the buffer
(buf[start,end)) being parsed if the subject
parser matches at least min times and not more than
max times in sequence. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gdata.util.parser.Parser
| |||||||||||
From class
java.lang.Object
| |||||||||||
Class constructor that is used for creating a Repeat object
that will match its subject min or more times.
| subject | The Parse that this parser will repeatedly
match. |
|---|---|
| min | The minimum number of times the subject parser
must match.
|
Class constructor that is used for creating a Repeat object
that will match its subject at least min times
but not more than max times. Specifying -1 for
max causes the parser to match as many times as possible.
| subject | The Parse that this parser will repeatedly
match. |
|---|---|
| min | The minimum number of times the subject parser
must match. |
| max | The maximum number of times the subject parser can
match.
|
Matches the subject parser against the prefix of the buffer
(buf[start,end)) being parsed if the subject
parser matches at least min times and not more than
max times in sequence.
| buf | The character array to match against. |
|---|---|
| start | The start offset of data within the character array to match against. |
| end | The end offset of data within the character array to match against. |
| data | User defined object that is passed to
Callback.handle when an Action fires.
|