Skip to content

Commit

Permalink
Add a few things being used in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Aug 29, 2010
1 parent 374a6f6 commit c11ed71
Show file tree
Hide file tree
Showing 4 changed files with 6,122 additions and 0 deletions.
15 changes: 15 additions & 0 deletions t/DEBUG.pm6
@@ -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;

48 changes: 48 additions & 0 deletions t/JsonTinyG.pl
@@ -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

0 comments on commit c11ed71

Please sign in to comment.