Skip to content

Commit

Permalink
add new and params of new
Browse files Browse the repository at this point in the history
  • Loading branch information
neo77 committed Jul 3, 2014
1 parent 69f8008 commit 27d774d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion bin/grep-function.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
my @vars = ();
my $sub;
my @params;
my $new;
for my $line ( @lines ) {
if ( $line =~ /$pattern/o ) {
$sub = $1;
my $match = $1;
if ($line =~ /\bhas\b/ ) {
push @new, $match;
}
push @vars, $sub if $sub;
$sub = $match;
}
if ($line =~ /\$p_(\w+).+?(rq|op)\s*['"]\w+['"](?:\s*,\s*['"](\w+)['"])?(?:\s*,\s*(['"]?[^'";#]+['"]?))?(?:.*?#\s*(.+))/) {
my $definition = '';
Expand All @@ -34,6 +40,8 @@
@types = ();
}
}
push @vars, $sub if $sub;
push @vars, 'new(|'.(join '=>,|', @new ).'=>,|);Please_Redisplay' if @new;
close FH;
print $_ . "\n" for @vars;

Expand Down
6 changes: 3 additions & 3 deletions ftplugin/perl/perlomni.vim
Original file line number Diff line number Diff line change
Expand Up @@ -896,11 +896,11 @@ endf
fun! s:scanFunctionFromList(lines)
let buffile = tempname()
cal writefile(a:lines,buffile)
return split(s:system(s:vimbin.'grep-function.pl', buffile, '^\s*(?:method|sub|has)\s+(\w+)', '|', 'sort', '|', 'uniq'),"\n")
return split(s:system(s:vimbin.'grep-function.pl', buffile, '^\s*(?:method|sub|has)\s+[''"]?(\w+)[''"]?', '|', 'sort', '|', 'uniq'),"\n")
endf

fun! s:scanFunctionFromSingleClassFile(file)
return split(s:system(s:vimbin.'grep-function.pl', a:file, '^\s*(?:method|sub|has)\s+(\w+)', '|', 'sort', '|', 'uniq'),"\n")
return split(s:system(s:vimbin.'grep-function.pl', a:file, '^\s*(?:method|sub|has)\s+[''"]?(\w+)[''"]?', '|', 'sort', '|', 'uniq'),"\n")
endf

fun! s:scanFunctionFromClass(class)
Expand Down Expand Up @@ -1123,7 +1123,7 @@ cal s:rule({
\'comp': function('s:CompClassName') } )

cal s:rule({
\'context': '^\s*\(sub\|method\)\s\+' ,
\'context': '^\s*\(sub\|method|has\)\s\+' ,
\'backward': '\<\w\+$' ,
\'only':1 ,
\'comp': function('s:CompCurrentBaseFunction') })
Expand Down

0 comments on commit 27d774d

Please sign in to comment.