public void TryParse() { FoosMatch match; Assert.IsTrue(MatchParser.TryParse("@playerA @playerB 1-10", out match)); Assert.AreEqual("@playerB", match.Winner.Id); Assert.AreEqual("@playerA", match.Looser.Id); Assert.AreEqual(10, match.GoalsWinner); Assert.AreEqual(1, match.GoalsLooser); }
public override int VisitMatch <TOutput>(MatchParser <TInput, TOutput> parser, int start) { var len = parser.Consumer(_source, start); if (len >= 0) { _prevWasMissing = false; } return(len); }
public override Parser <TInput> VisitMatch <TOutput>(MatchParser <TInput, TOutput> parser) { state.InputLength = parser.Consumer(source, state.InputStart); if (state.InputLength >= 0) { this.prevWasMissing = false; return(null); } else { // keep prevWasMissing the same return(null); } }
public override Parser <TInput> VisitMatch <TOutput>(MatchParser <TInput, TOutput> parser) { state.InputLength = parser.Parse(source, state.InputStart, output, output.Count); return(null); }
public override Parser <TInput> VisitMatch(MatchParser <TInput> parser) { throw new System.NotImplementedException(); }
public override void VisitMatch <TOutput>(MatchParser <TInput, TOutput> parser) { WriteTerm("match()"); }
public override Parser <TInput> VisitMatch(MatchParser <TInput> parser) { state.InputLength = parser.Scan(source, state.InputStart); return(null); }
public static IEnumerable <FoosMatch> GetMatches(IEnumerable <Message> messages) { FoosMatch match = null; return(messages.Where(m => MatchParser.TryParse(m.Text, out match)).Select(m => match)); }
public override Parser <TInput> VisitMatch <TOutput>(MatchParser <TInput, TOutput> parser) { // not proven safe here because scan of MatchParser is user defined state.InputLength = parser.Scan(source, state.InputStart); return(null); }