Table of Contents

Interface IGrammarProvider

Namespace
Farkle.Grammars
Assembly
Farkle.dll

Exposes a Grammar and enables performing certain grammar operations without materializing a Grammar instance.

public interface IGrammarProvider
Extension Methods

Remarks

This interface is trivially implemented by Grammar. Its purpose is to allow trimming the grammar binary blob and reader code if only a subset of the grammar is needed, but this is not implemented in this version of Farkle.

Methods

GetGrammar()

Gets the Grammar this IGrammarProvider holds.

Grammar GetGrammar()

Returns

Grammar

GetSymbolFromSpecialName(string, bool)

Looks up a token symbol or nonterminal with the specified special name.

EntityHandle GetSymbolFromSpecialName(string specialName, bool throwIfNotFound = false)

Parameters

specialName string

The symbol's special name.

throwIfNotFound bool

Whether to throw an exception if the symbol was not found. Defaults to .

Returns

EntityHandle

An EntityHandle containing either a TokenSymbolHandle or a NonterminalHandle pointing to the symbol with the specified special name, or pointing to nothing if the symbol was not found and throwIfNotFound has a value of false.

Remarks

Special names are intended to be used on token symbols that will be emitted by custom tokenizers. Because symbol names are not guaranteed to be unique, a special name provides a guaranteed way to retrieve the handle for a specific symbol.

Exceptions

ArgumentNullException

specialName is null.

KeyNotFoundException

The symbol was not found and throwIfNotFound had a value of true.