diff options
Diffstat (limited to 'runtime/indent/ada.vim')
-rw-r--r-- | runtime/indent/ada.vim | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim index 9601181bd..8cf915dc4 100644 --- a/runtime/indent/ada.vim +++ b/runtime/indent/ada.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ada " Maintainer: Neil Bird <neil@fnxweb.com> -" Last Change: 2004 Nov 23 +" Last Change: 2006 Apr 30 " Version: $Id$ " Look for the latest version at http://vim.sourceforge.net/ " @@ -44,25 +44,25 @@ function s:MainBlockIndent( prev_indent, prev_lnum, blockstart, stop_at ) let line = substitute( getline(lnum), s:AdaComment, '', '' ) while lnum > 1 if a:stop_at != '' && line =~ '^\s*' . a:stop_at && indent(lnum) < a:prev_indent - return a:prev_indent + return a:prev_indent elseif line =~ '^\s*' . a:blockstart - let ind = indent(lnum) - if ind < a:prev_indent - return ind - endif + let ind = indent(lnum) + if ind < a:prev_indent + return ind + endif endif let lnum = prevnonblank(lnum - 1) " Get previous non-blank/non-comment-only line while 1 - let line = substitute( getline(lnum), s:AdaComment, '', '' ) - if line !~ '^\s*$' && line !~ '^\s*#' - break - endif - let lnum = prevnonblank(lnum - 1) - if lnum <= 0 - return a:prev_indent - endif + let line = substitute( getline(lnum), s:AdaComment, '', '' ) + if line !~ '^\s*$' && line !~ '^\s*#' + break + endif + let lnum = prevnonblank(lnum - 1) + if lnum <= 0 + return a:prev_indent + endif endwhile endwhile " Fallback - just move back one @@ -82,15 +82,15 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend ) while lnum > 1 if getline(lnum) =~ '^\s*' . a:blockstart let ind = indent(lnum) - if ends <= 0 - if ind < a:prev_indent + if ends <= 0 + if ind < a:prev_indent return ind - endif - else - let ends = ends - 1 + endif + else + let ends = ends - 1 endif elseif getline(lnum) =~ '^\s*' . a:blockend - let ends = ends + 1 + let ends = ends + 1 endif let lnum = prevnonblank(lnum - 1) @@ -122,25 +122,25 @@ function s:StatementIndent( current_indent, prev_lnum ) let lnum = prevnonblank(lnum - 1) " Get previous non-blank/non-comment-only line while 1 - let line = substitute( getline(lnum), s:AdaComment, '', '' ) - if line !~ '^\s*$' && line !~ '^\s*#' - break - endif - let lnum = prevnonblank(lnum - 1) - if lnum <= 0 - return a:current_indent - endif + let line = substitute( getline(lnum), s:AdaComment, '', '' ) + if line !~ '^\s*$' && line !~ '^\s*#' + break + endif + let lnum = prevnonblank(lnum - 1) + if lnum <= 0 + return a:current_indent + endif endwhile " Leave indent alone if our ';' line is part of a ';'-delineated " aggregate (e.g., procedure args.) or first line after a block start. if line =~ s:AdaBlockStart || line =~ '(\s*$' - return a:current_indent + return a:current_indent endif if line !~ '[.=(]\s*$' - let ind = indent(prev_lnum) - if ind < a:current_indent - return ind - endif + let ind = indent(prev_lnum) + if ind < a:current_indent + return ind + endif endif endwhile " Fallback - just use current one @@ -159,11 +159,11 @@ function GetAdaIndent() while 1 let line = substitute( getline(lnum), s:AdaComment, '', '' ) if line !~ '^\s*$' && line !~ '^\s*#' - break + break endif let lnum = prevnonblank(lnum - 1) if lnum <= 0 - return ind + return ind endif endwhile @@ -176,15 +176,15 @@ function GetAdaIndent() " Check for false matches to AdaBlockStart let false_match = 0 if line =~ '^\s*\(procedure\|function\|package\)\>.*\<is\s*new\>' - " Generic instantiation - let false_match = 1 + " Generic instantiation + let false_match = 1 elseif line =~ ')\s*;\s*$' || line =~ '^\([^(]*([^)]*)\)*[^(]*;\s*$' - " forward declaration - let false_match = 1 + " forward declaration + let false_match = 1 endif " Move indent in if ! false_match - let ind = ind + &sw + let ind = ind + &sw endif elseif line =~ '^\s*\(case\|exception\)\>' " Move indent in twice (next 'when' will move back) @@ -198,10 +198,10 @@ function GetAdaIndent() exe lnum exe 'normal! $F)%' if getline('.') =~ '^\s*(' - " Dire layout - use previous indent (could check for AdaComment here) - let ind = indent( prevnonblank( line('.')-1 ) ) + " Dire layout - use previous indent (could check for AdaComment here) + let ind = indent( prevnonblank( line('.')-1 ) ) else - let ind = indent('.') + let ind = indent('.') endif exe v:lnum elseif line =~ '[.=(]\s*$' @@ -227,7 +227,7 @@ function GetAdaIndent() elseif continuation && line =~ '^\s*(' " Don't do this if we've already indented due to the previous line if ind == initind - let ind = ind + &sw + let ind = ind + &sw endif elseif line =~ '^\s*\(begin\|is\)\>' let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' ) |