Skip to content

XUICELineToken

Description

Represents a token in the code editor.

Whenever text is entered / edited in the code editor it is tokenised into tokens. A token is the atomic unit of styling in the editor and they are generated by formatters.

Tokens contain data that tells the code editor their position in the code editor and their type. A token's type determine's how it is styled by the editor (e.g. the colour of text, whether it is bold, etc).

Properties

Name Type Read-Only
EndLocal Integer
FallbackType String
Length Integer
LineNumber Integer
mData Dictionary
StartAbsolute Integer
StartLocal Integer
Type String

Methods

Name Parameters Returns
Constructor startAbsolute As Integer, startLocal As Integer, length As Integer, lineNumber As Integer, type As String, fallback As String
HasDataKey key As String Boolean
LookupData key As String, default As Variant Variant
SetData key As String, value As Variant

Constants

Name Type
TYPE_COMMENT String
TYPE_DEFAULT String
TYPE_ERROR String
TYPE_IDENTIFIER String
TYPE_KEYWORD String
TYPE_NUMBER String
TYPE_OPERATOR String
TYPE_STRING String

TYPE_COMMENT As String The generic comment token type. Guaranteed to be defined within a valid theme.


TYPE_DEFAULT As String The default token type. Guaranteed to be defined within a valid theme.


TYPE_ERROR As String The error token type. Guaranteed to be defined within a valid theme.


TYPE_IDENTIFIER As String The generic identifier token type. Guaranteed to be defined within a valid theme.


TYPE_KEYWORD As String The generic keyword token type. Guaranteed to be defined within a valid theme.


TYPE_NUMBER As String The generic number token type. Guaranteed to be defined within a valid theme.


TYPE_OPERATOR As String The generic operator token type. Guaranteed to be defined within a valid theme.


TYPE_STRING As String The generic string token type. Guaranteed to be defined within a valid theme.


Property Descriptions

EndLocal As Integer

0-based position of the end of this token local to this line.


FallbackType As String

The token type to use if the current theme doesn't support the primary "Type" style.


Length As Integer

The length of this token in characters.


LineNumber As Integer

The 1-based number of the line this token belongs to.


mData As Dictionary

Backing dictionary for any arbitrary data this token may contain.


StartAbsolute As Integer

The absolute 0-based start position of this token in the original source text.


StartLocal As Integer

The 0-based local position of this token where 0 is the start of this line.


Type As String

This token's type. Used to determine how to style it.


Method Descriptions

Constructor(startAbsolute As Integer, startLocal As Integer, length As Integer, lineNumber As Integer, type As String, fallback As String)

Default constructor.

  • startAbsolute is the absolute 0-based position of the start of this token within the original source code.
  • startLocal is the 0-based position on this token's line that this token starts at.
  • length is the length of this token in characters.
  • lineNumber is the 1-based line number this token is on.
  • type is this token's type as a string. This is used in themes to style the token in the editor.
  • fallback is the token's fallback type to use if type isn't available in the current theme.

HasDataKey(key As String) As Boolean

True if this token has data with the specified (case insensitive) key.


LookupData(key As String, default As Variant) As Variant

Returns the data value associated with key or default if there is no matching key.


SetData(key As String, value As Variant)

Sets the data key to value. Will overwrite the existing value of key if already set.