Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Parser Custom(Regex pattern, Func<Match, Node> map)
- {
- if (pattern == null) throw new ArgumentNullException("pattern");
- return text =>
- {
- var m = Consume(ref text, pattern);
- if (m == null) return ParseResult.Failure(text, pattern.ToString());
- return ParseResult.Success(map(m), text);
- };
- }
- public static Parser Custom(string uncompiledPattern, Func<Match, Node> map)
- {
- return Custom(new Regex(uncompiledPattern, _RegexOpts), map);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement