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