private Rule(StatementType name, Production production, Collect collect, Func <dynamic[], dynamic> gathererFn) { Name = name; Production = production; Collect = collect; GathererFn = gathererFn ?? (p => null); if (!(Production[0] is Production.Epsilon) && gathererFn == null) { throw new Exception($"no gatherer for non-epsilon rule {this}"); } }
public static Rule Of(StatementType name, Production production, Collect collect, Func <dynamic[], dynamic> gathererFn) { return(new Rule(name, production, collect, gathererFn)); }