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; }
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"); }
public static IEither <T, ParseError> Error <T>(IInputReader input, Func <string> messageFn, ParseError innerError) { return(Error <T>(new ParseError(input.GetPosition(), messageFn, innerError))); }
public static IEither <T, ParseError> Error <T>(ParseError error) { return(Either.Error <T, ParseError>(error)); }