annotate runtime/syntax/ada.vim @ 49:000769ce6c9d default tip

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