|
|||||||||
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.CToken
public class CToken
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.
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 |
---|
public static final int RESERVED_WORD_ABSTRACT
public static final int RESERVED_WORD_AUTO
public static final int RESERVED_WORD_BREAK
public static final int RESERVED_WORD_CASE
public static final int RESERVED_WORD_CONST
public static final int RESERVED_WORD_CONTINUE
public static final int RESERVED_WORD_DEFAULT
public static final int RESERVED_WORD_DO
public static final int RESERVED_WORD_ELSE
public static final int RESERVED_WORD_ENUM
public static final int RESERVED_WORD_EXTERN
public static final int RESERVED_WORD_FOR
public static final int RESERVED_WORD_GOTO
public static final int RESERVED_WORD_IF
public static final int RESERVED_WORD_REGISTER
public static final int RESERVED_WORD_RETURN
public static final int RESERVED_WORD_SIZEOF
public static final int RESERVED_WORD_STATIC
public static final int RESERVED_WORD_STRUCT
public static final int RESERVED_WORD_SWITCH
public static final int RESERVED_WORD_TYPEDEF
public static final int RESERVED_WORD_UNION
public static final int RESERVED_WORD_VOLATILE
public static final int RESERVED_WORD_WHILE
public static final int RESERVED_WORD_CATCH
public static final int RESERVED_WORD_CLASS
public static final int RESERVED_WORD_CONST_CAST
public static final int RESERVED_WORD_DELETE
public static final int RESERVED_WORD_DYNAMIC_CAST
public static final int RESERVED_WORD_FRIEND
public static final int RESERVED_WORD_INLINE
public static final int RESERVED_WORD_MUTABLE
public static final int RESERVED_WORD_NAMESPACE
public static final int RESERVED_WORD_NEW
public static final int RESERVED_WORD_OPERATOR
public static final int RESERVED_WORD_OVERLOAD
public static final int RESERVED_WORD_PRIVATE
public static final int RESERVED_WORD_PROTECTED
public static final int RESERVED_WORD_PUBLIC
public static final int RESERVED_WORD_REINTERPRET_CAST
public static final int RESERVED_WORD_STATIC_CAST
public static final int RESERVED_WORD_TEMPLATE
public static final int RESERVED_WORD_THIS
public static final int RESERVED_WORD_TRY
public static final int RESERVED_WORD_VIRTUAL
public static final int RESERVED_WORD_BOOL
public static final int RESERVED_WORD_CHAR
public static final int RESERVED_WORD_DOUBLE
public static final int RESERVED_WORD_FLOAT
public static final int RESERVED_WORD_INT
public static final int RESERVED_WORD_LONG
public static final int RESERVED_WORD_SHORT
public static final int RESERVED_WORD_SIGNED
public static final int RESERVED_WORD_UNSIGNED
public static final int RESERVED_WORD_VOID
public static final int RESERVED_WORD_ASM
public static final int RESERVED_WORD_TYPENAME
public static final int RESERVED_WORD_EXPLICIT
public static final int RESERVED_WORD_USING
public static final int RESERVED_WORD_THROW
public static final int RESERVED_WORD_WCHAR_T
public static final int RESERVED_WORD_TYPEID
public static final int IDENTIFIER
public static final int LITERAL_BOOLEAN
public static final int LITERAL_INTEGER_DECIMAL
public static final int LITERAL_INTEGER_OCTAL
public static final int LITERAL_INTEGER_HEXIDECIMAL
public static final int LITERAL_LONG_DECIMAL
public static final int LITERAL_LONG_OCTAL
public static final int LITERAL_LONG_HEXIDECIMAL
public static final int LITERAL_FLOATING_POINT
public static final int LITERAL_DOUBLE
public static final int LITERAL_CHARACTER
public static final int LITERAL_STRING
public static final int LITERAL_NULL
public static final int SEPARATOR_LPAREN
public static final int SEPARATOR_RPAREN
public static final int SEPARATOR_LBRACE
public static final int SEPARATOR_RBRACE
public static final int SEPARATOR_LBRACKET
public static final int SEPARATOR_RBRACKET
public static final int SEPARATOR_SEMICOLON
public static final int SEPARATOR_COMMA
public static final int SEPARATOR_PERIOD
public static final int SEPARATOR_ARROW
public static final int OPERATOR_GREATER_THAN
public static final int OPERATOR_LESS_THAN
public static final int OPERATOR_LESS_THAN_OR_EQUAL
public static final int OPERATOR_GREATER_THAN_OR_EQUAL
public static final int OPERATOR_EQUAL
public static final int OPERATOR_NOT_EQUAL
public static final int OPERATOR_LOGICAL_NOT
public static final int OPERATOR_LOGICAL_AND
public static final int OPERATOR_LOGICAL_OR
public static final int OPERATOR_ADD
public static final int OPERATOR_SUBTRACT
public static final int OPERATOR_MULTIPLY
public static final int OPERATOR_DIVIDE
public static final int OPERATOR_MOD
public static final int OPERATOR_BITWISE_COMPLIMENT
public static final int OPERATOR_BITWISE_AND
public static final int OPERATOR_BITWISE_OR
public static final int OPERATOR_BITWISE_XOR
public static final int OPERATOR_SHIFT_LEFT
public static final int OPERATOR_SHIFT_RIGHT
public static final int OPERATOR_ASSIGN
public static final int OPERATOR_ADD_ASSIGN
public static final int OPERATOR_SUBTRACT_ASSIGN
public static final int OPERATOR_MULTIPLY_ASSIGN
public static final int OPERATOR_DIVIDE_ASSIGN
public static final int OPERATOR_MOD_ASSIGN
public static final int OPERATOR_BITWISE_AND_ASSIGN
public static final int OPERATOR_BITWISE_OR_ASSIGN
public static final int OPERATOR_BITWISE_XOR_ASSIGN
public static final int OPERATOR_SHIFT_LEFT_ASSIGN
public static final int OPERATOR_SHIFT_RIGHT_ASSIGN
public static final int OPERATOR_INCREMENT
public static final int OPERATOR_DECREMENT
public static final int OPERATOR_QUESTION
public static final int OPERATOR_COLON
public static final int PREPROCESSOR_DIRECTIVE
public static final int COMMENT_TRADITIONAL
public static final int COMMENT_END_OF_LINE
public static final int COMMENT_DOCUMENTATION
public static final int WHITE_SPACE
public static final int ERROR_IDENTIFIER
public static final int ERROR_UNCLOSED_STRING
public static final int ERROR_MALFORMED_STRING
public static final int ERROR_MALFORMED_UNCLOSED_STRING
public static final int ERROR_UNCLOSED_CHARACTER
public static final int ERROR_MALFORMED_CHARACTER
public static final int ERROR_MALFORMED_UNCLOSED_CHARACTER
public static final int ERROR_INTEGER_DECIMIAL_SIZE
public static final int ERROR_INTEGER_OCTAL_SIZE
public static final int ERROR_INTEGER_HEXIDECIMAL_SIZE
public static final int ERROR_LONG_DECIMIAL_SIZE
public static final int ERROR_LONG_OCTAL_SIZE
public static final int ERROR_LONG_HEXIDECIMAL_SIZE
public static final int ERROR_FLOAT_SIZE
public static final int ERROR_DOUBLE_SIZE
public static final int ERROR_FLOAT
public static final int ERROR_UNCLOSED_COMMENT
public static final int ERROR_MALFORMED_PREPROCESSOR_DIRECTIVE
Constructor Detail |
---|
public CToken(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 CToken(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 isPreProcessor()
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 |