public static ICriteriaNode <CoStarterResult> TryParse(string source) { var it = new SymbolIterator(ConvertToTokens(source).ConvertToSymbols().GetEnumerator()); var parser = new ListParser <CoStarterResult>(new CoStarterCriteriaParser()); try { var node = new OrCriteriaNode <CoStarterResult>(parser.Parse(it)); if (it.HasValue) { throw new UnexpectedSymbolException(it.GetAndNext()); } return(node); } catch (Exception e) { throw new Exception($"{e.Message}{Environment.NewLine}{it.GetUsedSymbols()}<-"); } }
public IndividualCriteriaNode(IVsCriteriaNode ivs, NatureCriteriaNode nature, HiddenPowerCriteriaNode[] hiddenPower) { if (ivs == null && nature == null && hiddenPower == null) { throw new Exception("空のオブジェクトは許可されていません"); } if (ivs != null) { this.ivs = ivs; } if (nature != null) { this.nature = nature; } if (hiddenPower != null) { this.hp = new OrCriteriaNode <GCIndividual, HiddenPowerCriteriaNode>(hiddenPower); } }
public CoStarterCriteriaNode(IDCriteriaNode[] id, IndividualCriteriaNode[] umbreon, IndividualCriteriaNode[] espeon) { if (id == null && umbreon == null && espeon == null) { throw new Exception(); } if (id != null) { this.id = new OrCriteriaNode <CoStarterResult, IDCriteriaNode>(id); } if (umbreon != null) { this.umbreon = new OrCriteriaNode <GCIndividual, IndividualCriteriaNode>(umbreon); } if (espeon != null) { this.espeon = new OrCriteriaNode <GCIndividual, IndividualCriteriaNode>(espeon); } }