org.devaki.nextobjects.ui.editor.syntax
Class SqlToken

java.lang.Object
  extended byorg.devaki.nextobjects.ui.editor.syntax.Token
      extended byorg.devaki.nextobjects.ui.editor.syntax.SqlToken

public class SqlToken
extends Token

Description: A JavaToken is a token that is returned by a lexer that is lexing a java 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 inut at which it ended.


Field Summary
static int COMMENT_1
           
static int COMMENT_2
           
static int COMMENT_3
           
static int IDENTIFIER
           
static int LITERAL_CHARACTER
           
static int LITERAL_INTEGER_DECIMAL
           
static int LITERAL_STRING_1
           
static int LITERAL_STRING_2
           
static int OPERATOR_ADD
           
static int OPERATOR_ASSIGN
           
static int OPERATOR_DIFFERENT
           
static int OPERATOR_EQUAL
           
static int OPERATOR_GREATER_THAN
           
static int OPERATOR_LESS_THAN
           
static int OPERATOR_SUBSTRACT
           
static int RESERVED_WORD_ADD
          Variables
static int RESERVED_WORD_ALTER
           
static int RESERVED_WORD_AND
           
static int RESERVED_WORD_BEGIN
           
static int RESERVED_WORD_CASCADE
           
static int RESERVED_WORD_CHAR
           
static int RESERVED_WORD_CLOSE
           
static int RESERVED_WORD_CONSTRAINT
           
static int RESERVED_WORD_CONSTRAINTS
           
static int RESERVED_WORD_CREATE
           
static int RESERVED_WORD_CURSOR
           
static int RESERVED_WORD_DATE
           
static int RESERVED_WORD_DATETIME
           
static int RESERVED_WORD_DEALLOCATE
           
static int RESERVED_WORD_DECIMAL
           
static int RESERVED_WORD_DECLARE
           
static int RESERVED_WORD_DEFAULT
           
static int RESERVED_WORD_DROP
           
static int RESERVED_WORD_END
           
static int RESERVED_WORD_EXEC
           
static int RESERVED_WORD_EXISTS
           
static int RESERVED_WORD_FETCH
           
static int RESERVED_WORD_FOR
           
static int RESERVED_WORD_FOREIGN
           
static int RESERVED_WORD_FROM
           
static int RESERVED_WORD_IF
           
static int RESERVED_WORD_INDEX
           
static int RESERVED_WORD_INTO
           
static int RESERVED_WORD_KEY
           
static int RESERVED_WORD_NEXT
           
static int RESERVED_WORD_NOT
           
static int RESERVED_WORD_NULL
           
static int RESERVED_WORD_NUMBER
           
static int RESERVED_WORD_NUMERIC
           
static int RESERVED_WORD_NVARCHAR
           
static int RESERVED_WORD_OPEN
           
static int RESERVED_WORD_PRIMARY
           
static int RESERVED_WORD_REFERENCES
           
static int RESERVED_WORD_SELECT
           
static int RESERVED_WORD_TABLE
           
static int RESERVED_WORD_USING
           
static int RESERVED_WORD_VARCHAR
           
static int RESERVED_WORD_VARCHAR2
           
static int RESERVED_WORD_WHERE
           
static int RESERVED_WORD_WHILE
           
static int SEPARATOR_COMMA
           
static int SEPARATOR_LPAREN
           
static int SEPARATOR_PERIOD
           
static int SEPARATOR_RPAREN
           
static int SEPARATOR_SEMICOLON
           
static int WHITE_SPACE
           
 
Fields inherited from class org.devaki.nextobjects.ui.editor.syntax.Token
INITIAL_STATE, UNDEFINED_STATE
 
Constructor Summary
SqlToken(int ID, java.lang.String contents, int lineNumber, int charBegin, int charEnd)
          Create a new token.
SqlToken(int ID, java.lang.String contents, int lineNumber, int charBegin, int charEnd, int state)
          Create a new token.
 
Method Summary
 java.lang.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
 java.lang.String getContents()
          get the contents of this token
 java.lang.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 identidefer.
 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.
 java.lang.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

RESERVED_WORD_ADD

public static final int RESERVED_WORD_ADD
Variables

See Also:
Constant Field Values

RESERVED_WORD_ALTER

public static final int RESERVED_WORD_ALTER
See Also:
Constant Field Values

RESERVED_WORD_AND

public static final int RESERVED_WORD_AND
See Also:
Constant Field Values

RESERVED_WORD_BEGIN

public static final int RESERVED_WORD_BEGIN
See Also:
Constant Field Values

RESERVED_WORD_CASCADE

public static final int RESERVED_WORD_CASCADE
See Also:
Constant Field Values

RESERVED_WORD_CHAR

public static final int RESERVED_WORD_CHAR
See Also:
Constant Field Values

RESERVED_WORD_CLOSE

public static final int RESERVED_WORD_CLOSE
See Also:
Constant Field Values

RESERVED_WORD_CONSTRAINT

public static final int RESERVED_WORD_CONSTRAINT
See Also:
Constant Field Values

RESERVED_WORD_CONSTRAINTS

public static final int RESERVED_WORD_CONSTRAINTS
See Also:
Constant Field Values

RESERVED_WORD_CREATE

public static final int RESERVED_WORD_CREATE
See Also:
Constant Field Values

RESERVED_WORD_CURSOR

public static final int RESERVED_WORD_CURSOR
See Also:
Constant Field Values

RESERVED_WORD_DATE

public static final int RESERVED_WORD_DATE
See Also:
Constant Field Values

RESERVED_WORD_DATETIME

public static final int RESERVED_WORD_DATETIME
See Also:
Constant Field Values

RESERVED_WORD_DEALLOCATE

public static final int RESERVED_WORD_DEALLOCATE
See Also:
Constant Field Values

RESERVED_WORD_DECIMAL

public static final int RESERVED_WORD_DECIMAL
See Also:
Constant Field Values

RESERVED_WORD_DECLARE

public static final int RESERVED_WORD_DECLARE
See Also:
Constant Field Values

RESERVED_WORD_DEFAULT

public static final int RESERVED_WORD_DEFAULT
See Also:
Constant Field Values

RESERVED_WORD_DROP

public static final int RESERVED_WORD_DROP
See Also:
Constant Field Values

RESERVED_WORD_END

public static final int RESERVED_WORD_END
See Also:
Constant Field Values

RESERVED_WORD_EXEC

public static final int RESERVED_WORD_EXEC
See Also:
Constant Field Values

RESERVED_WORD_EXISTS

public static final int RESERVED_WORD_EXISTS
See Also:
Constant Field Values

RESERVED_WORD_FETCH

public static final int RESERVED_WORD_FETCH
See Also:
Constant Field Values

RESERVED_WORD_FOR

public static final int RESERVED_WORD_FOR
See Also:
Constant Field Values

RESERVED_WORD_FOREIGN

public static final int RESERVED_WORD_FOREIGN
See Also:
Constant Field Values

RESERVED_WORD_FROM

public static final int RESERVED_WORD_FROM
See Also:
Constant Field Values

RESERVED_WORD_IF

public static final int RESERVED_WORD_IF
See Also:
Constant Field Values

RESERVED_WORD_INDEX

public static final int RESERVED_WORD_INDEX
See Also:
Constant Field Values

RESERVED_WORD_INTO

public static final int RESERVED_WORD_INTO
See Also:
Constant Field Values

RESERVED_WORD_KEY

public static final int RESERVED_WORD_KEY
See Also:
Constant Field Values

RESERVED_WORD_NEXT

public static final int RESERVED_WORD_NEXT
See Also:
Constant Field Values

RESERVED_WORD_NOT

public static final int RESERVED_WORD_NOT
See Also:
Constant Field Values

RESERVED_WORD_NULL

public static final int RESERVED_WORD_NULL
See Also:
Constant Field Values

RESERVED_WORD_NUMBER

public static final int RESERVED_WORD_NUMBER
See Also:
Constant Field Values

RESERVED_WORD_NUMERIC

public static final int RESERVED_WORD_NUMERIC
See Also:
Constant Field Values

RESERVED_WORD_NVARCHAR

public static final int RESERVED_WORD_NVARCHAR
See Also:
Constant Field Values

RESERVED_WORD_OPEN

public static final int RESERVED_WORD_OPEN
See Also:
Constant Field Values

RESERVED_WORD_PRIMARY

public static final int RESERVED_WORD_PRIMARY
See Also:
Constant Field Values

RESERVED_WORD_REFERENCES

public static final int RESERVED_WORD_REFERENCES
See Also:
Constant Field Values

RESERVED_WORD_SELECT

public static final int RESERVED_WORD_SELECT
See Also:
Constant Field Values

RESERVED_WORD_TABLE

public static final int RESERVED_WORD_TABLE
See Also:
Constant Field Values

RESERVED_WORD_USING

public static final int RESERVED_WORD_USING
See Also:
Constant Field Values

RESERVED_WORD_VARCHAR

public static final int RESERVED_WORD_VARCHAR
See Also:
Constant Field Values

RESERVED_WORD_VARCHAR2

public static final int RESERVED_WORD_VARCHAR2
See Also:
Constant Field Values

RESERVED_WORD_WHERE

public static final int RESERVED_WORD_WHERE
See Also:
Constant Field Values

RESERVED_WORD_WHILE

public static final int RESERVED_WORD_WHILE
See Also:
Constant Field Values

IDENTIFIER

public static final int IDENTIFIER
See Also:
Constant Field Values

LITERAL_INTEGER_DECIMAL

public static final int LITERAL_INTEGER_DECIMAL
See Also:
Constant Field Values

LITERAL_CHARACTER

public static final int LITERAL_CHARACTER
See Also:
Constant Field Values

LITERAL_STRING_1

public static final int LITERAL_STRING_1
See Also:
Constant Field Values

LITERAL_STRING_2

public static final int LITERAL_STRING_2
See Also:
Constant Field Values

SEPARATOR_LPAREN

public static final int SEPARATOR_LPAREN
See Also:
Constant Field Values

SEPARATOR_RPAREN

public static final int SEPARATOR_RPAREN
See Also:
Constant Field Values

SEPARATOR_SEMICOLON

public static final int SEPARATOR_SEMICOLON
See Also:
Constant Field Values

SEPARATOR_COMMA

public static final int SEPARATOR_COMMA
See Also:
Constant Field Values

SEPARATOR_PERIOD

public static final int SEPARATOR_PERIOD
See Also:
Constant Field Values

OPERATOR_EQUAL

public static final int OPERATOR_EQUAL
See Also:
Constant Field Values

OPERATOR_GREATER_THAN

public static final int OPERATOR_GREATER_THAN
See Also:
Constant Field Values

OPERATOR_LESS_THAN

public static final int OPERATOR_LESS_THAN
See Also:
Constant Field Values

OPERATOR_DIFFERENT

public static final int OPERATOR_DIFFERENT
See Also:
Constant Field Values

OPERATOR_ADD

public static final int OPERATOR_ADD
See Also:
Constant Field Values

OPERATOR_SUBSTRACT

public static final int OPERATOR_SUBSTRACT
See Also:
Constant Field Values

OPERATOR_ASSIGN

public static final int OPERATOR_ASSIGN
See Also:
Constant Field Values

COMMENT_1

public static final int COMMENT_1
See Also:
Constant Field Values

COMMENT_2

public static final int COMMENT_2
See Also:
Constant Field Values

COMMENT_3

public static final int COMMENT_3
See Also:
Constant Field Values

WHITE_SPACE

public static final int WHITE_SPACE
See Also:
Constant Field Values
Constructor Detail

SqlToken

public SqlToken(int ID,
                java.lang.String contents,
                int lineNumber,
                int charBegin,
                int charEnd)
Create a new token.

Parameters:
ID - the id number of the token
contents - A string representing the text of the token
lineNumber - the line number of the input on which this token started
charBegin - the offset into the input in characters at which this token started
charEnd - the offset into the input in characters at which this token ended

SqlToken

public SqlToken(int ID,
                java.lang.String contents,
                int lineNumber,
                int charBegin,
                int charEnd,
                int state)
Create a new token.

Parameters:
ID - the id number of the token
contents - A string representing the text of the token
lineNumber - the line number of the input on which this token started
charBegin - the offset into the input in characters at which this token started
charEnd - the offset into the input in characters at which this token ended
state - the state the tokenizer is in after returning this token.
Method Detail

getState

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. 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.

Specified by:
getState in class Token
Returns:
state

getID

public int getID()
get the ID number of this token

Specified by:
getID in class Token
Returns:
the id number of the token

getContents

public java.lang.String getContents()
get the contents of this token

Specified by:
getContents in class Token
Returns:
A string representing the text of the token

getLineNumber

public int getLineNumber()
get the line number of the input on which this token started

Specified by:
getLineNumber in class Token
Returns:
the line number of the input on which this token started

getCharBegin

public int getCharBegin()
get the offset into the input in characters at which this token started

Specified by:
getCharBegin in class Token
Returns:
the offset into the input in characters at which this token started

getCharEnd

public int getCharEnd()
get the offset into the input in characters at which this token ended

Specified by:
getCharEnd in class Token
Returns:
the offset into the input in characters at which this token ended

isReservedWord

public boolean isReservedWord()
Checks this token to see if it is a reserved word.

Returns:
true if this token is a reserved word, false otherwise

isIdentifier

public boolean isIdentifier()
Checks this token to see if it is an identidefer.

Returns:
true if this token is an identidefer, false otherwise

isLiteral

public boolean isLiteral()
Checks this token to see if it is a literal.

Returns:
true if this token is a literal, false otherwise

isSeparator

public boolean isSeparator()
Checks this token to see if it is a Separator.

Returns:
true if this token is a Separator, false otherwise

isOperator

public boolean isOperator()
Checks this token to see if it is a Operator.

Returns:
true if this token is a Operator, false otherwise

isComment

public boolean isComment()
Checks this token to see if it is a comment.

Specified by:
isComment in class Token
Returns:
true if this token is a comment, false otherwise

isWhiteSpace

public boolean isWhiteSpace()
Checks this token to see if it is White Space. Usually tabs, line breaks, form feed, spaces, etc.

Specified by:
isWhiteSpace in class Token
Returns:
true if this token is White Space, false otherwise

isError

public boolean isError()
Checks this token to see if it is an Error. Unfinished comments, numbers that are too big, unclosed strings, etc.

Specified by:
isError in class Token
Returns:
true if this token is an Error, false otherwise

getDescription

public java.lang.String getDescription()
A description of this token.

Specified by:
getDescription in class Token
Returns:
a description of this token.

errorString

public java.lang.String errorString()
get a String that explains the error, if this token is an error.

Specified by:
errorString in class Token
Returns:
a String that explains the error, if this token is an error, null otherwise.

toString

public java.lang.String toString()
get a representation of this token as a human readable string.

Returns:
a string representation of this token


Copyright © 2002-2004 devaki.org. All Rights Reserved.