类 IElementType

java.lang.Object
com.intellij.psi.tree.IElementType
直接已知子类:
ILazyParseableElementType, TokenWrapper

public class IElementType extends Object
Interface for token types returned from lexical analysis and for types of nodes in the AST tree. All used element types are added to a registry which can be enumerated or accessed by index.
另请参阅:
  • 字段详细资料

  • 构造器详细资料

    • IElementType

      public IElementType(@NonNls @NotNull @NonNls @NotNull String debugName, @Nullable @Nullable Language language)
      Creates and registers a new element type for the specified language.
      参数:
      debugName - the name of the element type, used for debugging purposes.
      language - the language with which the element type is associated.
    • IElementType

      protected IElementType(@NonNls @NotNull @NonNls @NotNull String debugName, @Nullable @Nullable Language language, boolean register)
      Allows to construct element types for some temporary purposes without registering them. This is not default behavior and not recommended. A lot of other functionality (e.g. TokenSet) won't work with such element types. Please use IElementType(String, Language) unless you know what you're doing.
  • 方法详细资料

    • unregisterElementTypes

      public static void unregisterElementTypes(@NotNull @NotNull ClassLoader loader)
    • unregisterElementTypes

      public static void unregisterElementTypes(@NotNull @NotNull Language language)
    • getLanguage

      @NotNull public @NotNull Language getLanguage()
      Returns the language associated with the element type.
      返回:
      the associated language.
    • getIndex

      public final short getIndex()
      Returns the index of the element type in the table of all registered element types.
      返回:
      the element type index.
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • isLeftBound

      public boolean isLeftBound()
      Controls whitespace balancing behavior of PsiBuilder.

      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 fleet.com.intellij.lang.impl.PsiBuilderImpl.prepareLightTree() for details.

      返回:
      true if empty elements of this type should be bound to the left.
    • find

      public static IElementType find(short idx)
      Returns the element type registered at the specified index.
      参数:
      idx - the index for which the element type should be returned.
      返回:
      the element type at the specified index.
      抛出:
      IndexOutOfBoundsException - if the index is out of registered elements' range.
    • enumerate

      public static IElementType @NotNull [] enumerate(@NotNull @NotNull IElementType.Predicate p)
      Enumerates all registered token types which match the specified predicate.
      参数:
      p - the predicate which should be matched by the element types.
      返回:
      the array of matching element types.