jackfiled
3ed8bf5d36
All checks were successful
Run unit test / Unit-Test (push) Successful in 41s
Reviewed-on: https://git.bupt-hpc.cn/jackfiled/CanonSharp/pulls/2 Co-authored-by: jackfiled <xcrenchangjun@outlook.com> Co-committed-by: jackfiled <xcrenchangjun@outlook.com>
25 lines
875 B
C#
25 lines
875 B
C#
using CanonSharp.Combinator.Abstractions;
|
|
|
|
namespace CanonSharp.Combinator.Results;
|
|
|
|
/// <summary>
|
|
/// 消息类型的失败解析结果
|
|
/// </summary>
|
|
/// <param name="message">解析失败的消息</param>
|
|
/// <param name="state">当前读取的状态</param>
|
|
/// <typeparam name="TToken">输入流的类型</typeparam>
|
|
/// <typeparam name="TState">读取状态类型</typeparam>
|
|
/// <typeparam name="T">解析结果的类型</typeparam>
|
|
internal sealed class FailedResultWithMessage<TToken, TState, T>(string message, TState state) : FailedResult<TToken, T>
|
|
where TState : IReadState<TToken, TState>
|
|
{
|
|
public override IReadState<TToken> State => state;
|
|
|
|
public override string Message => message;
|
|
|
|
public override FailedResult<TToken, TNext> Convert<TNext>()
|
|
{
|
|
return new FailedResultWithMessage<TToken, TState, TNext>(message, state);
|
|
}
|
|
}
|