public void Chain_SucceedingSequence_ReturnsLastResults() { var parser = Parse.Chain(Chars.Char('x'), Chars.Char('y'), Chars.Char('z')); var result = parser.Parse("xyz"); ParseAssert.ValueEquals('z', result); }
public void Chain_FailingSequence_ReturnsError() { var parser = Parse.Chain(Chars.Char('x'), Chars.Char('y'), Chars.Char('z')); var result = parser.Parse("xy"); ParseAssert.IsError(result); }
/// <summary> /// Succeeds if the current character is a CR ('\r'), followed by an LF ('\n'). /// Returns the line feed. /// </summary> public static IParser <char> CrLf() { return(Parse.Chain(CarriageReturn(), LineFeed()) .Label(() => "Expected CRLF")); }
public void Chain_ParsersNull_ThrowsException() { Parse.Chain <Unit>(null); }