| Modifier and Type | Field and Description |
|---|---|
| private int | position
The current position. |
| private static final int | SHOW_AFTER
How much context to show after the current position. |
| private static final int | SHOW_BEFORE
How much context to show before the current position. |
| private Object | state
Extra parsing state. |
| private final String | string
The string being parsed. |
| private final StringBuilder | token
The token buffer. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | advance(final int
The number of character positions to advance. numChars)Advance numChars character positions. |
| public void | |
| public void | |
| public String | Returns: The current token. Resets the current token to empty.Get the current token, and reset the token to empty. |
| public void | |
| public char | |
| public int | |
| public String | Returns: A string showing parsing context, for debugging.Get the parsing context as a string, for debugging. |
| public Object | Returns: The current value of the state object.Get the "state object" from the parser (can be used to parse state between parser functions). |
| public CharSequence | Returns: The subsequence.The start position. startPosition, final int The end position. endPosition)Return a subsequence of the input string. |
| public String | Returns: The substring.The start position. startPosition, final int The end position. endPosition)Return a substring of the input string. |
| public boolean | Returns: true if the input has not all been consumed.Check to see if there are more characters to parse. |
| public void | |
| public char | Returns: The next character, or '\0' if at the end of the string.Peek at the next character without reading it. |
| public void | peekExpect(final char
The expected next character. expectedChar)Get the next character, throwing a |
| public boolean | Returns: True if the strMatch matches a substring of the remaining string starting at the current position.The string to compare, starting at the current position, as a "peek" operation. strMatch)Peek operator that can look ahead several characters. |
| public void | setPosition(final int
The position to move to. position)Set the position of the parser within the string. |
| public Object | |
| public void | |
| public String |
| position | back to summary |
|---|---|
| private int position The current position. | |
| SHOW_AFTER | back to summary |
|---|---|
| private static final int SHOW_AFTER How much context to show after the current position. | |
| SHOW_BEFORE | back to summary |
|---|---|
| private static final int SHOW_BEFORE How much context to show before the current position. | |
| state | back to summary |
|---|---|
| private Object state Extra parsing state. | |
| string | back to summary |
|---|---|
| private final String string The string being parsed. | |
| token | back to summary |
|---|---|
| private final StringBuilder token The token buffer. | |
| Parser | back to summary |
|---|---|
| public Parser(final String string) throws ParseException Construct a parser.
| |
| advance | back to summary |
|---|---|
| public void advance(final int numChars) Advance numChars character positions.
| |
| appendToToken | back to summary |
|---|---|
| public void appendToToken(final String str) Append the given string to the token buffer.
| |
| appendToToken | back to summary |
|---|---|
| public void appendToToken(final char c) Append the given character to the token buffer.
| |
| currToken | back to summary |
|---|---|
| public String currToken() Get the current token, and reset the token to empty.
| |
| expect | back to summary |
|---|---|
| public void expect(final char expectedChar) throws ParseException Expect the next character.
| |
| getc | back to summary |
|---|---|
| public char getc() throws ParseException Get the next character.
| |
| getPosition | back to summary |
|---|---|
| public int getPosition() Get the current position.
| |
| getPositionInfo | back to summary |
|---|---|
| public String getPositionInfo() Get the parsing context as a string, for debugging.
| |
| getState | back to summary |
|---|---|
| public Object getState() Get the "state object" from the parser (can be used to parse state between parser functions).
| |
| getSubsequence | back to summary |
|---|---|
| public CharSequence getSubsequence(final int startPosition, final int endPosition) Return a subsequence of the input string.
| |
| getSubstring | back to summary |
|---|---|
| public String getSubstring(final int startPosition, final int endPosition) Return a substring of the input string.
| |
| hasMore | back to summary |
|---|---|
| public boolean hasMore() Check to see if there are more characters to parse.
| |
| next | back to summary |
|---|---|
| public void next() Advance one character without returning the value of the character. | |
| peek | back to summary |
|---|---|
| public char peek() Peek at the next character without reading it.
| |
| peekExpect | back to summary |
|---|---|
| public void peekExpect(final char expectedChar) throws ParseException Get the next character, throwing a
| |
| peekMatches | back to summary |
|---|---|
| public boolean peekMatches(final String strMatch) Peek operator that can look ahead several characters.
| |
| setPosition | back to summary |
|---|---|
| public void setPosition(final int position) Set the position of the parser within the string.
| |
| setState | back to summary |
|---|---|
| public Object setState(final Object state) Set the "state object" from the parser (can be used to parse state between parser functions). | |
| skipWhitespace | back to summary |
|---|---|
| public void skipWhitespace() Skip whitespace starting at the current position. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |