diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-21 03:54:03 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-21 03:54:03 -0500 |
commit | 0053be708f9114ff0853ecd151dfd7068262789b (patch) | |
tree | 1b21575780f1d24e4c519779a48c538669e0f00a | |
parent | 5da66ba2eb49d016986c975eac8c340b7c00e9c3 (diff) | |
download | vim-foldtext-0053be708f9114ff0853ecd151dfd7068262789b.tar.gz vim-foldtext-0053be708f9114ff0853ecd151dfd7068262789b.zip |
report unknown parameters better
-rw-r--r-- | vimrc | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -236,7 +236,7 @@ function Perl_foldtext() let matches = matchlist(line, \ '^\s*\(sub\|around\|before\|after\|guard\)\s*\(\w\+\)') if !empty(matches) - let linenum = v:foldstart + let linenum = v:foldstart - 1 let sub_type = matches[1] let params = [] while linenum <= v:foldend @@ -278,33 +278,35 @@ function Perl_foldtext() if !empty(rest_line) let rest_params = split(rest_line[1], ',\s*') let params += rest_params - let linenum += 1 - break + continue endif " handle 'my @args = @_;' type lines let array_line = matchlist(next_line, 'my\s*\(@\w\+\)\s*=\s*@_;') if !empty(array_line) let params += [array_line[1]] - let linenum += 1 - break + continue endif " handle 'my %args = @_;' type lines let hash_line = matchlist(next_line, 'my\s*%\w\+\s*=\s*@_;') if !empty(hash_line) let params += ['paramhash'] - let linenum += 1 - break + continue endif - " if we haven't continued yet, assume arg unpacking is done - break - endwhile + " handle unknown uses of shift + if next_line =~ '\%(shift\%(\s*@\)\@!\)' + let params += ['$unknown'] + continue + endif - if join(getline(linenum, v:foldend)) =~ '\%(shift\%(\s*@\)\@!\|@_\)' - let params += ['unknown'] - endif + " handle unknown uses of @_ + if next_line =~ '@_' + let params += ['@unknown'] + continue + endif + endwhile return Base_foldtext(sub_type . ' ' . matches[2] . \ '(' . join(params, ', ') . ')') |