7
|
1 " Eiffel syntax file
|
|
2 " Language: Eiffel
|
3557
|
3 " Maintainer: Jocelyn Fiat <jfiat@eiffel.com>
|
|
4 " Previous maintainer: Reimer Behrends <behrends@cse.msu.edu>
|
|
5 " Contributions from: Thilo Six
|
|
6 "
|
|
7 " URL: https://github.com/eiffelhub/vim-eiffel
|
7
|
8 " For version 5.x: Clear all syntax items
|
|
9 " For version 6.x: Quit when a syntax file was already loaded
|
|
10 if version < 600
|
|
11 syntax clear
|
|
12 elseif exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15
|
3557
|
16 let s:keepcpo= &cpo
|
3256
|
17 set cpo&vim
|
|
18
|
7
|
19 " Option handling
|
|
20
|
|
21 if exists("eiffel_ignore_case")
|
|
22 syn case ignore
|
|
23 else
|
|
24 syn case match
|
|
25 if exists("eiffel_pedantic") || exists("eiffel_strict")
|
|
26 syn keyword eiffelError current void result precursor none
|
|
27 syn keyword eiffelError CURRENT VOID RESULT PRECURSOR None
|
|
28 syn keyword eiffelError TRUE FALSE
|
|
29 endif
|
|
30 if exists("eiffel_pedantic")
|
|
31 syn keyword eiffelError true false
|
|
32 syn match eiffelError "\<[a-z_]\+[A-Z][a-zA_Z_]*\>"
|
|
33 syn match eiffelError "\<[A-Z][a-z_]*[A-Z][a-zA-Z_]*\>"
|
|
34 endif
|
|
35 if exists("eiffel_lower_case_predef")
|
|
36 syn keyword eiffelPredefined current void result precursor
|
|
37 endif
|
|
38 endif
|
|
39
|
|
40 if exists("eiffel_hex_constants")
|
|
41 syn match eiffelNumber "\d[0-9a-fA-F]*[xX]"
|
|
42 endif
|
|
43
|
|
44 " Keyword definitions
|
|
45
|
3557
|
46 syn keyword eiffelTopStruct note indexing feature creation inherit
|
7
|
47 syn match eiffelTopStruct "\<class\>"
|
|
48 syn match eiffelKeyword "\<end\>"
|
|
49 syn match eiffelTopStruct "^end\>\(\s*--\s\+class\s\+\<[A-Z][A-Z0-9_]*\>\)\=" contains=eiffelClassName
|
|
50 syn match eiffelBrackets "[[\]]"
|
|
51 syn match eiffelBracketError "\]"
|
|
52 syn region eiffelGeneric transparent matchgroup=eiffelBrackets start="\[" end="\]" contains=ALLBUT,eiffelBracketError,eiffelGenericDecl,eiffelStringError,eiffelStringEscape,eiffelGenericCreate,eiffelTopStruct
|
|
53 if exists("eiffel_ise")
|
3557
|
54 syn match eiffelAgent "\<agent\>"
|
|
55 syn match eiffelConvert "\<convert\>"
|
7
|
56 syn match eiffelCreate "\<create\>"
|
|
57 syn match eiffelTopStruct contained "\<create\>"
|
3557
|
58 syn match eiffelTopStruct contained "\<convert\>"
|
7
|
59 syn match eiffelGenericCreate contained "\<create\>"
|
|
60 syn match eiffelTopStruct "^create\>"
|
|
61 syn region eiffelGenericDecl transparent matchgroup=eiffelBrackets contained start="\[" end="\]" contains=ALLBUT,eiffelCreate,eiffelTopStruct,eiffelGeneric,eiffelBracketError,eiffelStringEscape,eiffelStringError,eiffelBrackets
|
|
62 syn region eiffelClassHeader start="^class\>" end="$" contains=ALLBUT,eiffelCreate,eiffelGenericCreate,eiffelGeneric,eiffelStringEscape,eiffelStringError,eiffelBrackets
|
|
63 endif
|
3557
|
64 syn keyword eiffelDeclaration is do once deferred unique local attribute assign
|
|
65 syn keyword eiffelDeclaration attached detachable Unique
|
7
|
66 syn keyword eiffelProperty expanded obsolete separate frozen
|
|
67 syn keyword eiffelProperty prefix infix
|
|
68 syn keyword eiffelInheritClause rename redefine undefine select export as
|
|
69 syn keyword eiffelAll all
|
3557
|
70 syn keyword eiffelKeyword external alias some
|
7
|
71 syn keyword eiffelStatement if else elseif inspect
|
|
72 syn keyword eiffelStatement when then
|
|
73 syn match eiffelAssertion "\<require\(\s\+else\)\=\>"
|
|
74 syn match eiffelAssertion "\<ensure\(\s\+then\)\=\>"
|
|
75 syn keyword eiffelAssertion check
|
|
76 syn keyword eiffelDebug debug
|
3557
|
77 syn keyword eiffelStatement across from until loop
|
7
|
78 syn keyword eiffelAssertion variant
|
|
79 syn match eiffelAssertion "\<invariant\>"
|
|
80 syn match eiffelTopStruct "^invariant\>"
|
|
81 syn keyword eiffelException rescue retry
|
|
82
|
|
83 syn keyword eiffelPredefined Current Void Result Precursor
|
|
84
|
|
85 " Operators
|
|
86 syn match eiffelOperator "\<and\(\s\+then\)\=\>"
|
|
87 syn match eiffelOperator "\<or\(\s\+else\)\=\>"
|
|
88 syn keyword eiffelOperator xor implies not
|
|
89 syn keyword eiffelOperator strip old
|
|
90 syn keyword eiffelOperator Strip
|
|
91 syn match eiffelOperator "\$"
|
|
92 syn match eiffelCreation "!"
|
|
93 syn match eiffelExport "[{}]"
|
|
94 syn match eiffelArray "<<"
|
|
95 syn match eiffelArray ">>"
|
|
96 syn match eiffelConstraint "->"
|
|
97 syn match eiffelOperator "[@#|&][^ \e\t\b%]*"
|
|
98
|
|
99 " Special classes
|
|
100 syn keyword eiffelAnchored like
|
|
101 syn keyword eiffelBitType BIT
|
|
102
|
|
103 " Constants
|
|
104 if !exists("eiffel_pedantic")
|
|
105 syn keyword eiffelBool true false
|
|
106 endif
|
|
107 syn keyword eiffelBool True False
|
|
108 syn region eiffelString start=+"+ skip=+%"+ end=+"+ contains=eiffelStringEscape,eiffelStringError
|
|
109 syn match eiffelStringEscape contained "%[^/]"
|
|
110 syn match eiffelStringEscape contained "%/\d\+/"
|
|
111 syn match eiffelStringEscape contained "^[ \t]*%"
|
|
112 syn match eiffelStringEscape contained "%[ \t]*$"
|
|
113 syn match eiffelStringError contained "%/[^0-9]"
|
|
114 syn match eiffelStringError contained "%/\d\+[^0-9/]"
|
|
115 syn match eiffelBadConstant "'\(%[^/]\|%/\d\+/\|[^'%]\)\+'"
|
|
116 syn match eiffelBadConstant "''"
|
|
117 syn match eiffelCharacter "'\(%[^/]\|%/\d\+/\|[^'%]\)'" contains=eiffelStringEscape
|
|
118 syn match eiffelNumber "-\=\<\d\+\(_\d\+\)*\>"
|
|
119 syn match eiffelNumber "\<[01]\+[bB]\>"
|
|
120 syn match eiffelNumber "-\=\<\d\+\(_\d\+\)*\.\(\d\+\(_\d\+\)*\)\=\([eE][-+]\=\d\+\(_\d\+\)*\)\="
|
|
121 syn match eiffelNumber "-\=\.\d\+\(_\d\+\)*\([eE][-+]\=\d\+\(_\d\+\)*\)\="
|
|
122 syn match eiffelComment "--.*" contains=eiffelTodo
|
|
123
|
|
124 syn case match
|
|
125
|
|
126 " Case sensitive stuff
|
|
127
|
|
128 syn keyword eiffelTodo contained TODO XXX FIXME
|
|
129 syn match eiffelClassName "\<[A-Z][A-Z0-9_]*\>"
|
|
130
|
|
131 " Catch mismatched parentheses
|
|
132 syn match eiffelParenError ")"
|
|
133 syn region eiffelParen transparent start="(" end=")" contains=ALLBUT,eiffelParenError,eiffelStringError,eiffelStringEscape
|
|
134
|
3557
|
135 if exists("eiffel_fold")
|
|
136 " setlocal foldmethod=indent
|
|
137 " syn sync fromstart
|
|
138 endif
|
|
139
|
7
|
140 " Should suffice for even very long strings and expressions
|
|
141 syn sync lines=40
|
|
142
|
|
143 " Define the default highlighting.
|
|
144 " For version 5.7 and earlier: only when not done already
|
|
145 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
146 if version >= 508 || !exists("did_eiffel_syntax_inits")
|
|
147 if version < 508
|
|
148 let did_eiffel_syntax_inits = 1
|
|
149 command -nargs=+ HiLink hi link <args>
|
|
150 else
|
|
151 command -nargs=+ HiLink hi def link <args>
|
|
152 endif
|
|
153
|
|
154 HiLink eiffelKeyword Statement
|
|
155 HiLink eiffelProperty Statement
|
|
156 HiLink eiffelInheritClause Statement
|
|
157 HiLink eiffelStatement Statement
|
|
158 HiLink eiffelDeclaration Statement
|
|
159 HiLink eiffelAssertion Statement
|
|
160 HiLink eiffelDebug Statement
|
|
161 HiLink eiffelException Statement
|
|
162 HiLink eiffelGenericCreate Statement
|
|
163
|
3557
|
164 HiLink eiffelAgent Statement
|
|
165 HiLink eiffelConvert Statement
|
7
|
166
|
|
167 HiLink eiffelTopStruct PreProc
|
|
168
|
|
169 HiLink eiffelAll Special
|
|
170 HiLink eiffelAnchored Special
|
|
171 HiLink eiffelBitType Special
|
|
172
|
|
173
|
|
174 HiLink eiffelBool Boolean
|
|
175 HiLink eiffelString String
|
|
176 HiLink eiffelCharacter Character
|
|
177 HiLink eiffelClassName Type
|
|
178 HiLink eiffelNumber Number
|
|
179
|
|
180 HiLink eiffelStringEscape Special
|
|
181
|
|
182 HiLink eiffelOperator Special
|
|
183 HiLink eiffelArray Special
|
|
184 HiLink eiffelExport Special
|
|
185 HiLink eiffelCreation Special
|
|
186 HiLink eiffelBrackets Special
|
|
187 HiLink eiffelGeneric Special
|
|
188 HiLink eiffelGenericDecl Special
|
|
189 HiLink eiffelConstraint Special
|
|
190 HiLink eiffelCreate Special
|
|
191
|
|
192 HiLink eiffelPredefined Constant
|
|
193
|
|
194 HiLink eiffelComment Comment
|
|
195
|
|
196 HiLink eiffelError Error
|
|
197 HiLink eiffelBadConstant Error
|
|
198 HiLink eiffelStringError Error
|
|
199 HiLink eiffelParenError Error
|
|
200 HiLink eiffelBracketError Error
|
|
201
|
|
202 HiLink eiffelTodo Todo
|
|
203
|
|
204 delcommand HiLink
|
|
205 endif
|
|
206
|
|
207 let b:current_syntax = "eiffel"
|
|
208
|
3557
|
209 let &cpo = s:keepcpo
|
|
210 unlet s:keepcpo
|
|
211
|
7
|
212 " vim: ts=8
|