Class AdHocGrammar
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
Rulethe 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
Rules
Gets a collection of all rules in this grammar
public override IEnumerable<Rule> Rules { get; }
Property Value
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
GrammarContexta context to resolve the root rule
Returns
- Rule
the root rule for this grammar