annotate runtime/syntax/ada.vim @ 21642:5ae89c8633ae v8.2.1371

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