A lot of work to the manual for 0.3.
[gazelle.git] / sketches / json.gzl
blob3241f8e2b23fdee78e5f357ee6c0603622a0c8ae
2 // Grammar for JSON, as defined at json.org.
4 @start object;
6 object   -> "{" (string ":" value) *(,) "}";
7 array    -> "[" value *(,)              "]";
9 str_frag -> .chars=/[^\\"]+/ |
10             .unicode_char=/\\u ([0-9A-Fa-f]{4})/ |
11             .backslash_char=/\\[ntbr"\/\\]/;
12 string   -> '"' str_frag* '"';
14 number: /(-)?
15          ( 0 | ([1-9][0-9]*) )
16          (\. [0-9]+ )?
17          ([eE] [+-]? [0-9]+ )?
18         /;
20 value    -> string | number | "true" | "false" | "null" | object | array;
22 whitespace: /[\r\n\s\t]+/;