using CanonSharp.Combinator.Abstractions;
namespace CanonSharp.Combinator.Results;
///
/// 消息类型的失败解析结果
///
/// 解析失败的消息
/// 当前读取的状态
/// 输入流的类型
/// 读取状态类型
/// 解析结果的类型
internal sealed class FailedResultWithMessage(string message, TState state)
: IFailedResult
where TState : IReadState
{
public IReadState State => state;
public string Message => message;
public IFailedResult Convert()
{
return new FailedResultWithMessage(message, state);
}
public override string ToString() => $"Parse failed: {Message}.";
}