IToken Interface
Represents the base requirements for a token that has been assigned to a span of text by a lexer.
public interface IToken
Properties
EndOffset
Gets the offset after the last character in the token.
EndPosition
Gets the TextPosition after the last character in the token.
TextPosition EndPosition { get; }
Property Value
- TextPosition:
The TextPosition after the last character in the token.
Id
Gets the ID assigned to the token.
Key
Gets the key assigned to the token.
Length
Gets or sets the absolute length of the token.
int Length { get; set; }
Property Value
- int:
The absolute length of the token.
Remarks
The setter for this property is for internal use only. Altering its value will corrupt the ITextDocumentIToken collection.
LexicalStateId
Gets the ID assigned to the lexical state that contains the token.
int LexicalStateId { get; }
Property Value
- int:
The ID assigned to the lexical state that contains the token.
PositionRange
Gets a TextPositionRange that specifies the text position range of the token.
TextPositionRange PositionRange { get; }
Property Value
- TextPositionRange:
A TextPositionRange that specifies the text position range of the token.
StartOffset
Gets or sets the offset of the first character in the token.
StartPosition
Gets the TextPosition of the first character in the token.
TextPosition StartPosition { get; }
Property Value
- TextPosition:
The TextPosition of the first character in the token.
TextRange
Gets a TextRange that specifies the text range of the token.
TextRange TextRange { get; }
Property Value
Methods
Contains(TextPosition)
Returns whether the IToken contains the specified TextPosition.
bool Contains(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition to examine. |
Returns
- bool:
true
if the IToken contains the specified TextPosition; otherwise,false
.
Remarks
This method returns false
if the position falls on the EndPosition position
since this method indicates if the position is encompassed by the IToken.
Contains(int)
Returns whether the IToken contains the specified offset.