// match longest, e.g. up to just before a failure protected internal override bool Match(String input, Pick.Position p) { // int bestMatch = p.index; int count = 0; for (int i = 0; i < weightedIndex.weights.Length; ++i) { if (p.IsFailure(this, i)) { break; } if (!item.Match(input, p)) { p.SetFailure(this, i); break; } // bestMatch = p.index; count++; } if (count >= minCount) { return(true); } // TODO fix failure return(false); }
// take first matching option protected internal override bool Match(String input, Pick.Position p) { for (int i = 0; i < weightedIndex.weights.Length; ++i) { if (p.IsFailure(this, i)) { continue; } if (items[i].Match(input, p)) { return(true); } p.SetFailure(this, i); } return(false); }