Table of Contents

Class SyntaxError

Namespace
Farkle.Diagnostics
Assembly
Farkle.dll

Contains information about a syntax error.

public sealed class SyntaxError : ISpanFormattable, IFormattable
Inheritance
SyntaxError
Implements

Remarks

A syntax error occurs when the parser encounters a token in an unexpected place.

Constructors

SyntaxError(string?, ImmutableArray<string?>, int)

Creates a SyntaxError.

public SyntaxError(string? actualTokenName, ImmutableArray<string?> expectedTokenNames, int parserState = -1)

Parameters

actualTokenName string

The value of ActualTokenName.

expectedTokenNames ImmutableArray<string>

The value of ExpectedTokenNames.

parserState int

The value of ParserState. Optional, defaults to -1.

Properties

ActualTokenName

The name of the token found by the parser, or null if the end of the input was reached.

public string? ActualTokenName { get; }

Property Value

string

Remarks

A value of null indicates that the parser encountered the end of the input.

ExpectedTokenNames

The names of the tokens that the parser expected to find.

public ImmutableArray<string?> ExpectedTokenNames { get; }

Property Value

ImmutableArray<string>

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

int

Methods

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.