Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:13:32 +09:30
commit 7345f42201
470 changed files with 51966 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
namespace Sprache
{
partial class Parse
{
/// <summary>
/// \n or \r\n
/// </summary>
public static Parser<string> LineEnd =
(from r in Char('\r').Optional()
from n in Char('\n')
select r.IsDefined ? r.Get().ToString() + n : n.ToString())
.Named("LineEnd");
/// <summary>
/// line ending or end of input
/// </summary>
public static Parser<string> LineTerminator =
Return("").End()
.Or(LineEnd.End())
.Or(LineEnd)
.Named("LineTerminator");
/// <summary>
/// Parser for identifier starting with <paramref name="firstLetterParser"/> and continuing with <paramref name="tailLetterParser"/>
/// </summary>
public static Parser<string> Identifier(Parser<char> firstLetterParser, Parser<char> tailLetterParser)
{
return
from firstLetter in firstLetterParser
from tail in tailLetterParser.Many().Text()
select firstLetter + tail;
}
}
}