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