예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 /// <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"));
 }
예제 #4
0
 public void Chain_ParsersNull_ThrowsException()
 {
     Parse.Chain <Unit>(null);
 }