Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a few things being used in testing
- Loading branch information
Showing
4 changed files
with
6,122 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
my module DEBUG; | ||
our constant autolexer is export = 1; | ||
our constant symtab is export = 2; | ||
our constant fixed_length is export = 4; | ||
our constant fates is export = 8; | ||
our constant longest_token_pattern_generation is export = 16; | ||
our constant EXPR is export = 32; | ||
our constant matchers is export = 64; | ||
our constant trace_call is export = 128; | ||
our constant cursors is export = 256; | ||
our constant try_processing is export = 1024; | ||
our constant mixins is export = 2048; | ||
our constant callm_show_subnames is export = 16384; | ||
our constant use_color is export = 32768; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
grammar JSONGrammar { | ||
rule TOP { [<object> |<array> ] { say "parsed {$/.pos} chars" } } | ||
rule object {'{' <pairlist> '}' } | ||
rule pairlist { [ <pair> [ \, <pair> ]* ]? } | ||
rule pair { <string> ':' <value> } | ||
rule array {'[' [ <value> [ \, <value> ]* ]? ']' } | ||
|
||
proto token value {*} | ||
token value:sym<number> { | ||
'-'? | ||
[ 0 | <[1..9]> <[0..9]>* ] | ||
[ \. <[0..9]>+ ]? | ||
[ <[eE]> [\+|\-]? <[0..9]>+ ]? | ||
} | ||
token value:sym<true> { <sym> } | ||
token value:sym<false> { <sym> } | ||
token value:sym<null> { <sym> } | ||
token value:sym<object> { <object> } | ||
token value:sym<array> { <array> } | ||
token value:sym<string> { <string> } | ||
|
||
token string { | ||
\" [ <str> | \\ <str_escape> ]* \" | ||
} | ||
|
||
token str { | ||
[ | ||
<!before \t> | ||
<!before \n> | ||
<!before \\> | ||
<!before \"> | ||
. | ||
]+ | ||
# <-["\\\t\n]>+ | ||
} | ||
|
||
token xdigit { | ||
<[0..9 a..f A..F]> | ||
} | ||
|
||
token str_escape { | ||
<["\\/bfnrt]> | u <xdigit> <xdigit> <xdigit> <xdigit> | ||
} | ||
} | ||
|
||
JSONGrammar.parse($*IN.slurp) | ||
|
||
# vim: ft=perl6 |
Oops, something went wrong.