public class IElementType
extends java.lang.Object
Lexer.getTokenType()
,
ASTNode.getElementType()
Modifier and Type | Class and Description |
---|---|
static interface |
IElementType.Predicate
Predicate for matching element types.
|
Modifier and Type | Field and Description |
---|---|
static ArrayFactory<IElementType> |
ARRAY_FACTORY |
static IElementType[] |
EMPTY_ARRAY |
static short |
FIRST_TOKEN_INDEX |
static IElementType.Predicate |
TRUE
Default enumeration predicate which matches all token types.
|
Modifier | Constructor and Description |
---|---|
|
IElementType(java.lang.String debugName,
Language language)
Creates and registers a new element type for the specified language.
|
protected |
IElementType(java.lang.String debugName,
Language language,
boolean register)
Allows to construct element types for some temporary purposes without registering them.
|
Modifier and Type | Method and Description |
---|---|
static IElementType [] |
enumerate(IElementType.Predicate p)
Enumerates all registered token types which match the specified predicate.
|
static IElementType |
find(short idx)
Returns the element type registered at the specified index.
|
short |
getIndex()
Returns the index of the element type in the table of all registered element
types.
|
Language |
getLanguage()
Returns the language associated with the element type.
|
int |
hashCode() |
boolean |
isLeftBound()
Controls whitespace balancing behavior of PsiBuilder.
|
java.lang.String |
toString() |
static void |
unregisterElementTypes(java.lang.ClassLoader loader) |
static void |
unregisterElementTypes(Language language) |
public static final IElementType[] EMPTY_ARRAY
public static final ArrayFactory<IElementType> ARRAY_FACTORY
public static final IElementType.Predicate TRUE
enumerate(Predicate)
public static final short FIRST_TOKEN_INDEX
public IElementType(java.lang.String debugName, Language language)
debugName
- the name of the element type, used for debugging purposes.language
- the language with which the element type is associated.protected IElementType(java.lang.String debugName, Language language, boolean register)
TokenSet
) won't work with such element types.
Please use IElementType(String, Language)
unless you know what you're doing.public static void unregisterElementTypes(java.lang.ClassLoader loader)
public static void unregisterElementTypes(Language language)
public Language getLanguage()
public final short getIndex()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isLeftBound()
By default, empty composite elements (containing no children) are bounded to the right (previous) neighbour, forming following tree:
[previous_element] [whitespace] [empty_element] <empty> [next_element]
Left-bound elements are bounded to the left (next) neighbour instead:
[previous_element] [empty_element] <empty> [whitespace] [next_element]
See com.intellij.lang.impl.PsiBuilderImpl.prepareLightTree() for details.
public static IElementType find(short idx)
idx
- the index for which the element type should be returned.java.lang.IndexOutOfBoundsException
- if the index is out of registered elements' range.public static IElementType [] enumerate(IElementType.Predicate p)
p
- the predicate which should be matched by the element types.