Changeset 5418


Ignore:
Timestamp:
06/20/09 10:00:31 (3 years ago)
Author:
azawawi
Message:

[Perl 6] a more complete list of flow control keywords; and insert routine quick fix is now working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre-Plugin-Perl6/lib/Padre/Plugin/Perl6/Perl6Document.pm

    r5417 r5418  
    230230                 
    231231                my $routine_name = $1; 
    232                 #XXX-add more control keywords 
    233                 my @keywords = ('if','unless','loop','for'); 
    234                 foreach my $keyword (@keywords) { 
     232                #flow control keywords 
     233                my @flow_control_keywords = ( 
     234                    'for', 'given', 'if', 'loop', 'repeat',  
     235                    'unless', 'until', 'when', 'while', 
     236                ); 
     237                foreach my $keyword (@flow_control_keywords) { 
    235238                    if($keyword eq $routine_name) { 
    236239                        Wx::Event::EVT_MENU( 
    237240                            $main,  
    238                             $menu->Append( -1, sprintf( Wx::gettext("Did u mean if (...) { }?"), $keyword) ), 
     241                            $menu->Append( -1,  
     242                                sprintf(  
     243                                    Wx::gettext("Insert a space after $keyword?"),  
     244                                    $keyword 
     245                                )), 
    239246                            sub {  
    240247                                #XXX-implement add space before brace 
     
    249256                    $menu->Append( -1, sprintf( Wx::gettext("Insert routine '%s'"), $routine_name) ), 
    250257                    sub {  
    251                         #XXX-implement insert routine 
     258                        #Insert an empty routine definition before the current line 
     259                        my $line_start = $editor->PositionFromLine( $current_line_no ); 
     260                        $editor->InsertText($line_start,  
     261                            "sub $routine_name {$new_line\t#XXX-implement$new_line}$new_line"); 
    252262                    }, 
    253263                ); 
Note: See TracChangeset for help on using the changeset viewer.