Browse Source

Use upstream Python highlighter (as submodule)

Alois Mahdal 10 years ago
parent
commit
7aca1ddec2
3 changed files with 4 additions and 537 deletions
  1. 3
    0
      .gitmodules
  2. 1
    0
      dotfiles/vim/bundle/python-syntax
  3. 0
    537
      dotfiles/vim/syntax/python.vim

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
1
+[submodule "dotfiles/vim/bundle/python-syntax"]
2
+	path = dotfiles/vim/bundle/python-syntax
3
+	url = https://github.com/hdima/python-syntax.git

+ 1
- 0
dotfiles/vim/bundle/python-syntax

@@ -0,0 +1 @@
1
+Subproject commit 453269d0f86ce3c2e401b1bc8f7dfc5e1b8a5b7d

+ 0
- 537
dotfiles/vim/syntax/python.vim View File

@@ -1,537 +0,0 @@
1
-" Vim syntax file
2
-" Language:     Python
3
-" Maintainer:   Dmitry Vasiliev <dima at hlabs dot org>
4
-" URL:          https://github.com/hdima/vim-scripts/blob/master/syntax/python/python.vim
5
-" Last Change:  2013-03-10
6
-" Filenames:    *.py
7
-" Version:      3.3.0
8
-"
9
-" Based on python.vim (from Vim 6.1 distribution)
10
-" by Neil Schemenauer <nas at python dot ca>
11
-"
12
-" Bugs and feature requests can be reported through email
13
-" <dima at hlabs dot org>, GitHub at:
14
-"
15
-"   https://github.com/hdima/vim-scripts/issues
16
-"
17
-" , or Twitter:
18
-"
19
-"   https://twitter.com/hdima
20
-"
21
-" Contributors
22
-" ============
23
-"
24
-"   Jeroen Ruigrok van der Werven
25
-"   Pedro Algarvio
26
-"   John Eikenberry
27
-"   Caleb Adamantine
28
-"   Andrea Riciputi
29
-"   Anton Butanaev
30
-"   Marc Weber
31
-"
32
-" Options
33
-" =======
34
-"
35
-"    :let OPTION_NAME = 1                   Enable option
36
-"    :let OPTION_NAME = 0                   Disable option
37
-"
38
-"
39
-" Option to select Python version
40
-" -------------------------------
41
-"
42
-"    python_version_2                       Enable highlighting for Python 2
43
-"                                           (Python 3 highlighting is enabled
44
-"                                           by default). Can also be set as
45
-"                                           a buffer (b:python_version_2)
46
-"                                           variable.
47
-"
48
-"    You can also use the following local to buffer commands to switch
49
-"    between two highlighting modes:
50
-"
51
-"    :Python2Syntax                         Switch to Python 2 highlighting
52
-"                                           mode
53
-"    :Python3Syntax                         Switch to Python 3 highlighting
54
-"                                           mode
55
-"
56
-" Option names used by the script
57
-" -------------------------------
58
-"
59
-"    python_highlight_builtins              Highlight builtin functions and
60
-"                                           objects
61
-"      python_highlight_builtin_objs        Highlight builtin objects only
62
-"      python_highlight_builtin_funcs       Highlight builtin functions only
63
-"    python_highlight_exceptions            Highlight standard exceptions
64
-"    python_highlight_string_formatting     Highlight % string formatting
65
-"    python_highlight_string_format         Highlight str.format syntax
66
-"    python_highlight_string_templates      Highlight string.Template syntax
67
-"    python_highlight_indent_errors         Highlight indentation errors
68
-"    python_highlight_space_errors          Highlight trailing spaces
69
-"    python_highlight_doctests              Highlight doc-tests
70
-"    python_print_as_function               Highlight 'print' statement as
71
-"                                           function for Python 2
72
-"
73
-"    python_highlight_all                   Enable all the options above
74
-"                                           NOTE: This option don't override
75
-"                                           any previously set options
76
-"
77
-"    python_slow_sync                       Can be set to 0 for slow machines
78
-"
79
-
80
-" For version 5.x: Clear all syntax items
81
-" For versions greater than 6.x: Quit when a syntax file was already loaded
82
-if version < 600
83
-  syntax clear
84
-elseif exists("b:current_syntax")
85
-  finish
86
-endif
87
-
88
-"
89
-" Commands
90
-"
91
-command! -buffer Python2Syntax let b:python_version_2 = 1 | if exists("g:syntax_on") | syn off | endif | syn enable
92
-command! -buffer Python3Syntax let b:python_version_2 = 0 | if exists("g:syntax_on") | syn off | endif | syn enable
93
-
94
-" Enable option if it's not defined
95
-function! s:EnableByDefault(name)
96
-  if !exists(a:name)
97
-    let {a:name} = 1
98
-  endif
99
-endfunction
100
-
101
-" Check if option is enabled
102
-function! s:Enabled(name)
103
-  return exists(a:name) && {a:name} != 0
104
-endfunction
105
-
106
-" Is it Python 2 syntax?
107
-function! s:Python2Syntax()
108
-  return s:Enabled("b:python_version_2") || s:Enabled("g:python_version_2")
109
-endfunction
110
-
111
-"
112
-" Default options
113
-"
114
-
115
-call s:EnableByDefault("g:python_slow_sync")
116
-
117
-if s:Enabled("g:python_highlight_all")
118
-  call s:EnableByDefault("g:python_highlight_builtins")
119
-  if s:Enabled("g:python_highlight_builtins")
120
-    call s:EnableByDefault("g:python_highlight_builtin_objs")
121
-    call s:EnableByDefault("g:python_highlight_builtin_funcs")
122
-  endif
123
-  call s:EnableByDefault("g:python_highlight_exceptions")
124
-  call s:EnableByDefault("g:python_highlight_string_formatting")
125
-  call s:EnableByDefault("g:python_highlight_string_format")
126
-  call s:EnableByDefault("g:python_highlight_string_templates")
127
-  call s:EnableByDefault("g:python_highlight_indent_errors")
128
-  call s:EnableByDefault("g:python_highlight_space_errors")
129
-  call s:EnableByDefault("g:python_highlight_doctests")
130
-  call s:EnableByDefault("g:python_print_as_function")
131
-endif
132
-
133
-"
134
-" Keywords
135
-"
136
-
137
-syn keyword pythonStatement     break continue del
138
-syn keyword pythonStatement     exec return
139
-syn keyword pythonStatement     pass raise
140
-syn keyword pythonStatement     global assert
141
-syn keyword pythonStatement     lambda yield
142
-syn keyword pythonStatement     with
143
-syn keyword pythonStatement     def class nextgroup=pythonFunction skipwhite
144
-syn keyword pythonRepeat        for while
145
-syn keyword pythonConditional   if elif else
146
-syn keyword pythonPreCondit     import from
147
-syn keyword pythonException     try except finally
148
-syn keyword pythonOperator      and in is not or
149
-
150
-" added by aloism
151
-syn keyword pythonConvention    self
152
-syn keyword pythonConvention    cls
153
-
154
-if s:Python2Syntax()
155
-  if !s:Enabled("g:python_print_as_function")
156
-    syn keyword pythonStatement  print
157
-  endif
158
-  syn keyword pythonPreCondit   as
159
-  syn match   pythonFunction    "[a-zA-Z_][a-zA-Z0-9_]*" display contained
160
-else
161
-  syn keyword pythonStatement   as nonlocal False None True
162
-  syn match   pythonFunction    "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
163
-endif
164
-
165
-"
166
-" Decorators (new in Python 2.4)
167
-"
168
-
169
-syn match   pythonDecorator	"@" display nextgroup=pythonDottedName skipwhite
170
-syn match   pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained
171
-syn match   pythonDot        "\." display containedin=pythonDottedName
172
-
173
-"
174
-" Comments
175
-"
176
-
177
-syn match   pythonComment	"#.*$" display contains=pythonTodo,@Spell
178
-syn match   pythonRun		"\%^#!.*$"
179
-syn match   pythonCoding	"\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
180
-syn keyword pythonTodo		TODO FIXME XXX contained
181
-
182
-"
183
-" Errors
184
-"
185
-
186
-syn match pythonError		"\<\d\+\D\+\>" display
187
-syn match pythonError		"[$?]" display
188
-syn match pythonError		"[&|]\{2,}" display
189
-syn match pythonError		"[=]\{3,}" display
190
-
191
-" Mixing spaces and tabs also may be used for pretty formatting multiline
192
-" statements
193
-if s:Enabled("g:python_highlight_indent_errors")
194
-  syn match pythonIndentError	"^\s*\%( \t\|\t \)\s*\S"me=e-1 display
195
-endif
196
-
197
-" Trailing space errors
198
-if s:Enabled("g:python_highlight_space_errors")
199
-  syn match pythonSpaceError	"\s\+$" display
200
-endif
201
-
202
-"
203
-" Strings
204
-"
205
-
206
-if s:Python2Syntax()
207
-  " Python 2 strings
208
-  syn region pythonString   start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
209
-  syn region pythonString   start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
210
-  syn region pythonString   start=+[bB]\="""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
211
-  syn region pythonString   start=+[bB]\='''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
212
-else
213
-  " Python 3 byte strings
214
-  syn region pythonBytes		start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
215
-  syn region pythonBytes		start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
216
-  syn region pythonBytes		start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
217
-  syn region pythonBytes		start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
218
-
219
-  syn match pythonBytesError    ".\+" display contained
220
-  syn match pythonBytesContent  "[\u0000-\u00ff]\+" display contained contains=pythonBytesEscape,pythonBytesEscapeError
221
-endif
222
-
223
-syn match pythonBytesEscape       +\\[abfnrtv'"\\]+ display contained
224
-syn match pythonBytesEscape       "\\\o\o\=\o\=" display contained
225
-syn match pythonBytesEscapeError  "\\\o\{,2}[89]" display contained
226
-syn match pythonBytesEscape       "\\x\x\{2}" display contained
227
-syn match pythonBytesEscapeError  "\\x\x\=\X" display contained
228
-syn match pythonBytesEscape       "\\$"
229
-
230
-syn match pythonUniEscape         "\\u\x\{4}" display contained
231
-syn match pythonUniEscapeError    "\\u\x\{,3}\X" display contained
232
-syn match pythonUniEscape         "\\U\x\{8}" display contained
233
-syn match pythonUniEscapeError    "\\U\x\{,7}\X" display contained
234
-syn match pythonUniEscape         "\\N{[A-Z ]\+}" display contained
235
-syn match pythonUniEscapeError    "\\N{[^A-Z ]\+}" display contained
236
-
237
-if s:Python2Syntax()
238
-  " Python 2 Unicode strings
239
-  syn region pythonUniString  start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
240
-  syn region pythonUniString  start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
241
-  syn region pythonUniString  start=+[uU]"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
242
-  syn region pythonUniString  start=+[uU]'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
243
-else
244
-  " Python 3 strings
245
-  syn region pythonString   start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
246
-  syn region pythonString   start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
247
-  syn region pythonString   start=+"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
248
-  syn region pythonString   start=+'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
249
-endif
250
-
251
-if s:Python2Syntax()
252
-  " Python 2 Unicode raw strings
253
-  syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
254
-  syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
255
-  syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
256
-  syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
257
-
258
-  syn match  pythonUniRawEscape       "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
259
-  syn match  pythonUniRawEscapeError  "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained
260
-endif
261
-
262
-" Python 2/3 raw strings
263
-if s:Python2Syntax()
264
-  syn region pythonRawString  start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
265
-  syn region pythonRawString  start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
266
-  syn region pythonRawString  start=+[bB]\=[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
267
-  syn region pythonRawString  start=+[bB]\=[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
268
-else
269
-  syn region pythonRawString  start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
270
-  syn region pythonRawString  start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
271
-  syn region pythonRawString  start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
272
-  syn region pythonRawString  start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
273
-
274
-  syn region pythonRawBytes  start=+[bB][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
275
-  syn region pythonRawBytes  start=+[bB][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
276
-  syn region pythonRawBytes  start=+[bB][rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
277
-  syn region pythonRawBytes  start=+[bB][rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
278
-endif
279
-
280
-syn match pythonRawEscape +\\['"]+ display transparent contained
281
-
282
-if s:Enabled("g:python_highlight_string_formatting")
283
-  " % operator string formatting
284
-  if s:Python2Syntax()
285
-    syn match pythonStrFormatting	"%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
286
-    syn match pythonStrFormatting	"%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
287
-  else
288
-    syn match pythonStrFormatting	"%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
289
-    syn match pythonStrFormatting	"%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
290
-  endif
291
-endif
292
-
293
-if s:Enabled("g:python_highlight_string_format")
294
-  " str.format syntax
295
-  if s:Python2Syntax()
296
-    syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
297
-    syn match pythonStrFormat	"{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
298
-  else
299
-    syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString
300
-    syn match pythonStrFormat	"{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
301
-  endif
302
-endif
303
-
304
-if s:Enabled("g:python_highlight_string_templates")
305
-  " string.Template format
306
-  if s:Python2Syntax()
307
-    syn match pythonStrTemplate	"\$\$" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
308
-    syn match pythonStrTemplate	"\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
309
-    syn match pythonStrTemplate	"\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
310
-  else
311
-    syn match pythonStrTemplate	"\$\$" contained containedin=pythonString,pythonRawString
312
-    syn match pythonStrTemplate	"\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonRawString
313
-    syn match pythonStrTemplate	"\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonRawString
314
-  endif
315
-endif
316
-
317
-if s:Enabled("g:python_highlight_doctests")
318
-  " DocTests
319
-  syn region pythonDocTest	start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
320
-  syn region pythonDocTest2	start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
321
-endif
322
-
323
-"
324
-" Numbers (ints, longs, floats, complex)
325
-"
326
-
327
-if s:Python2Syntax()
328
-  syn match   pythonHexError	"\<0[xX]\x*[g-zG-Z]\+\x*[lL]\=\>" display
329
-  syn match   pythonOctError	"\<0[oO]\=\o*\D\+\d*[lL]\=\>" display
330
-  syn match   pythonBinError	"\<0[bB][01]*\D\+\d*[lL]\=\>" display
331
-
332
-  syn match   pythonHexNumber	"\<0[xX]\x\+[lL]\=\>" display
333
-  syn match   pythonOctNumber "\<0[oO]\o\+[lL]\=\>" display
334
-  syn match   pythonBinNumber "\<0[bB][01]\+[lL]\=\>" display
335
-
336
-  syn match   pythonNumberError	"\<\d\+\D[lL]\=\>" display
337
-  syn match   pythonNumber	"\<\d[lL]\=\>" display
338
-  syn match   pythonNumber	"\<[0-9]\d\+[lL]\=\>" display
339
-  syn match   pythonNumber	"\<\d\+[lLjJ]\>" display
340
-
341
-  syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display
342
-  syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*[lL]\=\>" display
343
-else
344
-  syn match   pythonHexError	"\<0[xX]\x*[g-zG-Z]\x*\>" display
345
-  syn match   pythonOctError	"\<0[oO]\=\o*\D\+\d*\>" display
346
-  syn match   pythonBinError	"\<0[bB][01]*\D\+\d*\>" display
347
-
348
-  syn match   pythonHexNumber	"\<0[xX]\x\+\>" display
349
-  syn match   pythonOctNumber "\<0[oO]\o\+\>" display
350
-  syn match   pythonBinNumber "\<0[bB][01]\+\>" display
351
-
352
-  syn match   pythonNumberError	"\<\d\+\D\>" display
353
-  syn match   pythonNumberError	"\<0\d\+\>" display
354
-  syn match   pythonNumber	"\<\d\>" display
355
-  syn match   pythonNumber	"\<[1-9]\d\+\>" display
356
-  syn match   pythonNumber	"\<\d\+[jJ]\>" display
357
-
358
-  syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*\>" display
359
-  syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*\>" display
360
-endif
361
-
362
-syn match   pythonFloat		"\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
363
-syn match   pythonFloat		"\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
364
-syn match   pythonFloat		"\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
365
-
366
-"
367
-" Builtin objects and types
368
-"
369
-
370
-if s:Enabled("g:python_highlight_builtin_objs")
371
-  if s:Python2Syntax()
372
-    syn keyword pythonBuiltinObj	True False None
373
-  endif
374
-  syn keyword pythonBuiltinObj	Ellipsis NotImplemented
375
-  syn keyword pythonBuiltinObj	__debug__ __doc__ __file__ __name__ __package__
376
-endif
377
-
378
-"
379
-" Builtin functions
380
-"
381
-
382
-if s:Enabled("g:python_highlight_builtin_funcs")
383
-  if s:Python2Syntax()
384
-    syn keyword pythonBuiltinFunc	apply basestring buffer callable coerce
385
-    syn keyword pythonBuiltinFunc	execfile file help intern long raw_input
386
-    syn keyword pythonBuiltinFunc	reduce reload unichr unicode xrange
387
-    if s:Enabled("g:python_print_as_function")
388
-      syn keyword pythonBuiltinFunc	print
389
-    endif
390
-  else
391
-    syn keyword pythonBuiltinFunc	ascii exec memoryview print
392
-  endif
393
-  syn keyword pythonBuiltinFunc	__import__ abs all any
394
-  syn keyword pythonBuiltinFunc	bin bool bytearray bytes
395
-  syn keyword pythonBuiltinFunc	chr classmethod cmp compile complex
396
-  syn keyword pythonBuiltinFunc	delattr dict dir divmod enumerate eval
397
-  syn keyword pythonBuiltinFunc	filter float format frozenset getattr
398
-  syn keyword pythonBuiltinFunc	globals hasattr hash hex id
399
-  syn keyword pythonBuiltinFunc	input int isinstance
400
-  syn keyword pythonBuiltinFunc	issubclass iter len list locals map max
401
-  syn keyword pythonBuiltinFunc	min next object oct open ord
402
-  syn keyword pythonBuiltinFunc	pow property range
403
-  syn keyword pythonBuiltinFunc	repr reversed round set setattr
404
-  syn keyword pythonBuiltinFunc	slice sorted staticmethod str sum super tuple
405
-  syn keyword pythonBuiltinFunc	type vars zip
406
-endif
407
-
408
-"
409
-" Builtin exceptions and warnings
410
-"
411
-
412
-if s:Enabled("g:python_highlight_exceptions")
413
-  if s:Python2Syntax()
414
-    syn keyword pythonExClass	StandardError
415
-  else
416
-    syn keyword pythonExClass	BlockingIOError ChildProcessError
417
-    syn keyword pythonExClass	ConnectionError BrokenPipeError
418
-    syn keyword pythonExClass	ConnectionAbortedError ConnectionRefusedError
419
-    syn keyword pythonExClass	ConnectionResetError FileExistsError
420
-    syn keyword pythonExClass	FileNotFoundError InterruptedError
421
-    syn keyword pythonExClass	IsADirectoryError NotADirectoryError
422
-    syn keyword pythonExClass	PermissionError ProcessLookupError TimeoutError
423
-
424
-    syn keyword pythonExClass	ResourceWarning
425
-  endif
426
-  syn keyword pythonExClass	StandardError
427
-  syn keyword pythonExClass	BaseException
428
-  syn keyword pythonExClass	Exception ArithmeticError
429
-  syn keyword pythonExClass	LookupError EnvironmentError
430
-
431
-  syn keyword pythonExClass	AssertionError AttributeError BufferError EOFError
432
-  syn keyword pythonExClass	FloatingPointError GeneratorExit IOError
433
-  syn keyword pythonExClass	ImportError IndexError KeyError
434
-  syn keyword pythonExClass	KeyboardInterrupt MemoryError NameError
435
-  syn keyword pythonExClass	NotImplementedError OSError OverflowError
436
-  syn keyword pythonExClass	ReferenceError RuntimeError StopIteration
437
-  syn keyword pythonExClass	SyntaxError IndentationError TabError
438
-  syn keyword pythonExClass	SystemError SystemExit TypeError
439
-  syn keyword pythonExClass	UnboundLocalError UnicodeError
440
-  syn keyword pythonExClass	UnicodeEncodeError UnicodeDecodeError
441
-  syn keyword pythonExClass	UnicodeTranslateError ValueError VMSError
442
-  syn keyword pythonExClass	WindowsError ZeroDivisionError
443
-
444
-  syn keyword pythonExClass	Warning UserWarning BytesWarning DeprecationWarning
445
-  syn keyword pythonExClass	PendingDepricationWarning SyntaxWarning
446
-  syn keyword pythonExClass	RuntimeWarning FutureWarning
447
-  syn keyword pythonExClass	ImportWarning UnicodeWarning
448
-endif
449
-
450
-if s:Enabled("g:python_slow_sync")
451
-  syn sync minlines=2000
452
-else
453
-  " This is fast but code inside triple quoted strings screws it up. It
454
-  " is impossible to fix because the only way to know if you are inside a
455
-  " triple quoted string is to start from the beginning of the file.
456
-  syn sync match pythonSync grouphere NONE "):$"
457
-  syn sync maxlines=200
458
-endif
459
-
460
-if version >= 508 || !exists("did_python_syn_inits")
461
-  if version <= 508
462
-    let did_python_syn_inits = 1
463
-    command -nargs=+ HiLink hi link <args>
464
-  else
465
-    command -nargs=+ HiLink hi def link <args>
466
-  endif
467
-
468
-  HiLink pythonStatement        Statement
469
-  HiLink pythonPreCondit        Statement
470
-  HiLink pythonFunction         Function
471
-  HiLink pythonConditional      Conditional
472
-  HiLink pythonRepeat           Repeat
473
-  HiLink pythonException        Exception
474
-  HiLink pythonOperator         Operator
475
-
476
-  HiLink pythonDecorator        Define
477
-  HiLink pythonDottedName       Function
478
-  HiLink pythonDot              Normal
479
-
480
-  HiLink pythonComment          Comment
481
-  HiLink pythonCoding           Special
482
-  HiLink pythonRun              Special
483
-  HiLink pythonTodo             Todo
484
-
485
-  HiLink pythonError            Error
486
-  HiLink pythonIndentError      Error
487
-  HiLink pythonSpaceError       Error
488
-
489
-  HiLink pythonString           String
490
-  HiLink pythonRawString        String
491
-
492
-  HiLink pythonUniEscape        Special
493
-  HiLink pythonUniEscapeError   Error
494
-
495
-  if s:Python2Syntax()
496
-    HiLink pythonUniString          String
497
-    HiLink pythonUniRawString       String
498
-    HiLink pythonUniRawEscape       Special
499
-    HiLink pythonUniRawEscapeError  Error
500
-  else
501
-    HiLink pythonBytes              String
502
-    HiLink pythonRawBytes           String
503
-    HiLink pythonBytesContent       String
504
-    HiLink pythonBytesError         Error
505
-    HiLink pythonBytesEscape        Special
506
-    HiLink pythonBytesEscapeError   Error
507
-  endif
508
-
509
-  HiLink pythonStrFormatting    Special
510
-  HiLink pythonStrFormat        Special
511
-  HiLink pythonStrTemplate      Special
512
-
513
-  HiLink pythonDocTest          Special
514
-  HiLink pythonDocTest2         Special
515
-
516
-  " added by aloism
517
-  HiLink pythonConvention       Define	
518
-
519
-  HiLink pythonNumber           Number
520
-  HiLink pythonHexNumber        Number
521
-  HiLink pythonOctNumber        Number
522
-  HiLink pythonBinNumber        Number
523
-  HiLink pythonFloat            Float
524
-  HiLink pythonNumberError      Error
525
-  HiLink pythonOctError         Error
526
-  HiLink pythonHexError         Error
527
-  HiLink pythonBinError         Error
528
-
529
-  HiLink pythonBuiltinObj       Structure
530
-  HiLink pythonBuiltinFunc      Function
531
-
532
-  HiLink pythonExClass          Structure
533
-
534
-  delcommand HiLink
535
-endif
536
-
537
-let b:current_syntax = "python"