Created
April 26, 2012 03:14
-
-
Save plioi/2495421 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Json.Rule = | |
Choice(True, False, Null, Number, Quotation, Dictionary, Array); | |
Dictionary.Rule = | |
from pairs in Between(Token("{"), ZeroOrMore(Pair, Token(",")), Token("}")) | |
select ToDictionary(pairs); | |
Pair.Rule = | |
from key in Quotation | |
from colon in Token(":") | |
from value in Json | |
select new KeyValuePair<string, object>(key, value); | |
Array.Rule = | |
from items in Between(Token("["), ZeroOrMore(Json, Token(",")), Token("]")) | |
select items.ToArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment