annotate runtime/syntax/ada.vim @ 39:c16898406ff2

synchorinize version 7.3.081
author one@zeus.cr.ie.u-ryukyu.ac.jp
date Fri, 17 Dec 2010 17:43:06 +0900
parents e170173ecb68
children 67300faee616
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
1 "----------------------------------------------------------------------------
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
2 " Description: Vim Ada syntax file
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
3 " Language: Ada (2005)
39
c16898406ff2 synchorinize version 7.3.081
one@zeus.cr.ie.u-ryukyu.ac.jp
parents: 34
diff changeset
4 " $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $
0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
5 " Copyright: Copyright (C) 2006 Martin Krischik
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
6 " Maintainer: Martin Krischik
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
7 " David A. Wheeler <dwheeler@dwheeler.com>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
8 " Simon Bradley <simon.bradley@pitechnology.com>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
9 " Contributors: Preben Randhol.
39
c16898406ff2 synchorinize version 7.3.081
one@zeus.cr.ie.u-ryukyu.ac.jp
parents: 34
diff changeset
10 " $Author: krischik $
c16898406ff2 synchorinize version 7.3.081
one@zeus.cr.ie.u-ryukyu.ac.jp
parents: 34
diff changeset
11 " $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
9
6a13985590e6 *** empty log message ***
axmo
parents: 0
diff changeset
12 " Version: 4.6
39
c16898406ff2 synchorinize version 7.3.081
one@zeus.cr.ie.u-ryukyu.ac.jp
parents: 34
diff changeset
13 " $Revision: 887 $
9
6a13985590e6 *** empty log message ***
axmo
parents: 0
diff changeset
14 " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/syntax/ada.vim $
0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
15 " http://www.dwheeler.com/vim
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
16 " History: 24.05.2006 MK Unified Headers
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
17 " 26.05.2006 MK ' should not be in iskeyword.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
18 " 16.07.2006 MK Ada-Mode as vim-ball
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
19 " 02.10.2006 MK Better folding.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
20 " 15.10.2006 MK Bram's suggestion for runtime integration
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
21 " 05.11.2006 MK Spell check for comments and strings only
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
22 " 05.11.2006 MK Bram suggested to save on spaces
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
23 " Help Page: help ft-ada-syntax
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
24 "------------------------------------------------------------------------------
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
25 " The formal spec of Ada 2005 (ARM) is the "Ada 2005 Reference Manual".
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
26 " For more Ada 2005 info, see http://www.gnuada.org and http://www.adapower.com.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
27 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
28 " This vim syntax file works on vim 7.0 only and makes use of most of Voim 7.0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
29 " advanced features.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
30 "------------------------------------------------------------------------------
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
31
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
32 if exists("b:current_syntax") || version < 700
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
33 finish
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
34 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
35
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
36 let b:current_syntax = "ada"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
37
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
38 " Section: Ada is entirely case-insensitive. {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
39 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
40 syntax case ignore
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
41
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
42 " Section: Highlighting commands {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
43 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
44 " There are 72 reserved words in total in Ada2005. Some keywords are
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
45 " used in more than one way. For example:
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
46 " 1. "end" is a general keyword, but "end if" ends a Conditional.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
47 " 2. "then" is a conditional, but "and then" is an operator.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
48 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
49 for b:Item in g:ada#Keywords
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
50 " Standard Exceptions (including I/O).
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
51 " We'll highlight the standard exceptions, similar to vim's Python mode.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
52 " It's possible to redefine the standard exceptions as something else,
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
53 " but doing so is very bad practice, so simply highlighting them makes sense.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
54 if b:Item['kind'] == "x"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
55 execute "syntax keyword adaException " . b:Item['word']
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
56 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
57 if b:Item['kind'] == "a"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
58 execute 'syntax match adaAttribute "\V' . b:Item['word'] . '"'
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
59 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
60 " We don't normally highlight types in package Standard
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
61 " (Integer, Character, Float, etc.). I don't think it looks good
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
62 " with the other type keywords, and many Ada programs define
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
63 " so many of their own types that it looks inconsistent.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
64 " However, if you want this highlighting, turn on "ada_standard_types".
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
65 " For package Standard's definition, see ARM section A.1.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
66 if b:Item['kind'] == "t" && exists ("g:ada_standard_types")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
67 execute "syntax keyword adaBuiltinType " . b:Item['word']
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
68 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
69 endfor
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
70
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
71 " Section: others {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
72 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
73 syntax keyword adaLabel others
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
74
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
75 " Section: Operatoren {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
76 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
77 syntax keyword adaOperator abs mod not rem xor
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
78 syntax match adaOperator "\<and\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
79 syntax match adaOperator "\<and\s\+then\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
80 syntax match adaOperator "\<or\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
81 syntax match adaOperator "\<or\s\+else\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
82 syntax match adaOperator "[-+*/<>&]"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
83 syntax keyword adaOperator **
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
84 syntax match adaOperator "[/<>]="
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
85 syntax keyword adaOperator =>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
86 syntax match adaOperator "\.\."
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
87 syntax match adaOperator "="
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
88
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
89 " Section: <> {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
90 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
91 " Handle the box, <>, specially:
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
92 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
93 syntax keyword adaSpecial <>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
94
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
95 " Section: rainbow color {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
96 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
97 if exists("g:ada_rainbow_color")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
98 syntax match adaSpecial "[:;.,]"
9
6a13985590e6 *** empty log message ***
axmo
parents: 0
diff changeset
99 call rainbow_parenthsis#LoadRound ()
6a13985590e6 *** empty log message ***
axmo
parents: 0
diff changeset
100 call rainbow_parenthsis#Activate ()
0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
101 else
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
102 syntax match adaSpecial "[:;().,]"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
103 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
104
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
105 " Section: := {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
106 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
107 " We won't map "adaAssignment" by default, but we need to map ":=" to
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
108 " something or the "=" inside it will be mislabelled as an operator.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
109 " Note that in Ada, assignment (:=) is not considered an operator.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
110 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
111 syntax match adaAssignment ":="
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
112
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
113 " Section: Numbers, including floating point, exponents, and alternate bases. {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
114 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
115 syntax match adaNumber "\<\d[0-9_]*\(\.\d[0-9_]*\)\=\([Ee][+-]\=\d[0-9_]*\)\=\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
116 syntax match adaNumber "\<\d\d\=#\x[0-9A-Fa-f_]*\(\.\x[0-9A-Fa-f_]*\)\=#\([Ee][+-]\=\d[0-9_]*\)\="
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
117
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
118 " Section: Identify leading numeric signs {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
119 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
120 " In "A-5" the "-" is an operator, " but in "A:=-5" the "-" is a sign. This
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
121 " handles "A3+-5" (etc.) correctly. " This assumes that if you put a
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
122 " don't put a space after +/- when it's used " as an operator, you won't
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
123 " put a space before it either -- which is true " in code I've seen.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
124 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
125 syntax match adaSign "[[:space:]<>=(,|:;&*/+-][+-]\d"lc=1,hs=s+1,he=e-1,me=e-1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
126
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
127 " Section: Labels for the goto statement. {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
128 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
129 syntax region adaLabel start="<<" end=">>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
130
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
131 " Section: Boolean Constants {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
132 " Boolean Constants.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
133 syntax keyword adaBoolean true false
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
134
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
135 " Section: Warn C/C++ {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
136 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
137 " Warn people who try to use C/C++ notation erroneously:
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
138 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
139 syntax match adaError "//"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
140 syntax match adaError "/\*"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
141 syntax match adaError "=="
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
142
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
143
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
144 " Section: Space Errors {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
145 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
146 if exists("g:ada_space_errors")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
147 if !exists("g:ada_no_trail_space_error")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
148 syntax match adaSpaceError excludenl "\s\+$"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
149 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
150 if !exists("g:ada_no_tab_space_error")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
151 syntax match adaSpaceError " \+\t"me=e-1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
152 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
153 if !exists("g:ada_all_tab_usage")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
154 syntax match adaSpecial "\t"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
155 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
156 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
157
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
158 " Section: end {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
159 " Unless special ("end loop", "end if", etc.), "end" marks the end of a
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
160 " begin, package, task etc. Assiging it to adaEnd.
9
6a13985590e6 *** empty log message ***
axmo
parents: 0
diff changeset
161 syntax match adaEnd /\<end\>/
0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
162
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
163 syntax keyword adaPreproc pragma
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
164
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
165 syntax keyword adaRepeat exit for loop reverse while
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
166 syntax match adaRepeat "\<end\s\+loop\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
167
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
168 syntax keyword adaStatement accept delay goto raise requeue return
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
169 syntax keyword adaStatement terminate
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
170 syntax match adaStatement "\<abort\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
171
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
172 " Section: Handle Ada's record keywords. {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
173 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
174 " 'record' usually starts a structure, but "with null record;" does not,
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
175 " and 'end record;' ends a structure. The ordering here is critical -
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
176 " 'record;' matches a "with null record", so make it a keyword (this can
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
177 " match when the 'with' or 'null' is on a previous line).
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
178 " We see the "end" in "end record" before the word record, so we match that
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
179 " pattern as adaStructure (and it won't match the "record;" pattern).
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
180 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
181 syntax match adaStructure "\<record\>" contains=adaRecord
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
182 syntax match adaStructure "\<end\s\+record\>" contains=adaRecord
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
183 syntax match adaKeyword "\<record;"me=e-1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
184
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
185 " Section: type classes {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
186 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
187 syntax keyword adaStorageClass abstract access aliased array at constant delta
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
188 syntax keyword adaStorageClass digits limited of private range tagged
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
189 syntax keyword adaStorageClass interface synchronized
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
190 syntax keyword adaTypedef subtype type
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
191
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
192 " Section: Conditionals {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
193 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
194 " "abort" after "then" is a conditional of its own.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
195 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
196 syntax match adaConditional "\<then\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
197 syntax match adaConditional "\<then\s\+abort\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
198 syntax match adaConditional "\<else\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
199 syntax match adaConditional "\<end\s\+if\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
200 syntax match adaConditional "\<end\s\+case\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
201 syntax match adaConditional "\<end\s\+select\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
202 syntax keyword adaConditional if case select
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
203 syntax keyword adaConditional elsif when
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
204
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
205 " Section: other keywords {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
206 syntax match adaKeyword "\<is\>" contains=adaRecord
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
207 syntax keyword adaKeyword all do exception in new null out
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
208 syntax keyword adaKeyword separate until overriding
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
209
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
210 " Section: begin keywords {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
211 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
212 " These keywords begin various constructs, and you _might_ want to
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
213 " highlight them differently.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
214 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
215 syntax keyword adaBegin begin body declare entry generic
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
216 syntax keyword adaBegin protected renames task
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
217
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
218 syntax match adaBegin "\<function\>" contains=adaFunction
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
219 syntax match adaBegin "\<procedure\>" contains=adaProcedure
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
220 syntax match adaBegin "\<package\>" contains=adaPackage
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
221
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
222 if exists("ada_with_gnat_project_files")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
223 syntax keyword adaBegin project
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
224 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
225
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
226 " Section: with, use {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
227 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
228 if exists("ada_withuse_ordinary")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
229 " Don't be fancy. Display "with" and "use" as ordinary keywords in all cases.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
230 syntax keyword adaKeyword with use
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
231 else
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
232 " Highlight "with" and "use" clauses like C's "#include" when they're used
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
233 " to reference other compilation units; otherwise they're ordinary keywords.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
234 " If we have vim 6.0 or later, we'll use its advanced pattern-matching
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
235 " capabilities so that we won't match leading spaces.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
236 syntax match adaKeyword "\<with\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
237 syntax match adaKeyword "\<use\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
238 syntax match adaBeginWith "^\s*\zs\(\(with\(\s\+type\)\=\)\|\(use\)\)\>" contains=adaInc
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
239 syntax match adaSemiWith ";\s*\zs\(\(with\(\s\+type\)\=\)\|\(use\)\)\>" contains=adaInc
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
240 syntax match adaInc "\<with\>" contained contains=NONE
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
241 syntax match adaInc "\<with\s\+type\>" contained contains=NONE
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
242 syntax match adaInc "\<use\>" contained contains=NONE
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
243 " Recognize "with null record" as a keyword (even the "record").
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
244 syntax match adaKeyword "\<with\s\+null\s\+record\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
245 " Consider generic formal parameters of subprograms and packages as keywords.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
246 syntax match adaKeyword ";\s*\zswith\s\+\(function\|procedure\|package\)\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
247 syntax match adaKeyword "^\s*\zswith\s\+\(function\|procedure\|package\)\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
248 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
249
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
250 " Section: String and character constants. {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
251 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
252 syntax region adaString contains=@Spell start=+"+ skip=+""+ end=+"+
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
253 syntax match adaCharacter "'.'"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
254
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
255 " Section: Todo (only highlighted in comments) {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
256 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
257 syntax keyword adaTodo contained TODO FIXME XXX NOTE
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
258
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
259 " Section: Comments. {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
260 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
261 syntax region adaComment
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
262 \ oneline
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
263 \ contains=adaTodo,adaLineError,@Spell
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
264 \ start="--"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
265 \ end="$"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
266
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
267 " Section: line errors {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
268 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
269 " Note: Line errors have become quite slow with Vim 7.0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
270 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
271 if exists("g:ada_line_errors")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
272 syntax match adaLineError "\(^.\{79}\)\@<=." contains=ALL containedin=ALL
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
273 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
274
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
275 " Section: syntax folding {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
276 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
277 " Syntax folding is very tricky - for now I still suggest to use
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
278 " indent folding
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
279 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
280 if exists("g:ada_folding") && g:ada_folding[0] == 's'
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
281 if stridx (g:ada_folding, 'p') >= 0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
282 syntax region adaPackage
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
283 \ start="\(\<package\s\+body\>\|\<package\>\)\s*\z(\k*\)"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
284 \ end="end\s\+\z1\s*;"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
285 \ keepend extend transparent fold contains=ALL
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
286 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
287 if stridx (g:ada_folding, 'f') >= 0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
288 syntax region adaProcedure
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
289 \ start="\<procedure\>\s*\z(\k*\)"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
290 \ end="\<end\>\s\+\z1\s*;"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
291 \ keepend extend transparent fold contains=ALL
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
292 syntax region adaFunction
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
293 \ start="\<procedure\>\s*\z(\k*\)"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
294 \ end="end\s\+\z1\s*;"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
295 \ keepend extend transparent fold contains=ALL
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
296 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
297 if stridx (g:ada_folding, 'f') >= 0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
298 syntax region adaRecord
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
299 \ start="\<is\s\+record\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
300 \ end="\<end\s\+record\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
301 \ keepend extend transparent fold contains=ALL
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
302 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
303 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
304
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
305 " Section: The default methods for highlighting. Can be overridden later. {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
306 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
307 highlight def link adaCharacter Character
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
308 highlight def link adaComment Comment
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
309 highlight def link adaConditional Conditional
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
310 highlight def link adaKeyword Keyword
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
311 highlight def link adaLabel Label
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
312 highlight def link adaNumber Number
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
313 highlight def link adaSign Number
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
314 highlight def link adaOperator Operator
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
315 highlight def link adaPreproc PreProc
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
316 highlight def link adaRepeat Repeat
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
317 highlight def link adaSpecial Special
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
318 highlight def link adaStatement Statement
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
319 highlight def link adaString String
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
320 highlight def link adaStructure Structure
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
321 highlight def link adaTodo Todo
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
322 highlight def link adaType Type
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
323 highlight def link adaTypedef Typedef
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
324 highlight def link adaStorageClass StorageClass
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
325 highlight def link adaBoolean Boolean
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
326 highlight def link adaException Exception
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
327 highlight def link adaAttribute Tag
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
328 highlight def link adaInc Include
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
329 highlight def link adaError Error
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
330 highlight def link adaSpaceError Error
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
331 highlight def link adaLineError Error
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
332 highlight def link adaBuiltinType Type
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
333 highlight def link adaAssignment Special
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
334
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
335 " Subsection: Begin, End {{{2
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
336 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
337 if exists ("ada_begin_preproc")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
338 " This is the old default display:
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
339 highlight def link adaBegin PreProc
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
340 highlight def link adaEnd PreProc
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
341 else
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
342 " This is the new default display:
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
343 highlight def link adaBegin Keyword
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
344 highlight def link adaEnd Keyword
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
345 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
346
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
347
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
348
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
349 " Section: sync {{{1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
350 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
351 " We don't need to look backwards to highlight correctly;
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
352 " this speeds things up greatly.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
353 syntax sync minlines=1 maxlines=1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
354
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
355 finish " 1}}}
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
356
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
357 "------------------------------------------------------------------------------
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
358 " Copyright (C) 2006 Martin Krischik
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
359 "
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
360 " Vim is Charityware - see ":help license" or uganda.txt for licence details.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
361 "------------------------------------------------------------------------------
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
362 "vim: textwidth=78 nowrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
363 "vim: foldmethod=marker