Class Token
Represents a token identified by the SILQ tokenizer, including its type, lexeme, literal value, and line number.
public record Token : IEquatable<Token>
- Inheritance
-
Token
- Implements
- Inherited Members
Constructors
Token(TokenType, string, object, int, int)
Represents a token identified by the SILQ tokenizer, including its type, lexeme, literal value, and line number.
public Token(TokenType TokenType, string Lexeme, object Literal = null, int Line = -1, int Column = -1)
Parameters
TokenTypeTokenTypeThe type of the token.
LexemestringThe string representation of the token as found in the source code.
LiteralobjectThe literal value of the token, if applicable.
LineintThe line number where the token was found.
Columnint
Properties
Column
public int Column { get; init; }
Property Value
Lexeme
The string representation of the token as found in the source code.
public string Lexeme { get; init; }
Property Value
Line
The line number where the token was found.
public int Line { get; init; }
Property Value
Literal
The literal value of the token, if applicable.
public object Literal { get; init; }
Property Value
TokenType
The type of the token.
public TokenType TokenType { get; init; }
Property Value
Methods
ToString()
Returns a formatted string representation of the token, including its type, lexeme, and literal value.
public override string ToString()
Returns
- string
A string in the format: TokenType Lexeme Literal