using CanonSharp.Combinator.Abstractions;
namespace CanonSharp.Combinator.Parsers.Bases;
///
/// 映射解析器
/// 提供一个函数修改上游解析器返回的结果
///
/// 上游解析器
/// 修改上游解析器返回结果的
///
///
///
internal sealed class MapParser(
Parser parser,
Func func) : Parser
{
internal override ParseResult Run(TState state,
Func, ParseResult> continuation)
=> parser.Run(state, result => continuation(result.Map(func)));
}