�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!usr/share/vim/vim80/syntax/ada.vim000064400000031372152527415240013022 0ustar00"---------------------------------------------------------------------------- " Description: Vim Ada syntax file " Language: Ada (2005) " $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischik " David A. Wheeler " Simon Bradley " Contributors: Preben Randhol. " $Author: krischik $ " $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 " $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/syntax/ada.vim $ " http://www.dwheeler.com/vim " History: 24.05.2006 MK Unified Headers " 26.05.2006 MK ' should not be in iskeyword. " 16.07.2006 MK Ada-Mode as vim-ball " 02.10.2006 MK Better folding. " 15.10.2006 MK Bram's suggestion for runtime integration " 05.11.2006 MK Spell check for comments and strings only " 05.11.2006 MK Bram suggested to save on spaces " Help Page: help ft-ada-syntax "------------------------------------------------------------------------------ " The formal spec of Ada 2005 (ARM) is the "Ada 2005 Reference Manual". " For more Ada 2005 info, see http://www.gnuada.org and http://www.adapower.com. " " This vim syntax file works on vim 7.0 only and makes use of most of Voim 7.0 " advanced features. "------------------------------------------------------------------------------ if exists("b:current_syntax") || version < 700 finish endif let s:keepcpo= &cpo set cpo&vim let b:current_syntax = "ada" " Section: Ada is entirely case-insensitive. {{{1 " syntax case ignore " Section: Highlighting commands {{{1 " " There are 72 reserved words in total in Ada2005. Some keywords are " used in more than one way. For example: " 1. "end" is a general keyword, but "end if" ends a Conditional. " 2. "then" is a conditional, but "and then" is an operator. " for b:Item in g:ada#Keywords " Standard Exceptions (including I/O). " We'll highlight the standard exceptions, similar to vim's Python mode. " It's possible to redefine the standard exceptions as something else, " but doing so is very bad practice, so simply highlighting them makes sense. if b:Item['kind'] == "x" execute "syntax keyword adaException " . b:Item['word'] endif if b:Item['kind'] == "a" execute 'syntax match adaAttribute "\V' . b:Item['word'] . '"' endif " We don't normally highlight types in package Standard " (Integer, Character, Float, etc.). I don't think it looks good " with the other type keywords, and many Ada programs define " so many of their own types that it looks inconsistent. " However, if you want this highlighting, turn on "ada_standard_types". " For package Standard's definition, see ARM section A.1. if b:Item['kind'] == "t" && exists ("g:ada_standard_types") execute "syntax keyword adaBuiltinType " . b:Item['word'] endif endfor " Section: others {{{1 " syntax keyword adaLabel others " Section: Operatoren {{{1 " syntax keyword adaOperator abs mod not rem xor syntax match adaOperator "\" syntax match adaOperator "\" syntax match adaOperator "\" syntax match adaOperator "\" syntax match adaOperator "[-+*/<>&]" syntax keyword adaOperator ** syntax match adaOperator "[/<>]=" syntax keyword adaOperator => syntax match adaOperator "\.\." syntax match adaOperator "=" " Section: <> {{{1 " " Handle the box, <>, specially: " syntax keyword adaSpecial <> " Section: rainbow color {{{1 " if exists("g:ada_rainbow_color") syntax match adaSpecial "[:;.,]" call rainbow_parenthsis#LoadRound () call rainbow_parenthsis#Activate () else syntax match adaSpecial "[:;().,]" endif " Section: := {{{1 " " We won't map "adaAssignment" by default, but we need to map ":=" to " something or the "=" inside it will be mislabelled as an operator. " Note that in Ada, assignment (:=) is not considered an operator. " syntax match adaAssignment ":=" " Section: Numbers, including floating point, exponents, and alternate bases. {{{1 " syntax match adaNumber "\<\d[0-9_]*\(\.\d[0-9_]*\)\=\([Ee][+-]\=\d[0-9_]*\)\=\>" syntax match adaNumber "\<\d\d\=#\x[0-9A-Fa-f_]*\(\.\x[0-9A-Fa-f_]*\)\=#\([Ee][+-]\=\d[0-9_]*\)\=" " Section: Identify leading numeric signs {{{1 " " In "A-5" the "-" is an operator, " but in "A:=-5" the "-" is a sign. This " handles "A3+-5" (etc.) correctly. " This assumes that if you put a " don't put a space after +/- when it's used " as an operator, you won't " put a space before it either -- which is true " in code I've seen. " syntax match adaSign "[[:space:]<>=(,|:;&*/+-][+-]\d"lc=1,hs=s+1,he=e-1,me=e-1 " Section: Labels for the goto statement. {{{1 " syntax region adaLabel start="<<" end=">>" " Section: Boolean Constants {{{1 " Boolean Constants. syntax keyword adaBoolean true false " Section: Warn C/C++ {{{1 " " Warn people who try to use C/C++ notation erroneously: " syntax match adaError "//" syntax match adaError "/\*" syntax match adaError "==" " Section: Space Errors {{{1 " if exists("g:ada_space_errors") if !exists("g:ada_no_trail_space_error") syntax match adaSpaceError excludenl "\s\+$" endif if !exists("g:ada_no_tab_space_error") syntax match adaSpaceError " \+\t"me=e-1 endif if !exists("g:ada_all_tab_usage") syntax match adaSpecial "\t" endif endif " Section: end {{{1 " Unless special ("end loop", "end if", etc.), "end" marks the end of a " begin, package, task etc. Assiging it to adaEnd. syntax match adaEnd /\/ syntax keyword adaPreproc pragma syntax keyword adaRepeat exit for loop reverse while syntax match adaRepeat "\" syntax keyword adaStatement accept delay goto raise requeue return syntax keyword adaStatement terminate syntax match adaStatement "\" " Section: Handle Ada's record keywords. {{{1 " " 'record' usually starts a structure, but "with null record;" does not, " and 'end record;' ends a structure. The ordering here is critical - " 'record;' matches a "with null record", so make it a keyword (this can " match when the 'with' or 'null' is on a previous line). " We see the "end" in "end record" before the word record, so we match that " pattern as adaStructure (and it won't match the "record;" pattern). " syntax match adaStructure "\" contains=adaRecord syntax match adaStructure "\" contains=adaRecord syntax match adaKeyword "\" syntax match adaConditional "\" syntax match adaConditional "\" syntax match adaConditional "\" syntax match adaConditional "\" syntax match adaConditional "\" syntax keyword adaConditional if case select syntax keyword adaConditional elsif when " Section: other keywords {{{1 syntax match adaKeyword "\" contains=adaRecord syntax keyword adaKeyword all do exception in new null out syntax keyword adaKeyword separate until overriding " Section: begin keywords {{{1 " " These keywords begin various constructs, and you _might_ want to " highlight them differently. " syntax keyword adaBegin begin body declare entry generic syntax keyword adaBegin protected renames task syntax match adaBegin "\" contains=adaFunction syntax match adaBegin "\" contains=adaProcedure syntax match adaBegin "\" contains=adaPackage if exists("ada_with_gnat_project_files") syntax keyword adaBegin project endif " Section: with, use {{{1 " if exists("ada_withuse_ordinary") " Don't be fancy. Display "with" and "use" as ordinary keywords in all cases. syntax keyword adaKeyword with use else " Highlight "with" and "use" clauses like C's "#include" when they're used " to reference other compilation units; otherwise they're ordinary keywords. " If we have vim 6.0 or later, we'll use its advanced pattern-matching " capabilities so that we won't match leading spaces. syntax match adaKeyword "\" syntax match adaKeyword "\" syntax match adaBeginWith "^\s*\zs\(\(with\(\s\+type\)\=\)\|\(use\)\)\>" contains=adaInc syntax match adaSemiWith ";\s*\zs\(\(with\(\s\+type\)\=\)\|\(use\)\)\>" contains=adaInc syntax match adaInc "\" contained contains=NONE syntax match adaInc "\" contained contains=NONE syntax match adaInc "\" contained contains=NONE " Recognize "with null record" as a keyword (even the "record"). syntax match adaKeyword "\" " Consider generic formal parameters of subprograms and packages as keywords. syntax match adaKeyword ";\s*\zswith\s\+\(function\|procedure\|package\)\>" syntax match adaKeyword "^\s*\zswith\s\+\(function\|procedure\|package\)\>" endif " Section: String and character constants. {{{1 " syntax region adaString contains=@Spell start=+"+ skip=+""+ end=+"+ syntax match adaCharacter "'.'" " Section: Todo (only highlighted in comments) {{{1 " syntax keyword adaTodo contained TODO FIXME XXX NOTE " Section: Comments. {{{1 " syntax region adaComment \ oneline \ contains=adaTodo,adaLineError,@Spell \ start="--" \ end="$" " Section: line errors {{{1 " " Note: Line errors have become quite slow with Vim 7.0 " if exists("g:ada_line_errors") syntax match adaLineError "\(^.\{79}\)\@<=." contains=ALL containedin=ALL endif " Section: syntax folding {{{1 " " Syntax folding is very tricky - for now I still suggest to use " indent folding " if exists("g:ada_folding") && g:ada_folding[0] == 's' if stridx (g:ada_folding, 'p') >= 0 syntax region adaPackage \ start="\(\\|\\)\s*\z(\k*\)" \ end="end\s\+\z1\s*;" \ keepend extend transparent fold contains=ALL endif if stridx (g:ada_folding, 'f') >= 0 syntax region adaProcedure \ start="\\s*\z(\k*\)" \ end="\\s\+\z1\s*;" \ keepend extend transparent fold contains=ALL syntax region adaFunction \ start="\\s*\z(\k*\)" \ end="end\s\+\z1\s*;" \ keepend extend transparent fold contains=ALL endif if stridx (g:ada_folding, 'f') >= 0 syntax region adaRecord \ start="\" \ end="\" \ keepend extend transparent fold contains=ALL endif endif " Section: The default methods for highlighting. Can be overridden later. {{{1 " highlight def link adaCharacter Character highlight def link adaComment Comment highlight def link adaConditional Conditional highlight def link adaKeyword Keyword highlight def link adaLabel Label highlight def link adaNumber Number highlight def link adaSign Number highlight def link adaOperator Operator highlight def link adaPreproc PreProc highlight def link adaRepeat Repeat highlight def link adaSpecial Special highlight def link adaStatement Statement highlight def link adaString String highlight def link adaStructure Structure highlight def link adaTodo Todo highlight def link adaType Type highlight def link adaTypedef Typedef highlight def link adaStorageClass StorageClass highlight def link adaBoolean Boolean highlight def link adaException Exception highlight def link adaAttribute Tag highlight def link adaInc Include highlight def link adaError Error highlight def link adaSpaceError Error highlight def link adaLineError Error highlight def link adaBuiltinType Type highlight def link adaAssignment Special " Subsection: Begin, End {{{2 " if exists ("ada_begin_preproc") " This is the old default display: highlight def link adaBegin PreProc highlight def link adaEnd PreProc else " This is the new default display: highlight def link adaBegin Keyword highlight def link adaEnd Keyword endif " Section: sync {{{1 " " We don't need to look backwards to highlight correctly; " this speeds things up greatly. syntax sync minlines=1 maxlines=1 let &cpo = s:keepcpo unlet s:keepcpo finish " 1}}} "------------------------------------------------------------------------------ " Copyright (C) 2006 Martin Krischik " " Vim is Charityware - see ":help license" or uganda.txt for licence details. "------------------------------------------------------------------------------ "vim: textwidth=78 nowrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab "vim: foldmethod=marker usr/share/vim/vim80/indent/ada.vim000064400000025743152534106500012754 0ustar00"------------------------------------------------------------------------------ " Description: Vim Ada indent file " Language: Ada (2005) " $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischik " Neil Bird " Ned Okie " $Author: krischik $ " $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 " $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/indent/ada.vim $ " History: 24.05.2006 MK Unified Headers " 16.07.2006 MK Ada-Mode as vim-ball " 15.10.2006 MK Bram's suggestion for runtime integration " 05.11.2006 MK Bram suggested to save on spaces " 19.09.2007 NO g: missing before ada#Comment " Help Page: ft-vim-indent "------------------------------------------------------------------------------ " ToDo: " Verify handling of multi-line exprs. and recovery upon the final ';'. " Correctly find comments given '"' and "" ==> " syntax. " Combine the two large block-indent functions into one? "------------------------------------------------------------------------------ " Only load this indent file when no other was loaded. if exists("b:did_indent") || version < 700 finish endif let b:did_indent = 45 setlocal indentexpr=GetAdaIndent() setlocal indentkeys-=0{,0} setlocal indentkeys+=0=~then,0=~end,0=~elsif,0=~when,0=~exception,0=~begin,0=~is,0=~record " Only define the functions once. if exists("*GetAdaIndent") finish endif let s:keepcpo= &cpo set cpo&vim if exists("g:ada_with_gnat_project_files") let s:AdaBlockStart = '^\s*\(if\>\|while\>\|else\>\|elsif\>\|loop\>\|for\>.*\<\(loop\|use\)\>\|declare\>\|begin\>\|type\>.*\[^;]*$\|\(type\>.*\)\=\\|procedure\>\|function\>\|accept\>\|do\>\|task\>\|package\>\|project\>\|then\>\|when\>\|is\>\)' else let s:AdaBlockStart = '^\s*\(if\>\|while\>\|else\>\|elsif\>\|loop\>\|for\>.*\<\(loop\|use\)\>\|declare\>\|begin\>\|type\>.*\[^;]*$\|\(type\>.*\)\=\\|procedure\>\|function\>\|accept\>\|do\>\|task\>\|package\>\|then\>\|when\>\|is\>\)' endif " Section: s:MainBlockIndent {{{1 " " Try to find indent of the block we're in " prev_indent = the previous line's indent " prev_lnum = previous line (to start looking on) " blockstart = expr. that indicates a possible start of this block " stop_at = if non-null, if a matching line is found, gives up! " No recursive previous block analysis: simply look for a valid line " with a lesser or equal indent than we currently (on prev_lnum) have. " This shouldn't work as well as it appears to with lines that are currently " nowhere near the correct indent (e.g., start of line)! " Seems to work OK as it 'starts' with the indent of the /previous/ line. function s:MainBlockIndent (prev_indent, prev_lnum, blockstart, stop_at) let lnum = a:prev_lnum let line = substitute( getline(lnum), g:ada#Comment, '', '' ) while lnum > 1 if a:stop_at != '' && line =~ '^\s*' . a:stop_at && indent(lnum) < a:prev_indent return a:prev_indent elseif line =~ '^\s*' . a:blockstart 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), g:ada#Comment, '', '' ) 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 return a:prev_indent - shiftwidth() endfunction MainBlockIndent " Section: s:EndBlockIndent {{{1 " " Try to find indent of the block we're in (and about to complete), " including handling of nested blocks. Works on the 'end' of a block. " prev_indent = the previous line's indent " prev_lnum = previous line (to start looking on) " blockstart = expr. that indicates a possible start of this block " blockend = expr. that indicates a possible end of this block function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend ) let lnum = a:prev_lnum let line = getline(lnum) let ends = 0 while lnum > 1 if getline(lnum) =~ '^\s*' . a:blockstart let ind = indent(lnum) if ends <= 0 if ind < a:prev_indent return ind endif else let ends = ends - 1 endif elseif getline(lnum) =~ '^\s*' . a:blockend let ends = ends + 1 endif let lnum = prevnonblank(lnum - 1) " Get previous non-blank/non-comment-only line while 1 let line = getline(lnum) let line = substitute( line, g:ada#Comment, '', '' ) if line !~ '^\s*$' break endif let lnum = prevnonblank(lnum - 1) if lnum <= 0 return a:prev_indent endif endwhile endwhile " Fallback - just move back one return a:prev_indent - shiftwidth() endfunction EndBlockIndent " Section: s:StatementIndent {{{1 " " Return indent of previous statement-start " (after we've indented due to multi-line statements). " This time, we start searching on the line *before* the one given (which is " the end of a statement - we want the previous beginning). function s:StatementIndent( current_indent, prev_lnum ) let lnum = a:prev_lnum while lnum > 0 let prev_lnum = lnum let lnum = prevnonblank(lnum - 1) " Get previous non-blank/non-comment-only line while 1 let line = substitute( getline(lnum), g:ada#Comment, '', '' ) 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 endif if line !~ '[.=(]\s*$' let ind = indent(prev_lnum) if ind < a:current_indent return ind endif endif endwhile " Fallback - just use current one return a:current_indent endfunction StatementIndent " Section: GetAdaIndent {{{1 " " Find correct indent of a new line based upon what went before " function GetAdaIndent() " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) let ind = indent(lnum) let package_line = 0 " Get previous non-blank/non-comment-only/non-cpp line while 1 let line = substitute( getline(lnum), g:ada#Comment, '', '' ) if line !~ '^\s*$' && line !~ '^\s*#' break endif let lnum = prevnonblank(lnum - 1) if lnum <= 0 return ind endif endwhile " Get default indent (from prev. line) let ind = indent(lnum) let initind = ind " Now check what's on the previous line if line =~ s:AdaBlockStart || line =~ '(\s*$' " Check for false matches to AdaBlockStart let false_match = 0 if line =~ '^\s*\(procedure\|function\|package\)\>.*\' " Generic instantiation let false_match = 1 elseif line =~ ')\s*;\s*$' || line =~ '^\([^(]*([^)]*)\)*[^(]*;\s*$' " forward declaration let false_match = 1 endif " Move indent in if ! false_match let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(case\|exception\)\>' " Move indent in twice (next 'when' will move back) let ind = ind + 2 * shiftwidth() elseif line =~ '^\s*end\s*record\>' " Move indent back to tallying 'type' preceeding the 'record'. " Allow indent to be equal to 'end record's. let ind = s:MainBlockIndent( ind+shiftwidth(), lnum, 'type\>', '' ) elseif line =~ '\(^\s*new\>.*\)\@' " Multiple line generic instantiation ('package blah is\nnew thingy') let ind = s:StatementIndent( ind - shiftwidth(), lnum ) elseif line =~ ';\s*$' " Statement end (but not 'end' ) - try to find current statement-start indent let ind = s:StatementIndent( ind, lnum ) endif " Check for potential argument list on next line let continuation = (line =~ '[A-Za-z0-9_]\s*$') " Check current line; search for simplistic matching start-of-block let line = getline(v:lnum) if line =~ '^\s*#' " Start of line for ada-pp let ind = 0 elseif continuation && line =~ '^\s*(' " Don't do this if we've already indented due to the previous line if ind == initind let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(begin\|is\)\>' let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' ) elseif line =~ '^\s*record\>' let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\', '' ) + shiftwidth() elseif line =~ '^\s*\(else\|elsif\)\>' let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' ) elseif line =~ '^\s*when\>' " Align 'when' one /in/ from matching block start let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + shiftwidth() elseif line =~ '^\s*end\>\s*\' " End of if statements let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\' ) elseif line =~ '^\s*end\>\s*\' " End of loops let ind = s:EndBlockIndent( ind, lnum, '\(\(while\|for\)\>.*\)\?\', 'end\>\s*\' ) elseif line =~ '^\s*end\>\s*\' " End of records let ind = s:EndBlockIndent( ind, lnum, '\(type\>.*\)\=\', 'end\>\s*\' ) elseif line =~ '^\s*end\>\s*\' " End of procedures let ind = s:EndBlockIndent( ind, lnum, 'procedure\>.*\', 'end\>\s*\' ) elseif line =~ '^\s*end\>\s*\' " End of case statement let ind = s:EndBlockIndent( ind, lnum, 'case\>.*\', 'end\>\s*\' ) elseif line =~ '^\s*end\>' " General case for end let ind = s:MainBlockIndent( ind, lnum, '\(if\|while\|for\|loop\|accept\|begin\|record\|case\|exception\|package\)\>', '' ) elseif line =~ '^\s*exception\>' let ind = s:MainBlockIndent( ind, lnum, 'begin\>', '' ) elseif line =~ '^\s*then\>' let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' ) endif return ind endfunction GetAdaIndent let &cpo = s:keepcpo unlet s:keepcpo finish " 1}}} "------------------------------------------------------------------------------ " Copyright (C) 2006 Martin Krischik " " Vim is Charityware - see ":help license" or uganda.txt for licence details. "------------------------------------------------------------------------------ " vim: textwidth=78 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab " vim: foldmethod=marker