Table of Contents

Interface IParserStateInfoSupplier

Namespace
Farkle.Diagnostics
Assembly
Farkle.dll

Supplies information about the parser's state at the time of an error.

public interface IParserStateInfoSupplier

Remarks

This interface should be implemented by error objects that are returned by the tokenizer.

Methods

WithParserStateInfo(ImmutableArray<string?>, int)

Enriches the error with information about the parser's state.

object WithParserStateInfo(ImmutableArray<string?> expectedTokenNames, int parserState)

Parameters

expectedTokenNames ImmutableArray<string>

The names of the tokens that were expected at the time of the error. null corresponds to the end of file.

parserState int

The number of the parser's state at the time of the error.

Returns

object

An error object that contains expectedTokenNames and parserState.

Remarks

Farkle's default parser will call this method if the tokenizer returns an error whose object either implements IParserStateInfoSupplier, or is of type ParserDiagnostic and its Message implements IParserStateInfoSupplier.