Ticket #177: delspace.patch

File delspace.patch, 2.6 KB (added by riffraff, 13 years ago)

patch to reomve trailing whitespace on a action key

  • compilers/pge/PGE/Perl6Regex.pir

     
    11901190    keypos += 3 
    11911191    $I0 -= keypos 
    11921192    actionkey = substr target, keypos, $I0 
     1193    $I0 = index actionkey, ' ' 
     1194    if $I0 < 0 goto actionok 
     1195    $I0 = -$I0 
     1196    actionkey = chopn actionkey, $I0 
     1197  actionok:  
    11931198    mob['actionkey'] = actionkey 
    11941199  end: 
    11951200    mob.'to'(pos) 
  • t/compilers/pct/complete_workflow.t

     
    88 
    99use Test::More; 
    1010 
    11 use Parrot::Test tests => 6 * 9; 
     11use Parrot::Test tests => 8 * 9; 
    1212use Parrot::Test::Util 'create_tempfile'; 
    1313use Parrot::Config qw(%PConfig); 
    1414 
     
    2525Special cases in grammars and actions should be tested here. 
    2626 
    2727This test script builds a parser from a grammar syntax file. 
    28 After that acctions are added from a NQP class file. 
     28After that actions are added from a NQP class file. 
    2929After that the generated compiler is tested against a sample input. 
    3030 
    3131=cut 
     
    434434} 
    435435 
    436436 
     437{ 
     438    test_pct( 'key', <<'IN', <<'GRAMMAR', <<'ACTIONS', <<'OUT' ); 
     439thingy 
     440IN 
     441token TOP   { 'thingy' {*}  #= key_with_trailing_space  
     442            | 'stuff'  {*}  #= key_for_stuff 
     443            } 
     444GRAMMAR 
     445 
     446method TOP($/,$key) { 
     447    my $past  := PAST::Stmts.new( 
     448                     PAST::Op.new( 
     449                         PAST::Val.new( 
     450                             :value( ~$/ ~ " with key: '" ~ $key ~ "'" ), 
     451                             :returns('String') 
     452                         ), 
     453                         :pirop('say'), 
     454                     ) 
     455                 ); 
     456 
     457    make $past; 
     458} 
     459ACTIONS 
     460thingy with key: 'key_with_trailing_space' 
     461OUT 
     462} 
     463 
     464{ 
     465    test_pct( 'key', <<'IN', <<'GRAMMAR', <<'ACTIONS', <<'OUT' ); 
     466thingy 
     467IN 
     468token TOP   { 'thingy' {*}  #= key_with_many_trailing_spaces    
     469            | 'stuff'  {*}  #= key_for_stuff 
     470            } 
     471GRAMMAR 
     472 
     473method TOP($/,$key) { 
     474    my $past  := PAST::Stmts.new( 
     475                     PAST::Op.new( 
     476                         PAST::Val.new( 
     477                             :value( ~$/ ~ " with key: '" ~ $key ~ "'" ), 
     478                             :returns('String') 
     479                         ), 
     480                         :pirop('say'), 
     481                     ) 
     482                 ); 
     483 
     484    make $past; 
     485} 
     486ACTIONS 
     487thingy with key: 'key_with_many_trailing_spaces' 
     488OUT 
     489} 
    437490=head1 AUTHOR 
    438491 
    439492Bernhard Schmalhofer <Bernhard.Schmalhofer@gmx.de>