TokenSet Class
Stores token data for a range of text.
public class TokenSet : ITokenSet, ITextRangeProvider
- Inheritance:
- object object
- Implements:
- ITokenSet ITextRangeProvider
Constructors
TokenSet(TextRange, IEnumerable<IToken>?, object?)
Initializes an instance of the class.
public TokenSet(TextRange textRange, IEnumerable<IToken>? tokens, object? parseContext)
| Parameter | Type | Description |
|---|---|---|
| textRange | TextRange | The TextRange for which tokens in this set are available. |
| tokens | IEnumerable<IToken> | The enumerable collection of tokens to add to the set. |
| parseContext | object | An optional object that may be used to help provide context information when resuming incremental parsing near the end of this token set. |
TokenSet(TextRange, IEnumerable<TagSnapshotRange<ITokenTag>>?, object?)
Initializes an instance of the class.
public TokenSet(TextRange textRange, IEnumerable<TagSnapshotRange<ITokenTag>>? tagRanges, object? parseContext)
| Parameter | Type | Description |
|---|---|---|
| textRange | TextRange | The TextRange for which tokens in this set are available. |
| tagRanges | IEnumerable<TagSnapshotRange<ITokenTag>> | The enumerable collection of token tag ranges to add to the set. |
| parseContext | object | An optional object that may be used to help provide context information when resuming incremental parsing near the end of this token set. |
Properties
Count
The count of tokens that are stored in the token set.
FirstToken
The first IToken in the set.
FirstTokenExtendsBack
Indicates whether the FirstToken extends back to another token set.
public bool FirstTokenExtendsBack { get; }
Property Value
- bool:
trueif the FirstToken extends back to another token set; otherwise,false.
LastToken
The last IToken in the set.
LastTokenExtendsForward
Indicates whether the LastToken extends forward to another token set.
public bool LastTokenExtendsForward { get; }
Property Value
ParseContext
An optional object that may be used to help provide context information when resuming incremental parsing near the end of this token set.
TextRange
A TextRange that specifies the text range of the object.
this[int]
An IToken in the token set.
public IToken this[int index] { get; }
| Parameter | Type | Description |
|---|---|---|
| index | int | The index of the IToken to return. |
Property Value
Methods
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<IToken> GetEnumerator()
Returns
- IEnumerator<IToken>:
An enumerator that can be used to iterate through the collection.
IndexOf(int, int)
Returns the index of the IToken in the set that contains the specified offset; otherwise, -1.
public int IndexOf(int offset, int hintIndex)
| Parameter | Type | Description |
|---|---|---|
| offset | int | The offset for which to search. |
| hintIndex | int | The hint index at which to begin searching; otherwise, |
Returns
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()