| java.lang.Object org.netbeans.modules.lexer.gen.TokenTypes
All known Subclasses: org.netbeans.modules.lexer.gen.antlr.AntlrTokenTypes, org.netbeans.modules.lexer.gen.javacc.JavaCCTokenTypes,
TokenTypes | public class TokenTypes (Code) | | The lexer generators often generate a class or interface
that contains integer fields of token types
named e.g. xxxConstants or xxxTokenTypes etc.
The TokenConstants class encapsulates the information
contained in such token types class.
The reflection is used to collect
the "public static final int" fields in the token types class.
All these fields are collected but subclasses
may wish to hide some of the fields (e.g. some fields
may be related to states of an automaton instead of token types
identification).
author: Miloslav Metelka version: 1.00 |
name2value | final protected Map name2value(Code) | | Map of [tokenTypeName, tokenTypeValue]
|
value2name | final protected Map value2name(Code) | | Map of [tokenTypeValue, tokenTypeName]
|
TokenTypes | public TokenTypes(Class tokenTypesClass)(Code) | | |
findMaxTokenTypeValue | public int findMaxTokenTypeValue()(Code) | | |
getTokenTypeName | public String getTokenTypeName(int tokenTypeValue)(Code) | | |
getTokenTypeValue | public Integer getTokenTypeValue(String tokenTypeName)(Code) | | Integer value of the static field with the given nameor null if the field does not exist. |
getTokenTypesClass | public Class getTokenTypesClass()(Code) | | |
inspect | protected boolean inspect()(Code) | | Inspect the token types class.
This method can be overriden by children if necessary.
The method goes through the class
and puts the [field-name, integer-constant-value]
for all the static fields into the info map.
The null key is mapped to maximum constant value
found in the token types class.
The List.class key is mapped to the list
of all the field names in the order in which they
were found in the token types class.
true if the inspection was really doneor false if the inspection was already done previously. |
isAccepted | protected boolean isAccepted(String tokenTypeName, int tokenTypeValue)(Code) | | Whether it's ok to add the given field name to the list
of the [tokenTypeName, Integer] pairs.
Subclasses can exclude some field(s) if necessary.
|
tokenTypeNamesIterator | public Iterator tokenTypeNamesIterator()(Code) | | all the field names |
updateData | protected void updateData(LanguageData languageData)(Code) | | Called by LanguageData.registerTokenTypes()
to update the language data into which it's being registered.
By default it adds mutable token ids that correspond
to the constants discovered in token types.
Can be overriden by subclasses to provide some more functionality.
|
updateId | protected void updateId(MutableTokenId id)(Code) | | Update a newly created or an existing token-id by the information
contained in this token-types.
The passed token-id already has tokenTypeName
filled in.
|
|
|