# New Ticket Created by Nuno Carvalho # Please include the string: [perl #40191] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40191 >
Hi all, After some suggestions made by particle on #parrot here's the patch to implement some changes to file 't/compilers/pge/06-grammar.t': - removed \t spacing - reorganized comments - added author section You can find the patch attached to this message as '06-grammar.t.patch'. Thank you, ./smash
Index: t/compilers/pge/06-grammar.t =================================================================== --- t/compilers/pge/06-grammar.t (revision 14187) +++ t/compilers/pge/06-grammar.t (working copy) @@ -11,10 +11,9 @@ t/compilers/pge/06-grammar.t - test some simple grammars - =head1 SYNOPSIS - % prove t/compilers/pge/06-grammar.t +% prove t/compilers/pge/06-grammar.t =head1 DESCRIPTION @@ -24,55 +23,53 @@ my $SUB = <<'SUB'; .sub _match_expr - .param string grammar - .param string expr - .local pmc p6regex, code, parse, match - load_bytecode 'PGE.pbc' - load_bytecode 'compilers/pge/pgc.pir' + .param string grammar + .param string expr + .local pmc p6regex, code, parse, match + load_bytecode 'PGE.pbc' + load_bytecode 'compilers/pge/pgc.pir' - p6regex = compreg 'PGE::P6Grammar' - code = p6regex(grammar) - $P0 = compreg 'PIR' - $P1 = $P0(code) - parse = find_global "Simple::Test", "main" - match = parse(expr) - say match + p6regex = compreg 'PGE::P6Grammar' + code = p6regex(grammar) + $P0 = compreg 'PIR' + $P1 = $P0(code) + parse = find_global "Simple::Test", "main" + match = parse(expr) + say match .end SUB -# test 1 -# simple token/rule match -pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple grammar test #1'); +# test #1 +pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple token/rule match'); .sub main :main - .local string expr, simple_grammar - simple_grammar = <<'EOF_SIMPLE_GRAMMAR' + .local string expr, simple_grammar + simple_grammar = <<'EOF_SIMPLE_GRAMMAR' grammar Simple::Test; rule main { <number> } token number { \d+ } EOF_SIMPLE_GRAMMAR - expr = "1313" - _match_expr(simple_grammar,expr) + expr = "1313" + _match_expr(simple_grammar,expr) .end CODE 1313 OUTPUT -# test 2 -# simple token/rule match with constant chars -pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple grammar test #2'); +# test #2 +pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple token/rule match with constant chars'); .sub main :main - .local string expr, simple_grammar - simple_grammar = <<'EOF_SIMPLE_GRAMMAR' + .local string expr, simple_grammar + simple_grammar = <<'EOF_SIMPLE_GRAMMAR' grammar Simple::Test; rule main { \[ <number> \] } token number { \d+ } EOF_SIMPLE_GRAMMAR - expr = "[1313]" - _match_expr(simple_grammar,expr) - expr = "[ 1313 ]" - _match_expr(simple_grammar,expr) - expr = " [ 1313 ] " - _match_expr(simple_grammar,expr) + expr = "[1313]" + _match_expr(simple_grammar,expr) + expr = "[ 1313 ]" + _match_expr(simple_grammar,expr) + expr = " [ 1313 ] " + _match_expr(simple_grammar,expr) .end CODE [1313] @@ -80,24 +77,23 @@ [ 1313 ] OUTPUT -# test 3 -# simple token/rule match with repetition using '*' -pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple grammar test #3'); +# test #3 +pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple token/rule match with repetition using *'); .sub main :main - .local string expr, simple_grammar - simple_grammar = <<'EOF_SIMPLE_GRAMMAR' + .local string expr, simple_grammar + simple_grammar = <<'EOF_SIMPLE_GRAMMAR' grammar Simple::Test; rule main { [<number> <?ws>]* } token number { \d+ } EOF_SIMPLE_GRAMMAR - expr = "" - _match_expr(simple_grammar,expr) - expr = "11" - _match_expr(simple_grammar,expr) - expr = "11 12 13" - _match_expr(simple_grammar,expr) - expr = " 11 12 13 14" - _match_expr(simple_grammar,expr) + expr = "" + _match_expr(simple_grammar,expr) + expr = "11" + _match_expr(simple_grammar,expr) + expr = "11 12 13" + _match_expr(simple_grammar,expr) + expr = " 11 12 13 14" + _match_expr(simple_grammar,expr) .end CODE @@ -106,39 +102,40 @@ 11 12 13 14 OUTPUT -# test 4 -# another simple token/rule match with repetition using '*' -pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple grammar test #4', todo=>'need PGE fixes to work'); +# test #4 +SKIP: { + skip ('needs some PGE fixes to pass',1); +pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'another simple token/rule match with repetition using *'); .sub main :main - .local string expr, simple_grammar - simple_grammar = <<'EOF_SIMPLE_GRAMMAR' + .local string expr, simple_grammar + simple_grammar = <<'EOF_SIMPLE_GRAMMAR' grammar Simple::Test; rule main { [<number> ]* } token number { \d+ } EOF_SIMPLE_GRAMMAR - expr = "11 12 13" - _match_expr(simple_grammar,expr) + expr = "11 12 13" + _match_expr(simple_grammar,expr) .end CODE 11 12 13 OUTPUT +} -# test 5 -# simple token/rule match with repetition using '+' -pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple grammar test #5'); +# test #5 +pir_output_is($SUB . <<'CODE', <<'OUTPUT', 'simple token/rule match with repetition using +'); .sub main :main - .local string expr, simple_grammar - simple_grammar = <<'EOF_SIMPLE_GRAMMAR' + .local string expr, simple_grammar + simple_grammar = <<'EOF_SIMPLE_GRAMMAR' grammar Simple::Test; rule main { [<number> <?ws>]+ } token number { \d+ } EOF_SIMPLE_GRAMMAR - expr = "11" - _match_expr(simple_grammar,expr) - expr = "11 12 13" - _match_expr(simple_grammar,expr) - expr = " 11 12 13 14" - _match_expr(simple_grammar,expr) + expr = "11" + _match_expr(simple_grammar,expr) + expr = "11 12 13" + _match_expr(simple_grammar,expr) + expr = " 11 12 13 14" + _match_expr(simple_grammar,expr) .end CODE 11 @@ -148,3 +145,10 @@ # number of tests to run BEGIN { plan tests => 5; } + +=head1 AUTHOR + +Nuno 'smash' Carvalho <[EMAIL PROTECTED]> + +=cut +