com.Ostermiller.Syntax.Lexer
Class JavaScriptToken

java.lang.Object
  extended by com.Ostermiller.Syntax.Lexer.Token
      extended by com.Ostermiller.Syntax.Lexer.JavaScriptToken

public class JavaScriptToken
extends Token

A JavaScriptToken is a token that is returned by a lexer that is lexing a javascript 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.
The tokens should comply with the Java Script Reference.


Field Summary
static int COMMENT_DOCUMENTATION
           
static int COMMENT_END_OF_LINE
           
static int COMMENT_TRADITIONAL
           
static int ERROR_DOUBLE_SIZE
           
static int ERROR_FLOAT
           
static int ERROR_FLOAT_SIZE
           
static int ERROR_IDENTIFIER
           
static int ERROR_INTEGER_DECIMIAL_SIZE
           
static int ERROR_INTEGER_HEXIDECIMAL_SIZE
           
static int ERROR_INTEGER_OCTAL_SIZE
           
static int ERROR_LONG_DECIMIAL_SIZE
           
static int ERROR_LONG_HEXIDECIMAL_SIZE
           
static int ERROR_LONG_OCTAL_SIZE
           
static int ERROR_MALFORMED_CHARACTER
           
static int ERROR_MALFORMED_STRING
           
static int ERROR_MALFORMED_UNCLOSED_CHARACTER
           
static int ERROR_MALFORMED_UNCLOSED_STRING
           
static int ERROR_UNCLOSED_CHARACTER
           
static int ERROR_UNCLOSED_COMMENT
           
static int ERROR_UNCLOSED_STRING
           
static int IDENTIFIER
           
static int LITERAL_BOOLEAN
           
static int LITERAL_CHARACTER
           
static int LITERAL_DOUBLE
           
static int LITERAL_FLOATING_POINT
           
static int LITERAL_INTEGER_DECIMAL
           
static int LITERAL_INTEGER_HEXIDECIMAL
           
static int LITERAL_INTEGER_OCTAL
           
static int LITERAL_LONG_DECIMAL
           
static int LITERAL_LONG_HEXIDECIMAL
           
static int LITERAL_LONG_OCTAL
           
static int LITERAL_NULL
           
static int LITERAL_STRING
           
static int OPERATOR_ADD
           
static int OPERATOR_ADD_ASSIGN
           
static int OPERATOR_ASSIGN
           
static int OPERATOR_BITWISE_AND
           
static int OPERATOR_BITWISE_AND_ASSIGN
           
static int OPERATOR_BITWISE_COMPLIMENT
           
static int OPERATOR_BITWISE_OR
           
static int OPERATOR_BITWISE_OR_ASSIGN
           
static int OPERATOR_BITWISE_XOR
           
static int OPERATOR_BITWISE_XOR_ASSIGN
           
static int OPERATOR_COLON
           
static int OPERATOR_DECREMENT
           
static int OPERATOR_DIVIDE
           
static int OPERATOR_DIVIDE_ASSIGN
           
static int OPERATOR_EQUAL
           
static int OPERATOR_GREATER_THAN
           
static int OPERATOR_GREATER_THAN_OR_EQUAL
           
static int OPERATOR_INCREMENT
           
static int OPERATOR_LESS_THAN
           
static int OPERATOR_LESS_THAN_OR_EQUAL
           
static int OPERATOR_LOGICAL_AND
           
static int OPERATOR_LOGICAL_NOT
           
static int OPERATOR_LOGICAL_OR
           
static int OPERATOR_MOD
           
static int OPERATOR_MOD_ASSIGN
           
static int OPERATOR_MULTIPLY
           
static int OPERATOR_MULTIPLY_ASSIGN
           
static int OPERATOR_NOT_EQUAL
           
static int OPERATOR_QUESTION
           
static int OPERATOR_SHIFT_LEFT
           
static int OPERATOR_SHIFT_LEFT_ASSIGN
           
static int OPERATOR_SHIFT_RIGHT
           
static int OPERATOR_SHIFT_RIGHT_ASSIGN
           
static int OPERATOR_SHIFT_RIGHT_UNSIGNED
           
static int OPERATOR_SHIFT_RIGHT_UNSIGNED_ASSIGN
           
static int OPERATOR_SUBTRACT
           
static int OPERATOR_SUBTRACT_ASSIGN
           
static int RESERVED_WORD_ABSTRACT
           
static int RESERVED_WORD_BOOLEAN
           
static int RESERVED_WORD_BREAK
           
static int RESERVED_WORD_BYTE
           
static int RESERVED_WORD_CASE
           
static int RESERVED_WORD_CATCH
           
static int RESERVED_WORD_CHAR
           
static int RESERVED_WORD_CLASS
           
static int RESERVED_WORD_CONST
           
static int RESERVED_WORD_CONTINUE
           
static int RESERVED_WORD_DEFAULT
           
static int RESERVED_WORD_DO
           
static int RESERVED_WORD_DOUBLE
           
static int RESERVED_WORD_ELSE
           
static int RESERVED_WORD_EXTENDS
           
static int RESERVED_WORD_FALSE
           
static int RESERVED_WORD_FINAL
           
static int RESERVED_WORD_FINALLY
           
static int RESERVED_WORD_FLOAT
           
static int RESERVED_WORD_FOR
           
static int RESERVED_WORD_FUNCTION
           
static int RESERVED_WORD_GOTO
           
static int RESERVED_WORD_IF
           
static int RESERVED_WORD_IMPLEMENTS
           
static int RESERVED_WORD_IMPORT
           
static int RESERVED_WORD_IN
           
static int RESERVED_WORD_INSTANCEOF
           
static int RESERVED_WORD_INT
           
static int RESERVED_WORD_INTERFACE
           
static int RESERVED_WORD_LONG
           
static int RESERVED_WORD_NATIVE
           
static int RESERVED_WORD_NEW
           
static int RESERVED_WORD_NULL
           
static int RESERVED_WORD_PACKAGE
           
static int RESERVED_WORD_PRIVATE
           
static int RESERVED_WORD_PROTECTED
           
static int RESERVED_WORD_PUBLIC
           
static int RESERVED_WORD_RETURN
           
static int RESERVED_WORD_SHORT
           
static int RESERVED_WORD_STATIC
           
static int RESERVED_WORD_SUPER
           
static int RESERVED_WORD_SWITCH
           
static int RESERVED_WORD_SYNCHRONIZED
           
static int RESERVED_WORD_THIS
           
static int RESERVED_WORD_THROW
           
static int RESERVED_WORD_THROWS
           
static int RESERVED_WORD_TRANSIENT
           
static int RESERVED_WORD_TRUE
           
static int RESERVED_WORD_TRY
           
static int RESERVED_WORD_VAR
           
static int RESERVED_WORD_VOID
           
static int RESERVED_WORD_WHILE
           
static int RESERVED_WORD_WITH
           
static int SEPARATOR_COMMA
           
static int SEPARATOR_LBRACE
           
static int SEPARATOR_LBRACKET
           
static int SEPARATOR_LPAREN
           
static int SEPARATOR_PERIOD
           
static int SEPARATOR_RBRACE
           
static int SEPARATOR_RBRACKET
           
static int SEPARATOR_RPAREN
           
static int SEPARATOR_SEMICOLON
           
static int WHITE_SPACE
           
 
Fields inherited from class com.Ostermiller.Syntax.Lexer.Token
INITIAL_STATE, UNDEFINED_STATE
 
Constructor Summary
JavaScriptToken(int ID, String contents, int lineNumber, int charBegin, int charEnd)
          Create a new token.
JavaScriptToken(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

RESERVED_WORD_ABSTRACT

public static final int RESERVED_WORD_ABSTRACT
See Also:
Constant Field Values

RESERVED_WORD_BOOLEAN

public static final int RESERVED_WORD_BOOLEAN
See Also:
Constant Field Values

RESERVED_WORD_BREAK

public static final int RESERVED_WORD_BREAK
See Also:
Constant Field Values

RESERVED_WORD_BYTE

public static final int RESERVED_WORD_BYTE
See Also:
Constant Field Values

RESERVED_WORD_CASE

public static final int RESERVED_WORD_CASE
See Also:
Constant Field Values

RESERVED_WORD_CATCH

public static final int RESERVED_WORD_CATCH
See Also:
Constant Field Values

RESERVED_WORD_CHAR

public static final int RESERVED_WORD_CHAR
See Also:
Constant Field Values

RESERVED_WORD_CLASS

public static final int RESERVED_WORD_CLASS
See Also:
Constant Field Values

RESERVED_WORD_CONST

public static final int RESERVED_WORD_CONST
See Also:
Constant Field Values

RESERVED_WORD_CONTINUE

public static final int RESERVED_WORD_CONTINUE
See Also:
Constant Field Values

RESERVED_WORD_DEFAULT

public static final int RESERVED_WORD_DEFAULT
See Also:
Constant Field Values

RESERVED_WORD_DO

public static final int RESERVED_WORD_DO
See Also:
Constant Field Values

RESERVED_WORD_DOUBLE

public static final int RESERVED_WORD_DOUBLE
See Also:
Constant Field Values

RESERVED_WORD_ELSE

public static final int RESERVED_WORD_ELSE
See Also:
Constant Field Values

RESERVED_WORD_EXTENDS

public static final int RESERVED_WORD_EXTENDS
See Also:
Constant Field Values

RESERVED_WORD_FALSE

public static final int RESERVED_WORD_FALSE
See Also:
Constant Field Values

RESERVED_WORD_FINAL

public static final int RESERVED_WORD_FINAL
See Also:
Constant Field Values

RESERVED_WORD_FINALLY

public static final int RESERVED_WORD_FINALLY
See Also:
Constant Field Values

RESERVED_WORD_FLOAT

public static final int RESERVED_WORD_FLOAT
See Also:
Constant Field Values

RESERVED_WORD_FOR

public static final int RESERVED_WORD_FOR
See Also:
Constant Field Values

RESERVED_WORD_FUNCTION

public static final int RESERVED_WORD_FUNCTION
See Also:
Constant Field Values

RESERVED_WORD_GOTO

public static final int RESERVED_WORD_GOTO
See Also:
Constant Field Values

RESERVED_WORD_IF

public static final int RESERVED_WORD_IF
See Also:
Constant Field Values

RESERVED_WORD_IMPLEMENTS

public static final int RESERVED_WORD_IMPLEMENTS
See Also:
Constant Field Values

RESERVED_WORD_IMPORT

public static final int RESERVED_WORD_IMPORT
See Also:
Constant Field Values

RESERVED_WORD_IN

public static final int RESERVED_WORD_IN
See Also:
Constant Field Values

RESERVED_WORD_INSTANCEOF

public static final int RESERVED_WORD_INSTANCEOF
See Also:
Constant Field Values

RESERVED_WORD_INT

public static final int RESERVED_WORD_INT
See Also:
Constant Field Values

RESERVED_WORD_INTERFACE

public static final int RESERVED_WORD_INTERFACE
See Also:
Constant Field Values

RESERVED_WORD_LONG

public static final int RESERVED_WORD_LONG
See Also:
Constant Field Values

RESERVED_WORD_NATIVE

public static final int RESERVED_WORD_NATIVE
See Also:
Constant Field Values

RESERVED_WORD_NEW

public static final int RESERVED_WORD_NEW
See Also:
Constant Field Values

RESERVED_WORD_NULL

public static final int RESERVED_WORD_NULL
See Also:
Constant Field Values

RESERVED_WORD_PACKAGE

public static final int RESERVED_WORD_PACKAGE
See Also:
Constant Field Values

RESERVED_WORD_PRIVATE

public static final int RESERVED_WORD_PRIVATE
See Also:
Constant Field Values

RESERVED_WORD_PROTECTED

public static final int RESERVED_WORD_PROTECTED
See Also:
Constant Field Values

RESERVED_WORD_PUBLIC

public static final int RESERVED_WORD_PUBLIC
See Also:
Constant Field Values

RESERVED_WORD_RETURN

public static final int RESERVED_WORD_RETURN
See Also:
Constant Field Values

RESERVED_WORD_SHORT

public static final int RESERVED_WORD_SHORT
See Also:
Constant Field Values

RESERVED_WORD_STATIC

public static final int RESERVED_WORD_STATIC
See Also:
Constant Field Values

RESERVED_WORD_SUPER

public static final int RESERVED_WORD_SUPER
See Also:
Constant Field Values

RESERVED_WORD_SWITCH

public static final int RESERVED_WORD_SWITCH
See Also:
Constant Field Values

RESERVED_WORD_SYNCHRONIZED

public static final int RESERVED_WORD_SYNCHRONIZED
See Also:
Constant Field Values

RESERVED_WORD_THIS

public static final int RESERVED_WORD_THIS
See Also:
Constant Field Values

RESERVED_WORD_THROW

public static final int RESERVED_WORD_THROW
See Also:
Constant Field Values

RESERVED_WORD_THROWS

public static final int RESERVED_WORD_THROWS
See Also:
Constant Field Values

RESERVED_WORD_TRANSIENT

public static final int RESERVED_WORD_TRANSIENT
See Also:
Constant Field Values

RESERVED_WORD_TRUE

public static final int RESERVED_WORD_TRUE
See Also:
Constant Field Values

RESERVED_WORD_TRY

public static final int RESERVED_WORD_TRY
See Also:
Constant Field Values

RESERVED_WORD_VAR

public static final int RESERVED_WORD_VAR
See Also:
Constant Field Values

RESERVED_WORD_VOID

public static final int RESERVED_WORD_VOID
See Also:
Constant Field Values

RESERVED_WORD_WHILE

public static final int RESERVED_WORD_WHILE
See Also:
Constant Field Values

RESERVED_WORD_WITH

public static final int RESERVED_WORD_WITH
See Also:
Constant Field Values

IDENTIFIER

public static final int IDENTIFIER
See Also:
Constant Field Values

LITERAL_BOOLEAN

public static final int LITERAL_BOOLEAN
See Also:
Constant Field Values

LITERAL_INTEGER_DECIMAL

public static final int LITERAL_INTEGER_DECIMAL
See Also:
Constant Field Values

LITERAL_INTEGER_OCTAL

public static final int LITERAL_INTEGER_OCTAL
See Also:
Constant Field Values

LITERAL_INTEGER_HEXIDECIMAL

public static final int LITERAL_INTEGER_HEXIDECIMAL
See Also:
Constant Field Values

LITERAL_LONG_DECIMAL

public static final int LITERAL_LONG_DECIMAL
See Also:
Constant Field Values

LITERAL_LONG_OCTAL

public static final int LITERAL_LONG_OCTAL
See Also:
Constant Field Values

LITERAL_LONG_HEXIDECIMAL

public static final int LITERAL_LONG_HEXIDECIMAL
See Also:
Constant Field Values

LITERAL_FLOATING_POINT

public static final int LITERAL_FLOATING_POINT
See Also:
Constant Field Values

LITERAL_DOUBLE

public static final int LITERAL_DOUBLE
See Also:
Constant Field Values

LITERAL_CHARACTER

public static final int LITERAL_CHARACTER
See Also:
Constant Field Values

LITERAL_STRING

public static final int LITERAL_STRING
See Also:
Constant Field Values

LITERAL_NULL

public static final int LITERAL_NULL
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_LBRACE

public static final int SEPARATOR_LBRACE
See Also:
Constant Field Values

SEPARATOR_RBRACE

public static final int SEPARATOR_RBRACE
See Also:
Constant Field Values

SEPARATOR_LBRACKET

public static final int SEPARATOR_LBRACKET
See Also:
Constant Field Values

SEPARATOR_RBRACKET

public static final int SEPARATOR_RBRACKET
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_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_LESS_THAN_OR_EQUAL

public static final int OPERATOR_LESS_THAN_OR_EQUAL
See Also:
Constant Field Values

OPERATOR_GREATER_THAN_OR_EQUAL

public static final int OPERATOR_GREATER_THAN_OR_EQUAL
See Also:
Constant Field Values

OPERATOR_EQUAL

public static final int OPERATOR_EQUAL
See Also:
Constant Field Values

OPERATOR_NOT_EQUAL

public static final int OPERATOR_NOT_EQUAL
See Also:
Constant Field Values

OPERATOR_LOGICAL_NOT

public static final int OPERATOR_LOGICAL_NOT
See Also:
Constant Field Values

OPERATOR_LOGICAL_AND

public static final int OPERATOR_LOGICAL_AND
See Also:
Constant Field Values

OPERATOR_LOGICAL_OR

public static final int OPERATOR_LOGICAL_OR
See Also:
Constant Field Values

OPERATOR_ADD

public static final int OPERATOR_ADD
See Also:
Constant Field Values

OPERATOR_SUBTRACT

public static final int OPERATOR_SUBTRACT
See Also:
Constant Field Values

OPERATOR_MULTIPLY

public static final int OPERATOR_MULTIPLY
See Also:
Constant Field Values

OPERATOR_DIVIDE

public static final int OPERATOR_DIVIDE
See Also:
Constant Field Values

OPERATOR_MOD

public static final int OPERATOR_MOD
See Also:
Constant Field Values

OPERATOR_BITWISE_COMPLIMENT

public static final int OPERATOR_BITWISE_COMPLIMENT
See Also:
Constant Field Values

OPERATOR_BITWISE_AND

public static final int OPERATOR_BITWISE_AND
See Also:
Constant Field Values

OPERATOR_BITWISE_OR

public static final int OPERATOR_BITWISE_OR
See Also:
Constant Field Values

OPERATOR_BITWISE_XOR

public static final int OPERATOR_BITWISE_XOR
See Also:
Constant Field Values

OPERATOR_SHIFT_LEFT

public static final int OPERATOR_SHIFT_LEFT
See Also:
Constant Field Values

OPERATOR_SHIFT_RIGHT

public static final int OPERATOR_SHIFT_RIGHT
See Also:
Constant Field Values

OPERATOR_SHIFT_RIGHT_UNSIGNED

public static final int OPERATOR_SHIFT_RIGHT_UNSIGNED
See Also:
Constant Field Values

OPERATOR_ASSIGN

public static final int OPERATOR_ASSIGN
See Also:
Constant Field Values

OPERATOR_ADD_ASSIGN

public static final int OPERATOR_ADD_ASSIGN
See Also:
Constant Field Values

OPERATOR_SUBTRACT_ASSIGN

public static final int OPERATOR_SUBTRACT_ASSIGN
See Also:
Constant Field Values

OPERATOR_MULTIPLY_ASSIGN

public static final int OPERATOR_MULTIPLY_ASSIGN
See Also:
Constant Field Values

OPERATOR_DIVIDE_ASSIGN

public static final int OPERATOR_DIVIDE_ASSIGN
See Also:
Constant Field Values

OPERATOR_MOD_ASSIGN

public static final int OPERATOR_MOD_ASSIGN
See Also:
Constant Field Values

OPERATOR_BITWISE_AND_ASSIGN

public static final int OPERATOR_BITWISE_AND_ASSIGN
See Also:
Constant Field Values

OPERATOR_BITWISE_OR_ASSIGN

public static final int OPERATOR_BITWISE_OR_ASSIGN
See Also:
Constant Field Values

OPERATOR_BITWISE_XOR_ASSIGN

public static final int OPERATOR_BITWISE_XOR_ASSIGN
See Also:
Constant Field Values

OPERATOR_SHIFT_LEFT_ASSIGN

public static final int OPERATOR_SHIFT_LEFT_ASSIGN
See Also:
Constant Field Values

OPERATOR_SHIFT_RIGHT_ASSIGN

public static final int OPERATOR_SHIFT_RIGHT_ASSIGN
See Also:
Constant Field Values

OPERATOR_SHIFT_RIGHT_UNSIGNED_ASSIGN

public static final int OPERATOR_SHIFT_RIGHT_UNSIGNED_ASSIGN
See Also:
Constant Field Values

OPERATOR_INCREMENT

public static final int OPERATOR_INCREMENT
See Also:
Constant Field Values

OPERATOR_DECREMENT

public static final int OPERATOR_DECREMENT
See Also:
Constant Field Values

OPERATOR_QUESTION

public static final int OPERATOR_QUESTION
See Also:
Constant Field Values

OPERATOR_COLON

public static final int OPERATOR_COLON
See Also:
Constant Field Values

COMMENT_TRADITIONAL

public static final int COMMENT_TRADITIONAL
See Also:
Constant Field Values

COMMENT_END_OF_LINE

public static final int COMMENT_END_OF_LINE
See Also:
Constant Field Values

COMMENT_DOCUMENTATION

public static final int COMMENT_DOCUMENTATION
See Also:
Constant Field Values

WHITE_SPACE

public static final int WHITE_SPACE
See Also:
Constant Field Values

ERROR_IDENTIFIER

public static final int ERROR_IDENTIFIER
See Also:
Constant Field Values

ERROR_UNCLOSED_STRING

public static final int ERROR_UNCLOSED_STRING
See Also:
Constant Field Values

ERROR_MALFORMED_STRING

public static final int ERROR_MALFORMED_STRING
See Also:
Constant Field Values

ERROR_MALFORMED_UNCLOSED_STRING

public static final int ERROR_MALFORMED_UNCLOSED_STRING
See Also:
Constant Field Values

ERROR_UNCLOSED_CHARACTER

public static final int ERROR_UNCLOSED_CHARACTER
See Also:
Constant Field Values

ERROR_MALFORMED_CHARACTER

public static final int ERROR_MALFORMED_CHARACTER
See Also:
Constant Field Values

ERROR_MALFORMED_UNCLOSED_CHARACTER

public static final int ERROR_MALFORMED_UNCLOSED_CHARACTER
See Also:
Constant Field Values

ERROR_INTEGER_DECIMIAL_SIZE

public static final int ERROR_INTEGER_DECIMIAL_SIZE
See Also:
Constant Field Values

ERROR_INTEGER_OCTAL_SIZE

public static final int ERROR_INTEGER_OCTAL_SIZE
See Also:
Constant Field Values

ERROR_INTEGER_HEXIDECIMAL_SIZE

public static final int ERROR_INTEGER_HEXIDECIMAL_SIZE
See Also:
Constant Field Values

ERROR_LONG_DECIMIAL_SIZE

public static final int ERROR_LONG_DECIMIAL_SIZE
See Also:
Constant Field Values

ERROR_LONG_OCTAL_SIZE

public static final int ERROR_LONG_OCTAL_SIZE
See Also:
Constant Field Values

ERROR_LONG_HEXIDECIMAL_SIZE

public static final int ERROR_LONG_HEXIDECIMAL_SIZE
See Also:
Constant Field Values

ERROR_FLOAT_SIZE

public static final int ERROR_FLOAT_SIZE
See Also:
Constant Field Values

ERROR_DOUBLE_SIZE

public static final int ERROR_DOUBLE_SIZE
See Also:
Constant Field Values

ERROR_FLOAT

public static final int ERROR_FLOAT
See Also:
Constant Field Values

ERROR_UNCLOSED_COMMENT

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

JavaScriptToken

public JavaScriptToken(int ID,
                       String contents,
                       int lineNumber,
                       int charBegin,
                       int charEnd)
Create a new token. The constructor is typically called by the lexer

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

JavaScriptToken

public JavaScriptToken(int ID,
                       String contents,
                       int lineNumber,
                       int charBegin,
                       int charEnd,
                       int state)
Create a new token. The constructor is typically called by the lexer

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

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 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. Reserved words are explained in Java Language Specification.

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

isIdentifier

public boolean isIdentifier()
Checks this token to see if it is an identifier. Identifiers are explained in Java Language Specification.

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

isLiteral

public boolean isLiteral()
Checks this token to see if it is a literal. Literals are explained in Java Language Specification.

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

isSeparator

public boolean isSeparator()
Checks this token to see if it is a Separator. Separators are explained in Java Language Specification.

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

isOperator

public boolean isOperator()
Checks this token to see if it is a Operator. Operators are explained in Java Language Specification.

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 String getDescription()
A description of this token. The description should be appropriate for syntax highlighting. For example "comment" is returned for a comment.

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

errorString

public 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 String toString()
get a representation of this token as a human readable string. The format of this string is subject to change and should only be used for debugging purposes.

Overrides:
toString in class Object
Returns:
a string representation of this token