public static Parser <ResultInfo <T> > WithInfo <T>(this Parser <T> self) => context =>
        {
            var result = self(context);
            if (result.HasValue)
            {
                var location = new PositionRange(context.ConsumedTo, result.Context.ConsumedTo);

                var info = new ResultInfo <T>(result.Value, result.Description, location);
                return(Result.WithValue(info, result.Description, result.Context, result.Errors));
            }

            return(Result.WithoutValue <ResultInfo <T> >(result.Description, result.Context, result.Errors));
        };
 public ResultInfo(T value, string description, PositionRange position)
 {
     Value       = value;
     Description = description;
     Position    = position;
 }
 public ParseError(PositionRange position, string message)
     : this(position, message, null)
 {
 }
 public ParseError(PositionRange position, string message, IEnumerable <ParseError> errors)
 {
     Position = position;
     Message  = message;
     Errors   = (errors ?? new ParseError[0]).ToArray();
 }