Esempio n. 1
0
 private static Parser <Json> JsonLiteral(ParsersBase p)
 {
     return(p.Scope(
                "literal",
                p.Token(p.String("null")).As(new JNull() as Json) |
                (() => p.Double().Map(n => new JNumber(n) as Json)) |
                (() => p.Token(p.Quoted()).Map(s => new JString(s) as Json)) |
                (() => p.Token(p.String("true")).As(new JBool(true) as Json)) |
                (() => p.Token(p.String("false")).As(new JBool(false) as Json))) |
            (() => p.Fail <Json>("expected a literal")));
 }