private static Parser <Json> JsonRoot(ParsersBase p) { return(p.Whitespace().SkipL( () => JsonObject(p) | (() => JsonArray(p)) | (() => p.Fail <Json>("expected an object or an array")))); }
public Parser <NamedTemplate> NamedTemplate() { return(Name().Bind( n => (Template(string.Empty) | (() => _p.Fail <Template>("template"))).Bind( t => End().BindIgnoringLeft( _p.Whitespace().BindIgnoringLeft( Parser.Return(new NamedTemplate(n, t))))))); }
private static Parser <IEnumerable <string> > ColumnTitlesParser(ParsersBase p) { var beginLineCommentParser = p.Token(p.String("#")); var commaParser = p.Token(p.String(",")); var columnTitleParser = p.Token(p.Quoted() | (() => p.R(@"(\w+)"))); return(p.Whitespace() .SkipL( () => beginLineCommentParser.SkipL( () => columnTitleParser.SepBy(commaParser)))); }