Package com.sun.tools.corba.ee.idl
Class Token
- java.lang.Object
-
- com.sun.tools.corba.ee.idl.Token
-
class Token extends java.lang.Object
Class Token represents a lexeme appearing within an IDL source. Every Token has a type. Depending on its type and on the supported version of IDL, a Token will have other associated attributes, such as a name (identifier, e.g.), and whether it is escaped, deprecated, or is a type that is known to be in a future version of IDL.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
Abstract
(package private) static int
Ampersand
(package private) static int
Any
(package private) static int
Apostrophe
(package private) static int
Attribute
(package private) static int
Backslash
(package private) static int
Bar
(package private) static int
Boolean
(package private) static int
BooleanLiteral
(package private) static int
Carat
(package private) static int
Case
(package private) static int
Char
(package private) static int
CharacterLiteral
(package private) boolean
collidesWithKeyword
True iff this token is an identifier that is known to be a keyword in another version of CORBA or matches a keyword in letter, but not case.(package private) static int
Colon
(package private) static int
Comma
(package private) Comment
comment
Source comment associated with this token.(package private) static int
Component
(package private) static int
Const
(package private) static int
Consumes
(package private) static int
Context
private static int
CORBA_LEVEL_22
private static int
CORBA_LEVEL_23
private static int
CORBA_LEVEL_24RTF
private static int
CORBA_LEVEL_30
(package private) static int
Custom
(package private) static int
Default
(package private) static int
Define
(package private) static int
Defined
(package private) static java.lang.String[]
Directives
(package private) static int
Double
(package private) static int
DoubleAmpersand
(package private) static int
DoubleBar
(package private) static int
DoubleColon
(package private) static int
DoubleEqual
(package private) static int
Elif
(package private) static int
Else
(package private) static int
Emits
(package private) static int
Endif
(package private) static int
Enum
(package private) static int
EOF
(package private) static int
Equal
(package private) static int
Error
(package private) static int
Exception
(package private) static int
Exclamation
(package private) static int
Factory
(package private) static int
FALSE
(package private) static int
Finder
private static int
First22Keyword
private static int
First23Keyword
private static int
First24rtfKeyword
private static int
First30Keyword
(package private) static int
FirstDirective
private static int
FirstKeyword
(package private) static int
FirstLiteral
(package private) static int
FirstSpecial
(package private) static int
FirstSymbol
(package private) static int
Fixed
(package private) static int
Float
(package private) static int
FloatingPointLiteral
(package private) static int
GetRaises
(package private) static int
GreaterEqual
(package private) static int
GreaterThan
(package private) static int
Hash
(package private) static int
Home
(package private) static int
Identifier
(package private) static int
If
(package private) static int
Ifdef
(package private) static int
Ifndef
(package private) static int
Import
(package private) static int
In
(package private) static int
Include
(package private) static int
Init
(package private) static int
Inout
(package private) static int
IntegerLiteral
(package private) static int
Interface
(package private) boolean
isDeprecated
True iff this token is deprecated.(package private) boolean
isEscaped
True iff this token is an escaped identifier.(package private) boolean
isWide
(package private) static java.lang.String[]
Keywords
private static int
Last22Keyword
private static int
Last23Keyword
private static int
Last24rtfKeyword
private static int
Last30Keyword
(package private) static int
LastDirective
private static int
LastKeyword
(package private) static int
LastLiteral
(package private) static int
LastSpecial
(package private) static int
LastSymbol
(package private) static int
LeftBrace
(package private) static int
LeftBracket
(package private) static int
LeftParen
(package private) static int
LessEqual
(package private) static int
LessThan
(package private) static int
Line
(package private) static int
Literal
(package private) static java.lang.String[]
Literals
(package private) static int
Local
(package private) static int
Long
(package private) static int
MacroIdentifier
(package private) static int
Manages
(package private) static int
Minus
(package private) static int
Module
(package private) static int
Multiple
(package private) java.lang.String
name
Lexeme extracted from the source for this token.(package private) static int
Native
(package private) static int
NotEqual
(package private) static int
Null
(package private) static int
Object
(package private) static int
Octet
(package private) static int
Oneway
(package private) static int
Out
(package private) static int
Percent
(package private) static int
Period
(package private) static int
Plus
(package private) static int
Pragma
(package private) static int
PrimaryKey
(package private) static int
Private
(package private) static int
Provides
(package private) static int
Public
(package private) static int
Publishes
(package private) static int
Quote
(package private) static int
Raises
(package private) static int
Readonly
(package private) static int
RightBrace
(package private) static int
RightBracket
(package private) static int
RightParen
(package private) static int
Semicolon
(package private) static int
Sequence
(package private) static int
SetRaises
(package private) static int
ShiftLeft
(package private) static int
ShiftRight
(package private) static int
Short
(package private) static int
Slash
(package private) static java.lang.String[]
Special
(package private) static int
Star
(package private) static int
String
(package private) static int
StringLiteral
(package private) static int
Struct
(package private) static int
Supports
(package private) static int
Switch
(package private) static java.lang.String[]
Symbols
(package private) static int
Tilde
(package private) static int
TRUE
(package private) static int
Truncatable
(package private) int
type
Code identifying the lexical class to which this token belongs, e.g., Keyword, Identifier, ...(package private) static int
Typedef
(package private) static int
TypeId
(package private) static int
TypePrefix
(package private) static int
Undef
(package private) static int
Union
(package private) static int
Unknown
(package private) static int
Unsigned
(package private) static int
Uses
(package private) static int
ValueBase
(package private) static int
Valuetype
(package private) static int
Void
(package private) static int
Wchar
(package private) static int
Wstring
-
Constructor Summary
Constructors Constructor Description Token(int tokenType)
Constructor.Token(int tokenType, boolean deprecated)
Constructor.Token(int tokenType, java.lang.String tokenName)
Constructor.Token(int tokenType, java.lang.String tokenName, boolean isWide)
Constructor.Token(int tokenType, java.lang.String tokenName, boolean escaped, boolean collision, boolean deprecated)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
collidesWithKeyword()
Accessor.(package private) boolean
equals(int type)
Determine whether the this token is of a supplied type.(package private) boolean
equals(Token that)
Determine whether this token equals a supplied token.(package private) boolean
equals(java.lang.String name)
Determine whether this identifier has the supplied name.private static int
getLastKeyword(int level)
private static int
getLevel(float cLevel)
boolean
isDeprecated()
Accessor.(package private) boolean
isDirective()
Determine whether this token is a preprocessor directive.boolean
isEscaped()
Accessor.(package private) boolean
isKeyword()
Determine whether this token is a keyword.boolean
isWide()
static Token
makeKeywordToken(java.lang.String string, float corbaLevel, boolean escapedOK, boolean[] collision)
Create a keyword token from a string.java.lang.String
toString()
Get the String representation of this Token.(package private) static java.lang.String
toString(int type)
Get the String representation of a supplied Token type.
-
-
-
Field Detail
-
Any
static final int Any
- See Also:
- Constant Field Values
-
Attribute
static final int Attribute
- See Also:
- Constant Field Values
-
Boolean
static final int Boolean
- See Also:
- Constant Field Values
-
Case
static final int Case
- See Also:
- Constant Field Values
-
Char
static final int Char
- See Also:
- Constant Field Values
-
Const
static final int Const
- See Also:
- Constant Field Values
-
Context
static final int Context
- See Also:
- Constant Field Values
-
Default
static final int Default
- See Also:
- Constant Field Values
-
Double
static final int Double
- See Also:
- Constant Field Values
-
Enum
static final int Enum
- See Also:
- Constant Field Values
-
Exception
static final int Exception
- See Also:
- Constant Field Values
-
FALSE
static final int FALSE
- See Also:
- Constant Field Values
-
Fixed
static final int Fixed
- See Also:
- Constant Field Values
-
Float
static final int Float
- See Also:
- Constant Field Values
-
In
static final int In
- See Also:
- Constant Field Values
-
Inout
static final int Inout
- See Also:
- Constant Field Values
-
Interface
static final int Interface
- See Also:
- Constant Field Values
-
Long
static final int Long
- See Also:
- Constant Field Values
-
Module
static final int Module
- See Also:
- Constant Field Values
-
Native
static final int Native
- See Also:
- Constant Field Values
-
Object
static final int Object
- See Also:
- Constant Field Values
-
Octet
static final int Octet
- See Also:
- Constant Field Values
-
Oneway
static final int Oneway
- See Also:
- Constant Field Values
-
Out
static final int Out
- See Also:
- Constant Field Values
-
Raises
static final int Raises
- See Also:
- Constant Field Values
-
Readonly
static final int Readonly
- See Also:
- Constant Field Values
-
Sequence
static final int Sequence
- See Also:
- Constant Field Values
-
Short
static final int Short
- See Also:
- Constant Field Values
-
String
static final int String
- See Also:
- Constant Field Values
-
Struct
static final int Struct
- See Also:
- Constant Field Values
-
Switch
static final int Switch
- See Also:
- Constant Field Values
-
TRUE
static final int TRUE
- See Also:
- Constant Field Values
-
Typedef
static final int Typedef
- See Also:
- Constant Field Values
-
Unsigned
static final int Unsigned
- See Also:
- Constant Field Values
-
Union
static final int Union
- See Also:
- Constant Field Values
-
Void
static final int Void
- See Also:
- Constant Field Values
-
Wchar
static final int Wchar
- See Also:
- Constant Field Values
-
Wstring
static final int Wstring
- See Also:
- Constant Field Values
-
Init
static final int Init
- See Also:
- Constant Field Values
-
Abstract
static final int Abstract
- See Also:
- Constant Field Values
-
Custom
static final int Custom
- See Also:
- Constant Field Values
-
Private
static final int Private
- See Also:
- Constant Field Values
-
Public
static final int Public
- See Also:
- Constant Field Values
-
Supports
static final int Supports
- See Also:
- Constant Field Values
-
Truncatable
static final int Truncatable
- See Also:
- Constant Field Values
-
ValueBase
static final int ValueBase
- See Also:
- Constant Field Values
-
Valuetype
static final int Valuetype
- See Also:
- Constant Field Values
-
Factory
static final int Factory
- See Also:
- Constant Field Values
-
Component
static final int Component
- See Also:
- Constant Field Values
-
Consumes
static final int Consumes
- See Also:
- Constant Field Values
-
Emits
static final int Emits
- See Also:
- Constant Field Values
-
Finder
static final int Finder
- See Also:
- Constant Field Values
-
GetRaises
static final int GetRaises
- See Also:
- Constant Field Values
-
Home
static final int Home
- See Also:
- Constant Field Values
-
Import
static final int Import
- See Also:
- Constant Field Values
-
Local
static final int Local
- See Also:
- Constant Field Values
-
Manages
static final int Manages
- See Also:
- Constant Field Values
-
Multiple
static final int Multiple
- See Also:
- Constant Field Values
-
PrimaryKey
static final int PrimaryKey
- See Also:
- Constant Field Values
-
Provides
static final int Provides
- See Also:
- Constant Field Values
-
Publishes
static final int Publishes
- See Also:
- Constant Field Values
-
SetRaises
static final int SetRaises
- See Also:
- Constant Field Values
-
TypeId
static final int TypeId
- See Also:
- Constant Field Values
-
TypePrefix
static final int TypePrefix
- See Also:
- Constant Field Values
-
Uses
static final int Uses
- See Also:
- Constant Field Values
-
Identifier
static final int Identifier
- See Also:
- Constant Field Values
-
MacroIdentifier
static final int MacroIdentifier
- See Also:
- Constant Field Values
-
Semicolon
static final int Semicolon
- See Also:
- Constant Field Values
-
LeftBrace
static final int LeftBrace
- See Also:
- Constant Field Values
-
RightBrace
static final int RightBrace
- See Also:
- Constant Field Values
-
Colon
static final int Colon
- See Also:
- Constant Field Values
-
Comma
static final int Comma
- See Also:
- Constant Field Values
-
Equal
static final int Equal
- See Also:
- Constant Field Values
-
Plus
static final int Plus
- See Also:
- Constant Field Values
-
Minus
static final int Minus
- See Also:
- Constant Field Values
-
LeftParen
static final int LeftParen
- See Also:
- Constant Field Values
-
RightParen
static final int RightParen
- See Also:
- Constant Field Values
-
LessThan
static final int LessThan
- See Also:
- Constant Field Values
-
GreaterThan
static final int GreaterThan
- See Also:
- Constant Field Values
-
LeftBracket
static final int LeftBracket
- See Also:
- Constant Field Values
-
RightBracket
static final int RightBracket
- See Also:
- Constant Field Values
-
Apostrophe
static final int Apostrophe
- See Also:
- Constant Field Values
-
Quote
static final int Quote
- See Also:
- Constant Field Values
-
Backslash
static final int Backslash
- See Also:
- Constant Field Values
-
Bar
static final int Bar
- See Also:
- Constant Field Values
-
Carat
static final int Carat
- See Also:
- Constant Field Values
-
Ampersand
static final int Ampersand
- See Also:
- Constant Field Values
-
Star
static final int Star
- See Also:
- Constant Field Values
-
Slash
static final int Slash
- See Also:
- Constant Field Values
-
Percent
static final int Percent
- See Also:
- Constant Field Values
-
Tilde
static final int Tilde
- See Also:
- Constant Field Values
-
DoubleColon
static final int DoubleColon
- See Also:
- Constant Field Values
-
ShiftLeft
static final int ShiftLeft
- See Also:
- Constant Field Values
-
ShiftRight
static final int ShiftRight
- See Also:
- Constant Field Values
-
Period
static final int Period
- See Also:
- Constant Field Values
-
Hash
static final int Hash
- See Also:
- Constant Field Values
-
Exclamation
static final int Exclamation
- See Also:
- Constant Field Values
-
DoubleEqual
static final int DoubleEqual
- See Also:
- Constant Field Values
-
NotEqual
static final int NotEqual
- See Also:
- Constant Field Values
-
GreaterEqual
static final int GreaterEqual
- See Also:
- Constant Field Values
-
LessEqual
static final int LessEqual
- See Also:
- Constant Field Values
-
DoubleBar
static final int DoubleBar
- See Also:
- Constant Field Values
-
DoubleAmpersand
static final int DoubleAmpersand
- See Also:
- Constant Field Values
-
BooleanLiteral
static final int BooleanLiteral
- See Also:
- Constant Field Values
-
CharacterLiteral
static final int CharacterLiteral
- See Also:
- Constant Field Values
-
IntegerLiteral
static final int IntegerLiteral
- See Also:
- Constant Field Values
-
FloatingPointLiteral
static final int FloatingPointLiteral
- See Also:
- Constant Field Values
-
StringLiteral
static final int StringLiteral
- See Also:
- Constant Field Values
-
Literal
static final int Literal
- See Also:
- Constant Field Values
-
Define
static final int Define
- See Also:
- Constant Field Values
-
Undef
static final int Undef
- See Also:
- Constant Field Values
-
If
static final int If
- See Also:
- Constant Field Values
-
Ifdef
static final int Ifdef
- See Also:
- Constant Field Values
-
Ifndef
static final int Ifndef
- See Also:
- Constant Field Values
-
Else
static final int Else
- See Also:
- Constant Field Values
-
Elif
static final int Elif
- See Also:
- Constant Field Values
-
Include
static final int Include
- See Also:
- Constant Field Values
-
Endif
static final int Endif
- See Also:
- Constant Field Values
-
Line
static final int Line
- See Also:
- Constant Field Values
-
Error
static final int Error
- See Also:
- Constant Field Values
-
Pragma
static final int Pragma
- See Also:
- Constant Field Values
-
Null
static final int Null
- See Also:
- Constant Field Values
-
Unknown
static final int Unknown
- See Also:
- Constant Field Values
-
Defined
static final int Defined
- See Also:
- Constant Field Values
-
EOF
static final int EOF
- See Also:
- Constant Field Values
-
Keywords
static final java.lang.String[] Keywords
-
FirstKeyword
private static final int FirstKeyword
- See Also:
- Constant Field Values
-
LastKeyword
private static final int LastKeyword
- See Also:
- Constant Field Values
-
First22Keyword
private static final int First22Keyword
- See Also:
- Constant Field Values
-
Last22Keyword
private static final int Last22Keyword
- See Also:
- Constant Field Values
-
First23Keyword
private static final int First23Keyword
- See Also:
- Constant Field Values
-
Last23Keyword
private static final int Last23Keyword
- See Also:
- Constant Field Values
-
First24rtfKeyword
private static final int First24rtfKeyword
- See Also:
- Constant Field Values
-
Last24rtfKeyword
private static final int Last24rtfKeyword
- See Also:
- Constant Field Values
-
First30Keyword
private static final int First30Keyword
- See Also:
- Constant Field Values
-
Last30Keyword
private static final int Last30Keyword
- See Also:
- Constant Field Values
-
CORBA_LEVEL_22
private static final int CORBA_LEVEL_22
- See Also:
- Constant Field Values
-
CORBA_LEVEL_23
private static final int CORBA_LEVEL_23
- See Also:
- Constant Field Values
-
CORBA_LEVEL_24RTF
private static final int CORBA_LEVEL_24RTF
- See Also:
- Constant Field Values
-
CORBA_LEVEL_30
private static final int CORBA_LEVEL_30
- See Also:
- Constant Field Values
-
FirstSymbol
static final int FirstSymbol
- See Also:
- Constant Field Values
-
LastSymbol
static final int LastSymbol
- See Also:
- Constant Field Values
-
Symbols
static final java.lang.String[] Symbols
-
FirstLiteral
static final int FirstLiteral
- See Also:
- Constant Field Values
-
LastLiteral
static final int LastLiteral
- See Also:
- Constant Field Values
-
Literals
static final java.lang.String[] Literals
-
FirstDirective
static final int FirstDirective
- See Also:
- Constant Field Values
-
LastDirective
static final int LastDirective
- See Also:
- Constant Field Values
-
Directives
static final java.lang.String[] Directives
-
FirstSpecial
static final int FirstSpecial
- See Also:
- Constant Field Values
-
LastSpecial
static final int LastSpecial
- See Also:
- Constant Field Values
-
Special
static final java.lang.String[] Special
-
type
int type
Code identifying the lexical class to which this token belongs, e.g., Keyword, Identifier, ...
-
name
java.lang.String name
Lexeme extracted from the source for this token.
-
comment
Comment comment
Source comment associated with this token.
-
isEscaped
boolean isEscaped
True iff this token is an escaped identifier.
-
collidesWithKeyword
boolean collidesWithKeyword
True iff this token is an identifier that is known to be a keyword in another version of CORBA or matches a keyword in letter, but not case.
-
isDeprecated
boolean isDeprecated
True iff this token is deprecated.
-
isWide
boolean isWide
-
-
Constructor Detail
-
Token
Token(int tokenType)
Constructor.
-
Token
Token(int tokenType, boolean deprecated)
Constructor.
-
Token
Token(int tokenType, java.lang.String tokenName)
Constructor.
-
Token
Token(int tokenType, java.lang.String tokenName, boolean isWide)
Constructor.
-
Token
Token(int tokenType, java.lang.String tokenName, boolean escaped, boolean collision, boolean deprecated)
Constructor.
-
-
Method Detail
-
isKeyword
boolean isKeyword()
Determine whether this token is a keyword.- Returns:
- true iff this token is a keyword.
-
getLevel
private static int getLevel(float cLevel)
-
getLastKeyword
private static int getLastKeyword(int level)
-
makeKeywordToken
public static Token makeKeywordToken(java.lang.String string, float corbaLevel, boolean escapedOK, boolean[] collision)
Create a keyword token from a string. Determines whether the string is an IDL keyword based on the corbaLevel. Strings that are keywords at higher CORBA levels than the corbaLevel argument create identifier tokens that are marked as "collidesWithKeyword", unless escapedOK is FALSE, which is the case only when preprocessing is taking place. In the case of the "init" keyword, which was only defined in CORBA 2.3, init is marked deprecated in CORBA 2.3 since it is not supported in higher levels.- Parameters:
String
- string The string we are converting to a token.float
- corbaLevel The CORBA level, currently in the interval [2.2, 3.0].boolean
- escapedOK Flag set true if _ is used to escape an IDL keyword for use as an identifier.boolean
- [] collidesWithKeyword is an array containing one value: a flag representing whether this string is an identifier that collides with a keyword. This is set by this method.
-
isDirective
boolean isDirective()
Determine whether this token is a preprocessor directive.- Returns:
- true iff this token is a preprocessor directive.
-
toString
public java.lang.String toString()
Get the String representation of this Token.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a String containing representation of this Token.
-
toString
static java.lang.String toString(int type)
Get the String representation of a supplied Token type.- Returns:
- A String containing the name of the supplied Token type.
-
equals
boolean equals(Token that)
Determine whether this token equals a supplied token.- Returns:
- true iff the types and names of this and the supplied Token are equal.
-
equals
boolean equals(int type)
Determine whether the this token is of a supplied type.- Returns:
- true iff the type of this Token equals that supplied.
-
equals
boolean equals(java.lang.String name)
Determine whether this identifier has the supplied name.- Returns:
- true iff this Token is an identifier having the supplied name.
-
isEscaped
public boolean isEscaped()
Accessor.- Returns:
- true iff this token is an escaped identifier.
-
collidesWithKeyword
public boolean collidesWithKeyword()
Accessor.- Returns:
- true iff this token is an identifier having a name matching a keyword in a version of CORBA greater than the specified CORBA level, or iff it matches a keyword in letter, but note case.
-
isDeprecated
public boolean isDeprecated()
Accessor.- Returns:
- true iff this token is a deprecated lexeme or lexical type with respect to the specified CORBA level.
-
isWide
public boolean isWide()
-
-