CanonSharp/CanonSharp.Combinator/Text/TextParserExtensions.cs

15 lines
509 B
C#
Raw Normal View History

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);
}