コード例 #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));
 }