protected void ContractTo(BnfiTermCollection target) { if (!this.IsContractible) { GrammarHelper.ThrowGrammarErrorException(GrammarErrorLevel.Error, "This collection should not be a right-value: {0}", this.Name); } if (!this.listKind.HasValue) { GrammarHelper.ThrowGrammarErrorException(GrammarErrorLevel.Error, "Right-value collection has not been initialized: {0}", this.Name); } // note: target.RuleRaw is set and target.SetState is called by _MakePlusRule/_MakeStarRule if (this.listKind == ListKind.Plus) { _MakePlusRule(target, this.delimiter, this.element); } else if (this.listKind == ListKind.Star) { _MakeStarRule(target, this.delimiter, this.element); } else { throw new InvalidOperationException(string.Format("Unknown listKind: {0}", this.listKind)); } this.RuleRaw = null; this.ClearState(); this.hasBeenContracted = true; }
protected static BnfiTermCollection _MakeStarRule(BnfiTermCollection bnfiTermCollection, BnfTerm delimiter, BnfTerm element) { bnfiTermCollection.SetState(ListKind.Star, element, delimiter); Irony.Parsing.Grammar.CurrentGrammar.MakeStarRule(bnfiTermCollection, delimiter, element); bnfiTermCollection.CheckAfterRuleHasBeenSetThatChildrenAreNotContracted(); return(bnfiTermCollection); }
public static BnfiTermCollection <TCollectionType, TElementType> PlusList <TCollectionType, TElementType>(BnfTerm bnfTermElement, BnfTerm delimiter = null) where TCollectionType : ICollection <TElementType>, new() { var bnfiTermCollection = BnfiTermCollection <TCollectionType, TElementType> .CreateContractible(); MakePlusRule(bnfiTermCollection, delimiter, bnfTermElement); return(bnfiTermCollection); }
internal static BnfiTermCollection <TCollectionType, TElementType> MakeStarRule <TCollectionType, TElementType>(BnfiTermCollection <TCollectionType, TElementType> bnfiTermCollection, BnfTerm delimiter, IBnfiTerm <TElementType> element) where TCollectionType : ICollection <TElementType>, new() { return((BnfiTermCollection <TCollectionType, TElementType>)_MakeStarRule(bnfiTermCollection, delimiter, element.AsBnfTerm())); }
internal static BnfiTermCollection <TCollectionType, TElementType> MakePlusRule <TCollectionType, TElementType>(BnfiTermCollection <TCollectionType, TElementType> bnfiTermCollection, BnfTerm delimiter, BnfTerm element) where TCollectionType : ICollection <TElementType>, new() { return((BnfiTermCollection <TCollectionType, TElementType>)_MakePlusRule(bnfiTermCollection, delimiter, element)); }
public static BnfiTermCollectionTL MakeStarRule(BnfiTermCollectionTL bnfiTermCollection, BnfTerm delimiter, BnfTerm element) { return(BnfiTermCollection.MakeStarRule(bnfiTermCollection, delimiter, element)); }
public static BnfiTermCollection <TCollectionType, TElementType> MakeStarRule <TCollectionType, TElementType>(BnfiTermCollection <TCollectionType, TElementType> bnfiTermCollection, BnfTerm delimiter, IBnfiTerm <TElementType> element) where TCollectionType : ICollection <TElementType>, new() { return(BnfiTermCollection.MakeStarRule(bnfiTermCollection, delimiter, element)); }
public static BnfiTermCollectionTL StarListTL(this BnfTerm bnfTermElement, BnfTerm delimiter = null) { return(BnfiTermCollection.StarListTL(bnfTermElement, delimiter)); }
public static BnfiTermCollection <List <TElementType>, TElementType> PlusList <TElementType>(this BnfTerm bnfTermElement, BnfTerm delimiter = null) { return(BnfiTermCollection.PlusList <TElementType>(bnfTermElement, delimiter)); }
public static BnfiTermCollection <TCollectionType, TElementType> PlusList <TCollectionType, TElementType>(this BnfTerm bnfTermElement, BnfTerm delimiter = null) where TCollectionType : ICollection <TElementType>, new() { return(BnfiTermCollection.PlusList <TCollectionType, TElementType>(bnfTermElement, delimiter)); }
public static BnfiTermCollection <List <TElementType>, TElementType> StarList <TElementType>(this IBnfiTerm <TElementType> bnfTermElement, BnfTerm delimiter = null) { return(BnfiTermCollection.StarList(bnfTermElement, delimiter)); }
public static BnfiTermCollectionTL PlusListTL(this BnfTerm bnfTermElement, Type elementType, BnfTerm delimiter = null) { return(BnfiTermCollection.PlusListTL(elementType, bnfTermElement, delimiter)); }