|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Parser
Defines essential functionality that every parser we implement will support. This is then extended for HTML and Javascript parsing.
The typical caller is a Template System and will usually ask us to parse either a character at a time or a fragment of a template at a time, stopping only when it needs to determine the state of the parser for escaping purposes.
We will later add methods to save and restore the full state of the parser to better support conditional processing.
Field Summary | |
---|---|
static ExternalState |
STATE_ERROR
|
Method Summary | |
---|---|
int |
getColumnNumber()
Returns the current column number. |
int |
getLineNumber()
Returns the current line number. |
ExternalState |
getState()
Returns the current state of the parser. |
void |
parse(char input)
Tell the parser to process the provided char . |
void |
parse(String input)
Tell the parser to process the provided String . |
void |
reset()
Reset the parser back to its initial default state. |
void |
setColumnNumber(int columnNumber)
Sets the current column number which is returned during error messages. |
void |
setLineNumber(int lineNumber)
Sets the current line number which is returned during error messages. |
Field Detail |
---|
static final ExternalState STATE_ERROR
Method Detail |
---|
void parse(char input) throws ParseException
char
. Throws exception
on an unrecoverable parsing error.
input
- the character read
ParseException
- if an unrecoverable error occurred during parsingvoid parse(String input) throws ParseException
String
. Throws exception
on an unrecoverable parsing error.
input
- the String
to parse
ParseException
- if an unrecoverable error occurred during parsingvoid reset()
ExternalState getState()
STATE_ERROR
if the parser encountered an error. Such an error may be recoverable
and the caller may want to continue parsing until parse(String)
returns false
.
void setLineNumber(int lineNumber)
lineNumber
- the line number to set in the parserint getLineNumber()
void setColumnNumber(int columnNumber)
columnNumber
- the column number to set in the parserint getColumnNumber()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |