|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.Ostermiller.Syntax.Lexer.Token com.Ostermiller.Syntax.Lexer.SQLToken
public class SQLToken
A SQLToken is a token that is returned by a lexer that is lexing an SQL
source file. It has several attributes describing the token:
The type of token, the text of the token, the line number on which it
occurred, the number of characters into the input at which it started, and
similarly, the number of characters into the input at which it ended.
Field Summary | |
---|---|
static int |
COMMENT_END_OF_LINE
a -- to end of line comment. |
static int |
COMMENT_TRADITIONAL
C style comment, (except possibly nested) |
static int |
ERROR
An error |
static int |
ERROR_BAD_BIT_STRING
An comment start embedded in an operator |
static int |
ERROR_UNCLOSED_BIT_STRING
An comment start embedded in an operator |
static int |
ERROR_UNCLOSED_COMMENT
An comment start embedded in an operator |
static int |
ERROR_UNCLOSED_STRING
An comment start embedded in an operator |
static int |
IDENTIFIER
A variable, name, or other identifier |
static int |
LITERAL_BIT_STRING
A bit-string |
static int |
LITERAL_FLOAT
A floating point |
static int |
LITERAL_INTEGER
An integer |
static int |
LITERAL_STRING
A string literal |
static int |
OPERATOR
An operator |
static int |
RESERVED_WORD
A reserved word (keyword) |
static int |
SEPARATOR
A separator |
static int |
WHITE_SPACE
White space |
Fields inherited from class com.Ostermiller.Syntax.Lexer.Token |
---|
INITIAL_STATE, UNDEFINED_STATE |
Constructor Summary | |
---|---|
SQLToken(int ID,
String contents,
int lineNumber,
int charBegin,
int charEnd)
Create a new token. |
|
SQLToken(int ID,
String contents,
int lineNumber,
int charBegin,
int charEnd,
int state)
Create a new token. |
Method Summary | |
---|---|
String |
errorString()
get a String that explains the error, if this token is an error. |
int |
getCharBegin()
get the offset into the input in characters at which this token started |
int |
getCharEnd()
get the offset into the input in characters at which this token ended |
String |
getContents()
get the contents of this token |
String |
getDescription()
A description of this token. |
int |
getID()
get the ID number of this token |
int |
getLineNumber()
get the line number of the input on which this token started |
int |
getState()
Get an integer representing the state the tokenizer is in after returning this token. |
boolean |
isComment()
Checks this token to see if it is a comment. |
boolean |
isError()
Checks this token to see if it is an Error. |
boolean |
isIdentifier()
Checks this token to see if it is an identifier. |
boolean |
isLiteral()
Checks this token to see if it is a literal. |
boolean |
isOperator()
Checks this token to see if it is a Operator. |
boolean |
isReservedWord()
Checks this token to see if it is a reserved word. |
boolean |
isSeparator()
Checks this token to see if it is a Separator. |
boolean |
isWhiteSpace()
Checks this token to see if it is White Space. |
String |
toString()
get a representation of this token as a human readable string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int RESERVED_WORD
public static final int IDENTIFIER
public static final int LITERAL_STRING
public static final int LITERAL_BIT_STRING
public static final int LITERAL_INTEGER
public static final int LITERAL_FLOAT
public static final int SEPARATOR
public static final int OPERATOR
public static final int COMMENT_TRADITIONAL
public static final int COMMENT_END_OF_LINE
public static final int WHITE_SPACE
public static final int ERROR
public static final int ERROR_UNCLOSED_COMMENT
public static final int ERROR_UNCLOSED_STRING
public static final int ERROR_UNCLOSED_BIT_STRING
public static final int ERROR_BAD_BIT_STRING
Constructor Detail |
---|
public SQLToken(int ID, String contents, int lineNumber, int charBegin, int charEnd)
ID
- the id number of the tokencontents
- A string representing the text of the tokenlineNumber
- the line number of the input on which this token startedcharBegin
- the offset into the input in characters at which this token startedcharEnd
- the offset into the input in characters at which this token endedpublic SQLToken(int ID, String contents, int lineNumber, int charBegin, int charEnd, int state)
ID
- the id number of the tokencontents
- A string representing the text of the tokenlineNumber
- the line number of the input on which this token startedcharBegin
- the offset into the input in characters at which this token startedcharEnd
- the offset into the input in characters at which this token endedstate
- the state the tokenizer is in after returning this token.Method Detail |
---|
public int getState()
getState
in class Token
public int getID()
getID
in class Token
public String getContents()
getContents
in class Token
public int getLineNumber()
getLineNumber
in class Token
public int getCharBegin()
getCharBegin
in class Token
public int getCharEnd()
getCharEnd
in class Token
public boolean isReservedWord()
public boolean isIdentifier()
public boolean isLiteral()
public boolean isSeparator()
public boolean isOperator()
public boolean isComment()
isComment
in class Token
public boolean isWhiteSpace()
isWhiteSpace
in class Token
public boolean isError()
isError
in class Token
public String getDescription()
getDescription
in class Token
public String errorString()
errorString
in class Token
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |