Changeset 4170


Ignore:
Timestamp:
04/26/09 12:09:59 (3 years ago)
Author:
azawawi
Message:

Added support for Perl 6 attributes. No traits though.

File:
1 edited

Legend:

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

    r4168 r4170  
    5656        my $symbol_name = ''; 
    5757        my $symbol_line = -1; 
     58        my $symbol_suffix = ''; 
    5859        my $symbol_context = ''; 
    5960        my $context = 'GLOBAL'; 
     
    8182                } elsif($tree =~ /routine_declarator__\w+_\d+method method_def (longname|$)/) { 
    8283                    # a method 
     84                    if($buffer eq '!') { 
     85                        # private method... 
     86                        $symbol_suffix = " (private)"; 
     87                    } 
    8388                    $symbol_type = "methods"; 
    8489                    $symbol_name .= $buffer; 
     
    99104                    $symbol_name .= $buffer; 
    100105                    $symbol_line = $lineno; 
     106                } elsif($tree =~ /scope_declarator__\w+_\d+(our|my|has|state|constant) scoped declarator variable_declarator variable/) { 
     107                    # a start for an attribute declaration 
     108                    $symbol_type = "attributes"; 
     109                    $symbol_name .= $buffer; 
     110                    $symbol_line = $lineno; 
     111                    $symbol_suffix = $1; 
    101112                } else { 
    102113                    if($symbol_name ne '') { 
     
    116127                            $cur_pkg->{line} = $symbol_line; 
    117128                        } else { 
    118                             if($symbol_type eq 'methods' && $symbol_name =~ /^!/) { 
    119                                 # private method... 
    120                                 $symbol_name .= " (private)"; 
     129                            if($symbol_type eq 'attributes') { 
     130                                if($symbol_name !~ /\./) { 
     131                                    $symbol_suffix = " (private, $symbol_suffix)"; 
     132                                } else { 
     133                                    $symbol_suffix = " ($symbol_suffix)"; 
     134                                } 
    121135                            } 
     136                            $symbol_name .= $symbol_suffix; 
    122137                            push @{ $cur_pkg->{$symbol_type} }, { 
    123138                                name => $symbol_name,  
     
    128143                        $symbol_name = ''; 
    129144                        $symbol_line = -1; 
     145                        $symbol_suffix = ''; 
    130146                    } 
    131147                } 
     
    241257            ) 
    242258        ); 
    243         foreach my $type (qw(modules subroutines methods submethods macros regexes)) { 
     259        foreach my $type (qw(modules subroutines methods submethods macros regexes attributes)) { 
    244260            _add_subtree( $outlinebar, $pkg, $type, $branch ); 
    245261        } 
     
    264280 
    265281        my @sorted_entries = (); 
    266         if ( $type eq 'subroutines' || $type eq 'methods' || $type eq 'submethods' || $type eq 'macros') { 
     282        if ( $type eq 'subroutines' || $type eq 'methods' || $type eq 'submethods' || $type eq 'macros' || $type eq 'attributes') { 
    267283            my $config = Padre->ide->config; 
    268284            if ( $config->main_functions_order eq 'original' ) { 
     
    304320            $type eq 'submethods' ||  
    305321            $type eq 'macros' ||  
    306             $type eq 'regexes')  
     322            $type eq 'regexes' || 
     323            $type eq 'attributes')  
    307324        { 
    308325            $outlinebar->Expand($type_elem); 
Note: See TracChangeset for help on using the changeset viewer.