MergableToken Class
Represents the default implementation of an IToken that can be used with an IMergableLexer.
public class MergableToken : TokenBase, IMergableToken, IToken
- Implements:
- IMergableToken IToken
Constructors
MergableToken(Int32, Int32, TextPosition, TextPosition, MergableLexerFlags, ILexicalState, IMergableTokenLexerData)
Initializes a new instance of the MergableToken
class.
public MergableToken(int startOffset, int length, TextPosition startPosition, TextPosition endPosition, MergableLexerFlags lexerFlags, ILexicalState lexicalState, IMergableTokenLexerData lexerData)
Parameter | Type | Description |
---|---|---|
startOffset | Int32 | The start offset of the token. |
length | Int32 | 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. |
lexerFlags | MergableLexerFlags | The MergableLexerFlags for the token. |
lexicalState | ILexicalState | The ILexicalState that contains the token. |
lexerData | IMergableTokenLexerData | The IMergableTokenLexerData that contains the lexer information about the token. |
Properties
AutoCaseCorrectText
Gets the text that should be used for this IToken when performing an auto case correction operation on it.
public virtual string AutoCaseCorrectText { get; }
Property Value
- String:
The text that should be used for this IToken when performing an auto case correction operation on it.
Remarks
Return a null value to indicate that there is no auto case correction text available.
ClassificationType
Gets the IClassificationType assigned to the token.
public virtual IClassificationType ClassificationType { get; }
Property Value
- IClassificationType:
The IClassificationType assigned to the token.
DeclaringLexicalState
Gets the ILexicalState that declares the pattern that matched the token.
public virtual ILexicalState DeclaringLexicalState { get; }
Property Value
- ILexicalState:
The ILexicalState that declares the pattern that matched the token.
Id
Gets the ID assigned to the token.
Key
Gets the key assigned to the token.
Lexer
Gets the IMergableLexer that created the token.
public IMergableLexer Lexer { get; }
Property Value
- IMergableLexer:
The IMergableLexer that created the token.
LexerData
Gets an IMergableTokenLexerData that contains lexer information for the token.
protected IMergableTokenLexerData LexerData { get; }
Property Value
- IMergableTokenLexerData:
An IMergableTokenLexerData that contains lexer information for the token.
LexerFlags
Gets a MergableLexerFlags indicating lexer flags for the token.
protected MergableLexerFlags LexerFlags { get; }
Property Value
- MergableLexerFlags:
A MergableLexerFlags indicating lexer flags for the token.
LexicalScope
Gets the ILexicalScope, if any, that defines the token.
public virtual ILexicalScope LexicalScope { get; }
Property Value
- ILexicalScope:
The ILexicalScope, if any, that defines the token.
Remarks
If this value is null, the token was not defined by a lexical scope.
LexicalState
Gets the ILexicalState that contains the token.
public virtual ILexicalState LexicalState { get; }
Property Value
- ILexicalState:
The ILexicalState that contains the token.
LexicalStateId
Gets the ID assigned to the lexical state.
public override int LexicalStateId { get; }
Property Value
- Int32:
The ID assigned to the lexical state.
Methods
HasFlag(MergableLexerFlags)
Returns whether the parse data has the specified MergableLexerFlags flag.
public virtual bool HasFlag(MergableLexerFlags flag)
Parameter | Type | Description |
---|---|---|
flag | MergableLexerFlags | The MergableLexerFlags to check for. |
Returns
- Boolean:
true
if the parse data has the specified MergableLexerFlags flag; otherwise,false
.
SetFlag(MergableLexerFlags, Boolean)
Sets or clears the specified MergableLexerFlags flag.
public virtual void SetFlag(MergableLexerFlags flag, bool setBit)
Parameter | Type | Description |
---|---|---|
flag | MergableLexerFlags | The MergableLexerFlags to set or clear. |
setBit | Boolean | Whether to set the flag; otherwise, the flag is cleared. |
Remarks
This method should only be called by lexers.
Inherited Members
- TokenBase.Contains(Int32)
- TokenBase.Contains(TextPosition)
- TokenBase.Equals(Object)
- TokenBase.GetHashCode()
- TokenBase.ToString()
- TokenBase.ToString(String)
- TokenBase.EndOffset
- TokenBase.EndPosition
- TokenBase.Length
- TokenBase.PositionRange
- TokenBase.StartOffset
- TokenBase.StartPosition
- TokenBase.TextRange
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetType()
- Object.MemberwiseClone()