-
-
Save Skrylar/f5d8e7f4ca93ac50bfec to your computer and use it in GitHub Desktop.
JSON toy parser for Red
This file contains 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
Red [] | |
digit-nz: charset "123456789" | |
digit: append copy digit-nz #"0" | |
hex: append copy digit "abcdefABCDEF" | |
sign: charset "+-" | |
exponent-e: charset "eE" | |
dquot: #"^"" | |
exponent: [ exponent-e opt sign some digit ] | |
decimal: [ #"." some digit ] | |
number: [ opt #"-" [ "0" | digit-nz any digit ] opt decimal opt exponent ] | |
array: [ opt [ value any ["," value] ] ] | |
value: [ string | number | array | "true" | "false" | "null" ] | |
str-escape: [ dquot | #"\" | #"/" | "b" | "f" | "n" | "r" | "t" | "u" 4 hex ] | |
string: [ dquot any [#"\" str-escape | not dquot skip ] dquot ] | |
print parse "[^"Fish bone^"]" value | |
comment [ | |
Memory error: allocate memory > 2MB (--NOT_IMPLEMENTED--) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment