|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Tokenizer
This defines the MillScript tokenizer interface.
| Method Summary | |
|---|---|
boolean |
checkWhere(char ch)
Check if the tokenzier is using the specified strategy for reading names and strings. |
void |
dropToken()
Drops the current token, ready to read the next one. |
java.lang.String |
getAttributeName()
Returns the current token, checking it is a valid XML element attribute name. |
java.lang.String |
getErrorString()
Returns the current token for use as an error message. |
int |
getInt()
Returns the current token as an int. |
int |
getLineNumber()
Returns the line number of the current token. |
java.lang.String |
getName()
Returns the current token as a name, or interned string. |
java.lang.String |
getOrigin()
Returns the origin of this tokenizers character source. |
char |
getQuoteChar()
Returns the first character of the current token, which will be the quote character for a string token. |
java.lang.String |
getString()
Returns the current token as a string. |
java.lang.String |
getStringNoQuotes()
Returns the current token as a string, without the surrounding quotes. |
java.lang.String |
getStringNoQuotes(int a,
int b)
Returns the current token as a string, with the specified number of characters removed from the start and end. |
java.lang.String |
getTagName()
Returns the current token, checking it is a valid XML element name. |
java.util.regex.Pattern |
makePattern()
Returns a new tradition regular expression Pattern, made
from the contents of the current buffer. |
void |
markReader()
Marks the current position in the reader, so we can jump back to the marked position if required. |
void |
mustRead(java.lang.String sym)
Tests if the next token is the same as the specified string. |
TokenType |
nextToken()
Returns the type of the next token. |
boolean |
peekRead(java.lang.String sym)
Peeks a look at the next token and compares it to the specified value. |
TokenType |
peekToken()
Peeks a look at the type of the next token to be returned by nextToken. |
void |
resetReader()
Resets the reader to the previously marked position. |
void |
setWhere(char ch)
Sets the tokenizers current strategy for reading names and strings. |
boolean |
tryRead(java.lang.String sym)
Tests if the next token is the same as the specified string. |
| Methods inherited from interface org.millscript.commons.alert.AlertOrigin |
|---|
setContext, setLineNumber, setOrigin |
| Method Detail |
|---|
boolean checkWhere(char ch)
ch - the test strategy
true if the test and current strategy are the same,
otherwise falsevoid dropToken()
java.lang.String getAttributeName()
java.lang.String getErrorString()
int getInt()
int getLineNumber()
getLineNumber in interface org.millscript.commons.alert.AlertOriginjava.lang.String getName()
java.lang.String getOrigin()
getOrigin in interface org.millscript.commons.alert.AlertOriginchar getQuoteChar()
java.lang.String getString()
java.lang.String getStringNoQuotes()
java.lang.String getStringNoQuotes(int a,
int b)
a - the number of character to remove from the start of the current
tokenb - the number of character to remove from the end of the current
token
java.lang.String getTagName()
java.util.regex.Pattern makePattern()
Pattern, made
from the contents of the current buffer. It looks for the last
/ in the string to see if there are any flags specified.
Pattern for the current buffervoid markReader()
void mustRead(java.lang.String sym)
sym - the token we want to try and readTokenType nextToken()
TokenType of the next tokenboolean peekRead(java.lang.String sym)
sym - the token we want to try and read
true if the next token is the same as the one
specified, false otherwiseTokenType peekToken()
nextToken.
TokenType of the next token to be returned by a
call to nextToken()void resetReader()
void setWhere(char ch)
ch - the new strategy#whereboolean tryRead(java.lang.String sym)
sym - the token we want to try and read
true if the next token is the same as the one
specified, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||