use v6; unit grammar JSON::Tiny::Grammar; token TOP { \s* \s* } rule object { '{' ~ '}' } rule pairlist { * % \, } rule pair { ':' } rule array { '[' ~ ']' } rule arraylist { * % [ \, ] } proto token value {*}; token value:sym { '-'? [ 0 | <[1..9]> <[0..9]>* ] [ \. <[0..9]>+ ]? [ <[eE]> [\+|\-]? <[0..9]>+ ]? } token value:sym { }; token value:sym { }; token value:sym { }; token value:sym { }; token value:sym { }; token value:sym { } token string { # see https://github.com/moritz/json/issues/25 (:ignoremark '"') ~ \" [ | \\ ]* } token str { <-["\\\t\x[0A]]>+ } token str_escape { <["\\/bfnrt]> | 'u' + % '\u' } token utf16_codepoint { <.xdigit>**4 } # vim: ft=perl6