CanonSharp/CanonSharp.Combinator/Text/TextParserExtensions.cs
jackfiled cf19f8197e feat: Grammar Parser (#3)
Reviewed-on: https://git.bupt-hpc.cn/jackfiled/CanonSharp/pulls/3
Co-authored-by: jackfiled <xcrenchangjun@outlook.com>
Co-committed-by: jackfiled <xcrenchangjun@outlook.com>
2024-08-18 12:01:27 +08:00

15 lines
509 B
C#

using CanonSharp.Combinator.Abstractions;
using CanonSharp.Combinator.Extensions;
using static CanonSharp.Combinator.Text.TextParserBuilder;
namespace CanonSharp.Combinator.Text;
public static class TextParserExtensions
{
public static IParser<char, T> SkipSpaces<T>(this IParser<char, T> parser)
=> Space().SkipTill(parser);
public static IParser<char, T> SkipSpaceAndLineBreak<T>(this IParser<char, T> parser)
=> (Space().Map(x => x.ToString()) | LineBreak()).SkipTill(parser);
}