예제 #1
0
        public ParseError(Position position, Func <string> getMessageFn, ParseError innerError)
        {
            Throw.IfNull(position, "position");
            Throw.IfNull(getMessageFn, "getMessageFn");

            this.position     = position;
            this.getMessageFn = getMessageFn;
            this.InnerError   = innerError;
        }
예제 #2
0
        public void Label_Error_SetsInnerError()
        {
            var parser = Parse.Fail <int>("Oh noes").Label(() => "Test");
            var result = parser.Parse("");

            ParseError error = result.FromError();

            Assert.IsNotNull(error.InnerError);
            Assert.AreEqual(error.InnerError.Message, "Oh noes");
        }
예제 #3
0
 public static IEither <T, ParseError> Error <T>(IInputReader input, Func <string> messageFn, ParseError innerError)
 {
     return(Error <T>(new ParseError(input.GetPosition(), messageFn, innerError)));
 }
예제 #4
0
 public static IEither <T, ParseError> Error <T>(ParseError error)
 {
     return(Either.Error <T, ParseError>(error));
 }