Index: compilers/pge/PGE/Perl6Regex.pir =================================================================== --- compilers/pge/PGE/Perl6Regex.pir (revision 35590) +++ compilers/pge/PGE/Perl6Regex.pir (working copy) @@ -1190,6 +1190,11 @@ keypos += 3 $I0 -= keypos actionkey = substr target, keypos, $I0 + $I0 = index actionkey, ' ' + if $I0 < 0 goto actionok + $I0 = -$I0 + actionkey = chopn actionkey, $I0 + actionok: mob['actionkey'] = actionkey end: mob.'to'(pos) Index: t/compilers/pct/complete_workflow.t =================================================================== --- t/compilers/pct/complete_workflow.t (revision 35590) +++ t/compilers/pct/complete_workflow.t (working copy) @@ -8,7 +8,7 @@ use Test::More; -use Parrot::Test tests => 6 * 9; +use Parrot::Test tests => 8 * 9; use Parrot::Test::Util 'create_tempfile'; use Parrot::Config qw(%PConfig); @@ -25,7 +25,7 @@ Special cases in grammars and actions should be tested here. This test script builds a parser from a grammar syntax file. -After that acctions are added from a NQP class file. +After that actions are added from a NQP class file. After that the generated compiler is tested against a sample input. =cut @@ -434,6 +434,59 @@ } +{ + test_pct( 'key', <<'IN', <<'GRAMMAR', <<'ACTIONS', <<'OUT' ); +thingy +IN +token TOP { 'thingy' {*} #= key_with_trailing_space + | 'stuff' {*} #= key_for_stuff + } +GRAMMAR + +method TOP($/,$key) { + my $past := PAST::Stmts.new( + PAST::Op.new( + PAST::Val.new( + :value( ~$/ ~ " with key: '" ~ $key ~ "'" ), + :returns('String') + ), + :pirop('say'), + ) + ); + + make $past; +} +ACTIONS +thingy with key: 'key_with_trailing_space' +OUT +} + +{ + test_pct( 'key', <<'IN', <<'GRAMMAR', <<'ACTIONS', <<'OUT' ); +thingy +IN +token TOP { 'thingy' {*} #= key_with_many_trailing_spaces + | 'stuff' {*} #= key_for_stuff + } +GRAMMAR + +method TOP($/,$key) { + my $past := PAST::Stmts.new( + PAST::Op.new( + PAST::Val.new( + :value( ~$/ ~ " with key: '" ~ $key ~ "'" ), + :returns('String') + ), + :pirop('say'), + ) + ); + + make $past; +} +ACTIONS +thingy with key: 'key_with_many_trailing_spaces' +OUT +} =head1 AUTHOR Bernhard Schmalhofer