| java.lang.Object workbench.sql.formatter.Token
All known Subclasses: workbench.sql.formatter.SQLToken,
Token | abstract public class Token (Code) | | A generic token class.
|
Field Summary | |
final public static int | INITIAL_STATE The initial state of the tokenizer. | final public static int | UNDEFINED_STATE The state of the tokenizer is undefined. |
Method Summary | |
abstract public String | errorString() get a String that explains the error, if this token is an error. | abstract public int | getCharBegin() | abstract public int | getCharEnd() | abstract public String | getContents() The actual meat of the token. | abstract public String | getDescription() A description of this token. | abstract public int | getID() A unique ID for this type of token. | abstract public int | getLineNumber() | abstract public int | getState() Get an integer representing the state the tokenizer is in after
returning this token.
Those who are interested in incremental tokenizing for performance
reasons will want to use this method to figure out where the tokenizer
may be restarted. | abstract public boolean | isComment() Determine if this token is a comment. | abstract public boolean | isError() Determine if this token is an error. | abstract public boolean | isWhiteSpace() Determine if this token is whitespace. |
INITIAL_STATE | final public static int INITIAL_STATE(Code) | | The initial state of the tokenizer.
Anytime the tokenizer returns to this state,
the tokenizer could be restarted from that point
with side effects.
|
UNDEFINED_STATE | final public static int UNDEFINED_STATE(Code) | | The state of the tokenizer is undefined.
|
errorString | abstract public String errorString()(Code) | | get a String that explains the error, if this token is an error.
a String that explains the error, if this token is an error, null otherwise. |
getCharBegin | abstract public int getCharBegin()(Code) | | get the offset into the input in characters at which this token started
the offset into the input in characters at which this token started |
getCharEnd | abstract public int getCharEnd()(Code) | | get the offset into the input in characters at which this token ended
the offset into the input in characters at which this token ended |
getContents | abstract public String getContents()(Code) | | The actual meat of the token.
a string representing the text of the token. |
getDescription | abstract public String getDescription()(Code) | | A description of this token. The description should
be appropriate for syntax highlighting. For example
"comment" might be returned for a comment. This should
make it easy to do html syntax highlighting. Just use
style sheets to define classes with the same name as
the description and write the token in the html file
with that css class name.
a description of this token. |
getID | abstract public int getID()(Code) | | A unique ID for this type of token.
Typically, ID numbers for each type will
be static variables of the Token class.
an ID for this type of token. |
getLineNumber | abstract public int getLineNumber()(Code) | | get the line number of the input on which this token started
the line number of the input on which this token started |
getState | abstract public int getState()(Code) | | Get an integer representing the state the tokenizer is in after
returning this token.
Those who are interested in incremental tokenizing for performance
reasons will want to use this method to figure out where the tokenizer
may be restarted. The tokenizer starts in Token.INITIAL_STATE, so
any time that it reports that it has returned to this state, the
tokenizer may be restarted from there.
|
isComment | abstract public boolean isComment()(Code) | | Determine if this token is a comment. Sometimes comments should be
ignored (compiling code) other times they should be used
(syntax highlighting). This provides a method to check
in case you feel you should ignore comments.
true if this token represents a comment. |
isError | abstract public boolean isError()(Code) | | Determine if this token is an error. Lets face it, not all code
conforms to spec. The lexer might know about an error
if a string literal is not closed, for example.
true if this token is an error. |
isWhiteSpace | abstract public boolean isWhiteSpace()(Code) | | Determine if this token is whitespace. Sometimes whitespace should be
ignored (compiling code) other times they should be used
(code beautification). This provides a method to check
in case you feel you should ignore whitespace.
true if this token represents whitespace. |
|
|