示例#1
0
            public static Parser <T> Phrase <T>(Parser <T> p)
            {
                var phrase = WhiteSpaceParser.Opt().Drop(p.DropRight(WhiteSpaceParser.Opt()));

                return(new Parser <T>(reader => {
                    return phrase.Parse(reader).SelectMany((v, reader2) =>
                                                           reader2.Eof ? new Success <T>(v, reader2) as IParseResult <T> : new Failure <T>("Input is longer than a phrase", reader2));
                }));
            }
示例#2
0
 public static Parser <string> Regex(string pattern)
 {
     return(WhiteSpaceParser.Opt().Drop(BuildParserFromRegex(pattern)));
 }
示例#3
0
 public static Parser <string> String(string s)
 {
     return(WhiteSpaceParser.Opt().Drop(BuildParserFromString(s)));
 }