Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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"));
 }
Exemplo n.º 4
0
 public void Chain_ParsersNull_ThrowsException()
 {
     Parse.Chain <Unit>(null);
 }