Class LexicalError
- Namespace
- Farkle.Diagnostics
- Assembly
- Farkle.dll
Contains information about a lexical error.
public sealed class LexicalError : IParserStateInfoSupplier, ISpanFormattable, IFormattable
- Inheritance
-
LexicalError
- Implements
Remarks
A lexical error occurs when the tokenizer cannot recognize some characters as part of a token.
Constructors
LexicalError(string?, int)
Creates a LexicalError.
public LexicalError(string? tokenText, int tokenizerState = -1)
Parameters
tokenText
stringThe value of TokenText.
tokenizerState
intThe value of TokenizerState. Optional, defaults to -1.
Properties
ExpectedTokenNames
The names of the tokens that the parser expected to find.
public ImmutableArray<string?> ExpectedTokenNames { get; }
Property Value
Remarks
A value of null in the array indicates that the parser also expected the end of the input.
ParserState
The state the parser's state machine was at the time of the error.
public int ParserState { get; }
Property Value
TokenText
The characters of the token that caused the error.
public string? TokenText { get; }
Property Value
Remarks
This value might be truncated by Farkle if the token is too long or spans multiple lines.
TokenizerState
The state the tokenizer's state machine was at the time of the error.
public int TokenizerState { get; }
Property Value
Methods
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(string?, IFormatProvider?)
Formats the value of the current instance using the specified format.
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
format
stringThe format to use.
-or-
A null reference (
Nothing
in Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProvider
IFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothing
in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.