Table of Contents

Class AdHocGrammar

Namespace
NMF.AnyText.Grammars
Assembly
NMF.AnyText.Core.dll

Wraps a rule (with pre-initialized dependencies) into a grammar

public class AdHocGrammar : Grammar
Inheritance
AdHocGrammar
Inherited Members

Constructors

AdHocGrammar(Rule, IEnumerable<Rule>)

Creates a new instance

public AdHocGrammar(Rule root, IEnumerable<Rule> furtherRules)

Parameters

root Rule

the rule that should be wrapped

furtherRules IEnumerable<Rule>

other rules

Properties

LanguageId

Gets the language id for this grammar

public override string LanguageId { get; }

Property Value

string

Rules

Gets a collection of all rules in this grammar

public override IEnumerable<Rule> Rules { get; }

Property Value

IEnumerable<Rule>

Methods

CreateCustomRules()

Create custom rules that are not resolvable by type

protected override IEnumerable<Rule> CreateCustomRules()

Returns

IEnumerable<Rule>

a collection of custom rules

CreateTypedRules()

Create the typed rules as a dictionary

protected override IDictionary<Type, Rule> CreateTypedRules()

Returns

IDictionary<Type, Rule>

a dictionary of rules by type

GetRootRule(GrammarContext)

Gets the root rule

protected override Rule GetRootRule(GrammarContext context)

Parameters

context GrammarContext

a context to resolve the root rule

Returns

Rule

the root rule for this grammar