TokenBase Class
Represents the base class for an IToken implementation.
public abstract class TokenBase : IToken
- Inheritance:
- object object
- Derived:
- MergeableToken
- Implements:
- IToken
Constructors
TokenBase(int, int, TextPosition, TextPosition)
Represents the base class for an IToken implementation.
protected TokenBase(int startOffset, int length, TextPosition startPosition, TextPosition endPosition)
| Parameter | Type | Description |
|---|---|---|
| startOffset | int | The start offset of the token. |
| length | int | The length of the token. |
| startPosition | TextPosition | The TextPosition of the first character in the token. |
| endPosition | TextPosition | The TextPosition after the last character in the token. |
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.
public 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.
public 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.
public 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.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
| Parameter | Type | Description |
|---|---|---|
| obj | object | The object to compare with the current object. |
Returns
- bool:
trueif the specified object is equal to the current object; otherwise,false.
GetHashCode()
Serves as the default hash function.
ToString()
Returns the string representation of this object.
ToString(string)
Creates and returns a string representation of the current object.
public string ToString(string tokenDescription)
| Parameter | Type | Description |
|---|---|---|
| tokenDescription | string | The description of the IToken. |
Returns
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)