using CanonSharp.Combinator.Abstractions; namespace CanonSharp.Combinator.Results; /// /// 异常类型的失败解析结果 /// /// 解析中发生的异常 /// 当前输入流的状态 /// 输入流类型 /// 当前输入流状态的类型 /// 解析结果的类型 public class FailedResultWithException(Exception exception, TState state) : FailedResult where TState : IReadState { public override IReadState State => state; public override ParseException Exception => new(ToString(), exception); public override string Message => $"Exception occured: {exception}."; public override FailedResult Convert() => new FailedResultWithException(exception, state); }