Package com.sun.tools.corba.ee.idl
Class Token
- java.lang.Object
-
- com.sun.tools.corba.ee.idl.Token
-
class Token extends java.lang.ObjectClass 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 intAbstract(package private) static intAmpersand(package private) static intAny(package private) static intApostrophe(package private) static intAttribute(package private) static intBackslash(package private) static intBar(package private) static intBoolean(package private) static intBooleanLiteral(package private) static intCarat(package private) static intCase(package private) static intChar(package private) static intCharacterLiteral(package private) booleancollidesWithKeywordTrue 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 intColon(package private) static intComma(package private) CommentcommentSource comment associated with this token.(package private) static intComponent(package private) static intConst(package private) static intConsumes(package private) static intContextprivate static intCORBA_LEVEL_22private static intCORBA_LEVEL_23private static intCORBA_LEVEL_24RTFprivate static intCORBA_LEVEL_30(package private) static intCustom(package private) static intDefault(package private) static intDefine(package private) static intDefined(package private) static java.lang.String[]Directives(package private) static intDouble(package private) static intDoubleAmpersand(package private) static intDoubleBar(package private) static intDoubleColon(package private) static intDoubleEqual(package private) static intElif(package private) static intElse(package private) static intEmits(package private) static intEndif(package private) static intEnum(package private) static intEOF(package private) static intEqual(package private) static intError(package private) static intException(package private) static intExclamation(package private) static intFactory(package private) static intFALSE(package private) static intFinderprivate static intFirst22Keywordprivate static intFirst23Keywordprivate static intFirst24rtfKeywordprivate static intFirst30Keyword(package private) static intFirstDirectiveprivate static intFirstKeyword(package private) static intFirstLiteral(package private) static intFirstSpecial(package private) static intFirstSymbol(package private) static intFixed(package private) static intFloat(package private) static intFloatingPointLiteral(package private) static intGetRaises(package private) static intGreaterEqual(package private) static intGreaterThan(package private) static intHash(package private) static intHome(package private) static intIdentifier(package private) static intIf(package private) static intIfdef(package private) static intIfndef(package private) static intImport(package private) static intIn(package private) static intInclude(package private) static intInit(package private) static intInout(package private) static intIntegerLiteral(package private) static intInterface(package private) booleanisDeprecatedTrue iff this token is deprecated.(package private) booleanisEscapedTrue iff this token is an escaped identifier.(package private) booleanisWide(package private) static java.lang.String[]Keywordsprivate static intLast22Keywordprivate static intLast23Keywordprivate static intLast24rtfKeywordprivate static intLast30Keyword(package private) static intLastDirectiveprivate static intLastKeyword(package private) static intLastLiteral(package private) static intLastSpecial(package private) static intLastSymbol(package private) static intLeftBrace(package private) static intLeftBracket(package private) static intLeftParen(package private) static intLessEqual(package private) static intLessThan(package private) static intLine(package private) static intLiteral(package private) static java.lang.String[]Literals(package private) static intLocal(package private) static intLong(package private) static intMacroIdentifier(package private) static intManages(package private) static intMinus(package private) static intModule(package private) static intMultiple(package private) java.lang.StringnameLexeme extracted from the source for this token.(package private) static intNative(package private) static intNotEqual(package private) static intNull(package private) static intObject(package private) static intOctet(package private) static intOneway(package private) static intOut(package private) static intPercent(package private) static intPeriod(package private) static intPlus(package private) static intPragma(package private) static intPrimaryKey(package private) static intPrivate(package private) static intProvides(package private) static intPublic(package private) static intPublishes(package private) static intQuote(package private) static intRaises(package private) static intReadonly(package private) static intRightBrace(package private) static intRightBracket(package private) static intRightParen(package private) static intSemicolon(package private) static intSequence(package private) static intSetRaises(package private) static intShiftLeft(package private) static intShiftRight(package private) static intShort(package private) static intSlash(package private) static java.lang.String[]Special(package private) static intStar(package private) static intString(package private) static intStringLiteral(package private) static intStruct(package private) static intSupports(package private) static intSwitch(package private) static java.lang.String[]Symbols(package private) static intTilde(package private) static intTRUE(package private) static intTruncatable(package private) inttypeCode identifying the lexical class to which this token belongs, e.g., Keyword, Identifier, ...(package private) static intTypedef(package private) static intTypeId(package private) static intTypePrefix(package private) static intUndef(package private) static intUnion(package private) static intUnknown(package private) static intUnsigned(package private) static intUses(package private) static intValueBase(package private) static intValuetype(package private) static intVoid(package private) static intWchar(package private) static intWstring
-
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 booleancollidesWithKeyword()Accessor.(package private) booleanequals(int type)Determine whether the this token is of a supplied type.(package private) booleanequals(Token that)Determine whether this token equals a supplied token.(package private) booleanequals(java.lang.String name)Determine whether this identifier has the supplied name.private static intgetLastKeyword(int level)private static intgetLevel(float cLevel)booleanisDeprecated()Accessor.(package private) booleanisDirective()Determine whether this token is a preprocessor directive.booleanisEscaped()Accessor.(package private) booleanisKeyword()Determine whether this token is a keyword.booleanisWide()static TokenmakeKeywordToken(java.lang.String string, float corbaLevel, boolean escapedOK, boolean[] collision)Create a keyword token from a string.java.lang.StringtoString()Get the String representation of this Token.(package private) static java.lang.StringtoString(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:
toStringin 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()
-
-