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
The offset after the last character in the token.
EndPosition
The TextPosition after the last character in the token.
Id
The ID assigned to the token.
Key
The key assigned to the token.
Length
The absolute length of the token.
int Length { get; set; }
Property Value
Remarks
The setter for this property is for internal use only. Altering its value will corrupt the ITextDocumentIToken collection.
LexicalStateId
The ID assigned to the lexical state that contains the token.
PositionRange
A TextPositionRange that specifies the text position range of the token.
StartOffset
The offset of the first character in the token.
StartPosition
The TextPosition of the first character in the token.
TextRange
A TextRange that specifies the text range of the token.
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:
trueif 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.
bool Contains(int offset)
| Parameter | Type | Description |
|---|---|---|
| offset | int | The offset to examine. |
Returns
Remarks
This method returns false if the offset falls on the EndOffset offset
since this method indicates if the offset is encompassed by the IToken.