Skip to content

XUICEAbstractFormatter

Description

An abstract base class for several code formatters. Implements low level methods that are common to several tokenisers.

It it not intended that this class be instantiated.

If you write your own formatters, you do not have to subclass this class.

Properties

Name Type Read-Only
mCurrent Integer
mFinalLineNumber Integer
mLine XUICELine
mLineManager XUICELineManager
mLineNumber Integer
mLines() XUICELine
mLinesLastIndex Integer
mTokenStartLocal Integer

Methods

Name Parameters Returns
Advance count As Integer
AtEnd Boolean
AtLineEnd Boolean
Constructor
Consume String
Initialise lines() As XUICELine, startLine As Integer
MakeGenericToken type As String, ParamArray keyValues() As Pair XUICELineToken
MakeToken type As String, fallbackType As String, ParamArray keyValues() As Pair XUICELineToken
MoveToLine lineNumber As Integer
Peek places As Integer String

Property Descriptions

mCurrent As Integer

The 0-based index in mCharacters of the next character to evaluate.


mFinalLineNumber As Integer

The 1-based line number of the final line to be tokenised.


mLine As XUICELine

A reference to the line of source code in the editor currently being tokenised.


mLineManager As XUICELineManager

The line manager.


mLineNumber As Integer

The 1-based number of the line currently being tokenised.


mLines() As XUICELine

A reference to the lines to tokenise.


mLinesLastIndex As Integer

Caches value of mLines.LastIndex.


mTokenStartLocal As Integer

The 0-based position on the line being tokenised that the current token starts at.


Method Descriptions

Advance(count As Integer)

Advances the specified number of positions or to the end of the source code (whichever is sooner).


AtEnd() As Boolean

True if we've reached the end of the characters on the line.


AtLineEnd() As Boolean

True if we are currently pointing at the line end.


Constructor()

As this is an abstract class, the constructor is private to prevent instantiation.


Consume() As String

Consumes and returns the current character in the source. Returns "" if at the end of the source or &u0A if at then end of the line.


Initialise(lines() As XUICELine, startLine As Integer)

Initialises the abstract formatter.


MakeGenericToken(type As String, ParamArray keyValues() As Pair) As XUICELineToken

Creates a new generic token starting at mTokenStartLocal and ending at mCurrent with optional key-value data. Fallback is set to type.

Optional key-values can be added to the token's data. Each item in keyValues is a Pair in the format:

 `Left`  = `String` key
 `Right` = `Variant` value

We set fallbackType to the same value as type. This therefore assumes that type is a valid generic theme type (i.e. one that is guaranteed to be present in a valid XUICETheme.


MakeToken(type As String, fallbackType As String, ParamArray keyValues() As Pair) As XUICELineToken

Creates a new token starting at mTokenStartLocal and ending at mCurrent with optional key-value data.

Optional key-values can be added to the token's data. Each item in keyValues is a Pair in the format:

 `Left`  = `String` key
 `Right` = `Variant` value

fallbackType is the style to use if the editor's theme doesn't define type as a style.


MoveToLine(lineNumber As Integer)

Moves the tokeniser to the start of line lineNumber and clears any tokens on it. Assumes that lineNumber is valid.


Peek(places As Integer) As String

Returns the character places beyond the current character without consuming it. Returns "" if we've reached the end of the source code or &u0A if at the end of a line.

Assumes places > 0.