-
-
Save dockimbel/47e9578d910d2be60dea to your computer and use it in GitHub Desktop.
JSON minminal 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment