com.Ostermiller.Syntax.Lexer
Class CToken

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

public class CToken
extends Token

A CToken is a token that is returned by a lexer that is lexing a C 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_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_PREPROCESSOR_DIRECTIVE
           
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_SUBTRACT
           
static int OPERATOR_SUBTRACT_ASSIGN
           
static int PREPROCESSOR_DIRECTIVE
           
static int RESERVED_WORD_ABSTRACT
           
static int RESERVED_WORD_ASM
           
static int RESERVED_WORD_AUTO
           
static int RESERVED_WORD_BOOL
           
static int RESERVED_WORD_BREAK
           
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_CONST_CAST
           
static int RESERVED_WORD_CONTINUE
           
static int RESERVED_WORD_DEFAULT
           
static int RESERVED_WORD_DELETE
           
static int RESERVED_WORD_DO
           
static int RESERVED_WORD_DOUBLE
           
static int RESERVED_WORD_DYNAMIC_CAST
           
static int RESERVED_WORD_ELSE
           
static int RESERVED_WORD_ENUM
           
static int RESERVED_WORD_EXPLICIT
           
static int RESERVED_WORD_EXTERN
           
static int RESERVED_WORD_FLOAT
           
static int RESERVED_WORD_FOR
           
static int RESERVED_WORD_FRIEND
           
static int RESERVED_WORD_GOTO
           
static int RESERVED_WORD_IF
           
static int RESERVED_WORD_INLINE
           
static int RESERVED_WORD_INT
           
static int RESERVED_WORD_LONG
           
static int RESERVED_WORD_MUTABLE
           
static int RESERVED_WORD_NAMESPACE
           
static int RESERVED_WORD_NEW
           
static int RESERVED_WORD_OPERATOR
           
static int RESERVED_WORD_OVERLOAD
           
static int RESERVED_WORD_PRIVATE
           
static int RESERVED_WORD_PROTECTED
           
static int RESERVED_WORD_PUBLIC
           
static int RESERVED_WORD_REGISTER
           
static int RESERVED_WORD_REINTERPRET_CAST
           
static int RESERVED_WORD_RETURN
           
static int RESERVED_WORD_SHORT
           
static int RESERVED_WORD_SIGNED
           
static int RESERVED_WORD_SIZEOF
           
static int RESERVED_WORD_STATIC
           
static int RESERVED_WORD_STATIC_CAST
           
static int RESERVED_WORD_STRUCT
           
static int RESERVED_WORD_SWITCH
           
static int RESERVED_WORD_TEMPLATE
           
static int RESERVED_WORD_THIS
           
static int RESERVED_WORD_THROW
           
static int RESERVED_WORD_TRY
           
static int RESERVED_WORD_TYPEDEF
           
static int RESERVED_WORD_TYPEID
           
static int RESERVED_WORD_TYPENAME
           
static int RESERVED_WORD_UNION
           
static int RESERVED_WORD_UNSIGNED
           
static int RESERVED_WORD_USING
           
static int RESERVED_WORD_VIRTUAL
           
static int RESERVED_WORD_VOID
           
static int RESERVED_WORD_VOLATILE
           
static int RESERVED_WORD_WCHAR_T
           
static int RESERVED_WORD_WHILE
           
static int SEPARATOR_ARROW
           
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
CToken(int ID, String contents, int lineNumber, int charBegin, int charEnd)
          Create a new token.
CToken(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 isPreProcessor()
          Checks this token to see if it should be handled by the preprocessor.
 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_AUTO

public static final int RESERVED_WORD_AUTO
See Also:
Constant Field Values

RESERVED_WORD_BREAK

public static final int RESERVED_WORD_BREAK
See Also:
Constant Field Values

RESERVED_WORD_CASE

public static final int RESERVED_WORD_CASE
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_ELSE

public static final int RESERVED_WORD_ELSE
See Also:
Constant Field Values

RESERVED_WORD_ENUM

public static final int RESERVED_WORD_ENUM
See Also:
Constant Field Values

RESERVED_WORD_EXTERN

public static final int RESERVED_WORD_EXTERN
See Also:
Constant Field Values

RESERVED_WORD_FOR

public static final int RESERVED_WORD_FOR
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_REGISTER

public static final int RESERVED_WORD_REGISTER
See Also:
Constant Field Values

RESERVED_WORD_RETURN

public static final int RESERVED_WORD_RETURN
See Also:
Constant Field Values

RESERVED_WORD_SIZEOF

public static final int RESERVED_WORD_SIZEOF
See Also:
Constant Field Values

RESERVED_WORD_STATIC

public static final int RESERVED_WORD_STATIC
See Also:
Constant Field Values

RESERVED_WORD_STRUCT

public static final int RESERVED_WORD_STRUCT
See Also:
Constant Field Values

RESERVED_WORD_SWITCH

public static final int RESERVED_WORD_SWITCH
See Also:
Constant Field Values

RESERVED_WORD_TYPEDEF

public static final int RESERVED_WORD_TYPEDEF
See Also:
Constant Field Values

RESERVED_WORD_UNION

public static final int RESERVED_WORD_UNION
See Also:
Constant Field Values

RESERVED_WORD_VOLATILE

public static final int RESERVED_WORD_VOLATILE
See Also:
Constant Field Values

RESERVED_WORD_WHILE

public static final int RESERVED_WORD_WHILE
See Also:
Constant Field Values

RESERVED_WORD_CATCH

public static final int RESERVED_WORD_CATCH
See Also:
Constant Field Values

RESERVED_WORD_CLASS

public static final int RESERVED_WORD_CLASS
See Also:
Constant Field Values

RESERVED_WORD_CONST_CAST

public static final int RESERVED_WORD_CONST_CAST
See Also:
Constant Field Values

RESERVED_WORD_DELETE

public static final int RESERVED_WORD_DELETE
See Also:
Constant Field Values

RESERVED_WORD_DYNAMIC_CAST

public static final int RESERVED_WORD_DYNAMIC_CAST
See Also:
Constant Field Values

RESERVED_WORD_FRIEND

public static final int RESERVED_WORD_FRIEND
See Also:
Constant Field Values

RESERVED_WORD_INLINE

public static final int RESERVED_WORD_INLINE
See Also:
Constant Field Values

RESERVED_WORD_MUTABLE

public static final int RESERVED_WORD_MUTABLE
See Also:
Constant Field Values

RESERVED_WORD_NAMESPACE

public static final int RESERVED_WORD_NAMESPACE
See Also:
Constant Field Values

RESERVED_WORD_NEW

public static final int RESERVED_WORD_NEW
See Also:
Constant Field Values

RESERVED_WORD_OPERATOR

public static final int RESERVED_WORD_OPERATOR
See Also:
Constant Field Values

RESERVED_WORD_OVERLOAD

public static final int RESERVED_WORD_OVERLOAD
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_REINTERPRET_CAST

public static final int RESERVED_WORD_REINTERPRET_CAST
See Also:
Constant Field Values

RESERVED_WORD_STATIC_CAST

public static final int RESERVED_WORD_STATIC_CAST
See Also:
Constant Field Values

RESERVED_WORD_TEMPLATE

public static final int RESERVED_WORD_TEMPLATE
See Also:
Constant Field Values

RESERVED_WORD_THIS

public static final int RESERVED_WORD_THIS
See Also:
Constant Field Values

RESERVED_WORD_TRY

public static final int RESERVED_WORD_TRY
See Also:
Constant Field Values

RESERVED_WORD_VIRTUAL

public static final int RESERVED_WORD_VIRTUAL
See Also:
Constant Field Values

RESERVED_WORD_BOOL

public static final int RESERVED_WORD_BOOL
See Also:
Constant Field Values

RESERVED_WORD_CHAR

public static final int RESERVED_WORD_CHAR
See Also:
Constant Field Values

RESERVED_WORD_DOUBLE

public static final int RESERVED_WORD_DOUBLE
See Also:
Constant Field Values

RESERVED_WORD_FLOAT

public static final int RESERVED_WORD_FLOAT
See Also:
Constant Field Values

RESERVED_WORD_INT

public static final int RESERVED_WORD_INT
See Also:
Constant Field Values

RESERVED_WORD_LONG

public static final int RESERVED_WORD_LONG
See Also:
Constant Field Values

RESERVED_WORD_SHORT

public static final int RESERVED_WORD_SHORT
See Also:
Constant Field Values

RESERVED_WORD_SIGNED

public static final int RESERVED_WORD_SIGNED
See Also:
Constant Field Values

RESERVED_WORD_UNSIGNED

public static final int RESERVED_WORD_UNSIGNED
See Also:
Constant Field Values

RESERVED_WORD_VOID

public static final int RESERVED_WORD_VOID
See Also:
Constant Field Values

RESERVED_WORD_ASM

public static final int RESERVED_WORD_ASM
See Also:
Constant Field Values

RESERVED_WORD_TYPENAME

public static final int RESERVED_WORD_TYPENAME
See Also:
Constant Field Values

RESERVED_WORD_EXPLICIT

public static final int RESERVED_WORD_EXPLICIT
See Also:
Constant Field Values

RESERVED_WORD_USING

public static final int RESERVED_WORD_USING
See Also:
Constant Field Values

RESERVED_WORD_THROW

public static final int RESERVED_WORD_THROW
See Also:
Constant Field Values

RESERVED_WORD_WCHAR_T

public static final int RESERVED_WORD_WCHAR_T
See Also:
Constant Field Values

RESERVED_WORD_TYPEID

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

SEPARATOR_ARROW

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

PREPROCESSOR_DIRECTIVE

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

ERROR_MALFORMED_PREPROCESSOR_DIRECTIVE

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

CToken

public CToken(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

CToken

public CToken(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.

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.

Returns:
true if this token is an identifier, 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

isPreProcessor

public boolean isPreProcessor()
Checks this token to see if it should be handled by the preprocessor.

Returns:
true if this token should be handled by the preprocessor, 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