18 lines
655 B
C#
18 lines
655 B
C#
namespace GParse;
|
|
|
|
/// <summary>
|
|
/// An anonymous text input provider. This allows you to defer the capture of the input string until the time of parsing.
|
|
/// </summary>
|
|
/// <param name="textCaptureFunc">A function that returns the string to use as input in an ITextParser.</param>
|
|
/// <example>
|
|
/// ITextInputProvider deferredInputProvider = new(console => console.ReadLine());
|
|
/// (new SplitTextParser(" "))
|
|
/// .Parse()
|
|
/// .ToList()
|
|
/// .ForEach(s => Console.WriteLine(s));
|
|
/// </example>
|
|
public class AnonDelimitedTextInputProvider(Func<string> textCaptureFunc) : ITextInputProvider
|
|
{
|
|
public string GetText() => textCaptureFunc();
|
|
}
|