private void CreateProductions() { _lastItemId = 0; //CheckWrapTailHints() method may add non-terminals on the fly, so we have to use for loop here (not foreach) foreach (var nt in _grammarData.NonTerminals) { nt.Productions.Clear(); //Get data (sequences) from both Rule and ErrorRule var allData = new BnfExpressionData(); allData.AddRange(nt.Rule.Data); if (nt.ErrorRule != null) { allData.AddRange(nt.ErrorRule.Data); } //actually create productions for each sequence foreach (var prodOperands in allData) { var prod = CreateProduction(nt, prodOperands); nt.Productions.Add(prod); } } }
public BnfExpression() : base(null) { Data = new BnfExpressionData(); Data.Add(new BnfTermList()); }