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>
19 lines
438 B
C#
19 lines
438 B
C#
using CanonSharp.Combinator.Abstractions;
|
|
|
|
namespace CanonSharp.Combinator.Extensions;
|
|
|
|
public static class ReadStateExtensions
|
|
{
|
|
public static IEnumerable<TState> AsEnumerable<TToken, TState>(this TState source)
|
|
where TState : IReadState<TToken, TState>
|
|
{
|
|
TState current = source;
|
|
|
|
while (current.HasValue)
|
|
{
|
|
yield return current;
|
|
current = current.Next;
|
|
}
|
|
}
|
|
}
|