Browse Source

Merge python.vim and python3.0.vim into python.vim

Merge Python 3 and Python 3 script versions into
the single python.vim script
Dmitry Vasilev 11 years ago
parent
commit
325c3a50ce
5 changed files with 407 additions and 615 deletions
  1. 5
    0
      CHANGES.txt
  2. 1
    2
      TODO.txt
  3. 397
    242
      python.vim
  4. 0
    370
      python3.0.vim
  5. 4
    1
      test.py

+ 5
- 0
CHANGES.txt View File

1
+Revision 3.3.0 (2013-03-10):
2
+
3
+    - Merge Python 2 and Python 3 script versions into the single python.vim
4
+      script
5
+
1
 Revision 3.0.7 (2012-02-11):
6
 Revision 3.0.7 (2012-02-11):
2
 
7
 
3
     - Updated email and URL
8
     - Updated email and URL

+ 1
- 2
TODO.txt View File

3
 
3
 
4
 - Add support for slice syntax:
4
 - Add support for slice syntax:
5
   http://img155.imageshack.us/img155/7767/screenshotgs.png
5
   http://img155.imageshack.us/img155/7767/screenshotgs.png
6
+
6
 - When we check spelling we don't need to check the whole strings only the
7
 - When we check spelling we don't need to check the whole strings only the
7
   content. For example we don't need to check 'u' for spelling in strings
8
   content. For example we don't need to check 'u' for spelling in strings
8
   like this: u"Some text";
9
   like this: u"Some text";
10
 Later
11
 Later
11
 =====
12
 =====
12
 
13
 
13
-- Highligh errors where symbols follow by numbers like this: 0o123LaB
14
-
15
 - Need more accurate way to handle indentation errors. For example
14
 - Need more accurate way to handle indentation errors. For example
16
   mixing spaces and tabs may be used for pretty formatting;
15
   mixing spaces and tabs may be used for pretty formatting;
17
 
16
 

+ 397
- 242
python.vim View File

1
 " Vim syntax file
1
 " Vim syntax file
2
 " Language:     Python
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
 " Based on python.vim (from Vim 6.1 distribution)
9
 " Based on python.vim (from Vim 6.1 distribution)
10
 " by Neil Schemenauer <nas at python dot ca>
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
 " For version 5.x: Clear all syntax items
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
 if version < 600
82
 if version < 600
77
   syntax clear
83
   syntax clear
78
 elseif exists("b:current_syntax")
84
 elseif exists("b:current_syntax")
79
   finish
85
   finish
80
 endif
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
   endif
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
   endif
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
 endif
131
 endif
114
 
132
 
133
+"
115
 " Keywords
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
 endif
159
 endif
133
 
160
 
161
+"
134
 " Decorators (new in Python 2.4)
162
 " Decorators (new in Python 2.4)
163
+"
164
+
135
 syn match   pythonDecorator	"@" display nextgroup=pythonDottedName skipwhite
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
 syn match   pythonDot        "\." display containedin=pythonDottedName
167
 syn match   pythonDot        "\." display containedin=pythonDottedName
138
 
168
 
169
+"
139
 " Comments
170
 " Comments
171
+"
172
+
140
 syn match   pythonComment	"#.*$" display contains=pythonTodo,@Spell
173
 syn match   pythonComment	"#.*$" display contains=pythonTodo,@Spell
141
 syn match   pythonRun		"\%^#!.*$"
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
 syn keyword pythonTodo		TODO FIXME XXX contained
176
 syn keyword pythonTodo		TODO FIXME XXX contained
144
 
177
 
178
+"
145
 " Errors
179
 " Errors
180
+"
181
+
146
 syn match pythonError		"\<\d\+\D\+\>" display
182
 syn match pythonError		"\<\d\+\D\+\>" display
147
 syn match pythonError		"[$?]" display
183
 syn match pythonError		"[$?]" display
148
 syn match pythonError		"[&|]\{2,}" display
184
 syn match pythonError		"[&|]\{2,}" display
149
 syn match pythonError		"[=]\{3,}" display
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
 endif
191
 endif
156
 
192
 
157
 " Trailing space errors
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
   syn match pythonSpaceError	"\s\+$" display
195
   syn match pythonSpaceError	"\s\+$" display
160
 endif
196
 endif
161
 
197
 
198
+"
162
 " Strings
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
 endif
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
   " str.format syntax
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
 endif
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
 endif
311
 endif
223
 
312
 
224
-if exists("python_highlight_doctests") && python_highlight_doctests != 0
313
+if s:Enabled("g:python_highlight_doctests")
225
   " DocTests
314
   " DocTests
226
   syn region pythonDocTest	start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
315
   syn region pythonDocTest	start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
227
   syn region pythonDocTest2	start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
316
   syn region pythonDocTest2	start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
228
 endif
317
 endif
229
 
318
 
319
+"
230
 " Numbers (ints, longs, floats, complex)
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
 syn match   pythonFloat		"\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
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
   syn keyword pythonBuiltinObj	__debug__ __doc__ __file__ __name__ __package__
371
   syn keyword pythonBuiltinObj	__debug__ __doc__ __file__ __name__ __package__
250
 endif
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
   syn keyword pythonBuiltinFunc	delattr dict dir divmod enumerate eval
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
   syn keyword pythonBuiltinFunc	min next object oct open ord
397
   syn keyword pythonBuiltinFunc	min next object oct open ord
263
   syn keyword pythonBuiltinFunc	pow property range
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
   syn keyword pythonBuiltinFunc	slice sorted staticmethod str sum super tuple
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
 endif
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
   syn keyword pythonExClass	BaseException
422
   syn keyword pythonExClass	BaseException
277
-  syn keyword pythonExClass	Exception StandardError ArithmeticError
423
+  syn keyword pythonExClass	Exception ArithmeticError
278
   syn keyword pythonExClass	LookupError EnvironmentError
424
   syn keyword pythonExClass	LookupError EnvironmentError
279
 
425
 
280
   syn keyword pythonExClass	AssertionError AttributeError BufferError EOFError
426
   syn keyword pythonExClass	AssertionError AttributeError BufferError EOFError
296
   syn keyword pythonExClass	ImportWarning UnicodeWarning
442
   syn keyword pythonExClass	ImportWarning UnicodeWarning
297
 endif
443
 endif
298
 
444
 
299
-if exists("python_slow_sync") && python_slow_sync != 0
445
+if s:Enabled("g:python_slow_sync")
300
   syn sync minlines=2000
446
   syn sync minlines=2000
301
 else
447
 else
302
   " This is fast but code inside triple quoted strings screws it up. It
448
   " This is fast but code inside triple quoted strings screws it up. It
314
     command -nargs=+ HiLink hi def link <args>
460
     command -nargs=+ HiLink hi def link <args>
315
   endif
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
   delcommand HiLink
526
   delcommand HiLink
372
 endif
527
 endif

+ 0
- 370
python3.0.vim View File

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/python3.0.vim
5
-" Last Change:	2012-02-11
6
-" Filenames:	*.py
7
-" Version:	    3.0.7
8
-"
9
-" Based on python.vim (from Vim 6.1 distribution)
10
-" by Neil Schemenauer <nas at python dot ca>
11
-"
12
-" Thanks:
13
-"
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
-"    Anton Butanaev
26
-"        for the patch fixing bytes literals highlighting
27
-"        for the patch fixing str.format syntax highlighting
28
-
29
-"
30
-" Options:
31
-"
32
-"    For set option do: let OPTION_NAME = 1
33
-"    For clear option do: let OPTION_NAME = 0
34
-"
35
-" Option names:
36
-"
37
-"    For highlight builtin functions:
38
-"       python_highlight_builtins
39
-"
40
-"    For highlight builtin objects:
41
-"       python_highlight_builtin_objs
42
-"
43
-"    For highlight builtin funtions:
44
-"       python_highlight_builtin_funcs
45
-"
46
-"    For highlight standard exceptions:
47
-"       python_highlight_exceptions
48
-"
49
-"    For highlight string formatting:
50
-"       python_highlight_string_formatting
51
-"
52
-"    For highlight str.format syntax:
53
-"       python_highlight_string_format
54
-"
55
-"    For highlight string.Template syntax:
56
-"       python_highlight_string_templates
57
-"
58
-"    For highlight indentation errors:
59
-"       python_highlight_indent_errors
60
-"
61
-"    For highlight trailing spaces:
62
-"       python_highlight_space_errors
63
-"
64
-"    For highlight doc-tests:
65
-"       python_highlight_doctests
66
-"
67
-"    If you want all Python highlightings above:
68
-"       python_highlight_all
69
-"    (This option not override previously set options)
70
-"
71
-"    For fast machines:
72
-"       python_slow_sync
73
-
74
-" For version 5.x: Clear all syntax items
75
-" For version 6.x: Quit when a syntax file was already loaded
76
-if version < 600
77
-  syntax clear
78
-elseif exists("b:current_syntax")
79
-  finish
80
-endif
81
-
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
109
-  endif
110
-  if !exists("python_highlight_doctests")
111
-    let python_highlight_doctests = 1
112
-  endif
113
-endif
114
-
115
-" Keywords
116
-syn keyword pythonStatement	break continue del
117
-syn keyword pythonStatement	exec return as
118
-syn keyword pythonStatement	pass raise
119
-syn keyword pythonStatement	global assert
120
-syn keyword pythonStatement	lambda yield
121
-syn keyword pythonStatement	with nonlocal
122
-syn keyword pythonStatement	False None True
123
-syn keyword pythonStatement	def class nextgroup=pythonFunction skipwhite
124
-syn match   pythonFunction	"\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
125
-syn keyword pythonRepeat	for while
126
-syn keyword pythonConditional	if elif else
127
-syn keyword pythonPreCondit	import from
128
-syn keyword pythonException	try except finally
129
-syn keyword pythonOperator	and in is not or
130
-
131
-" Decorators (new in Python 2.4)
132
-syn match   pythonDecorator	"@" display nextgroup=pythonDottedName skipwhite
133
-syn match   pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained
134
-syn match   pythonDot        "\." display containedin=pythonDottedName
135
-
136
-" Comments
137
-syn match   pythonComment	"#.*$" display contains=pythonTodo,@Spell
138
-syn match   pythonRun		"\%^#!.*$"
139
-syn match   pythonCoding	"\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
140
-syn keyword pythonTodo		TODO FIXME XXX contained
141
-
142
-" Errors
143
-syn match pythonError		"\<\d\+\D\+\>" display
144
-syn match pythonError		"[$?]" display
145
-syn match pythonError		"[&|]\{2,}" display
146
-syn match pythonError		"[=]\{3,}" display
147
-
148
-" TODO: Mixing spaces and tabs also may be used for pretty formatting multiline
149
-" statements. For now I don't know how to work around this.
150
-if exists("python_highlight_indent_errors") && python_highlight_indent_errors != 0
151
-  syn match pythonIndentError	"^\s*\%( \t\|\t \)\s*\S"me=e-1 display
152
-endif
153
-
154
-" Trailing space errors
155
-if exists("python_highlight_space_errors") && python_highlight_space_errors != 0
156
-  syn match pythonSpaceError	"\s\+$" display
157
-endif
158
-
159
-" Strings
160
-syn region pythonString		start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
161
-syn region pythonString		start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
162
-syn region pythonString		start=+"""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spell
163
-syn region pythonString		start=+'''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell
164
-
165
-syn match  pythonEscape		    +\\[abfnrtv'"\\]+ display contained
166
-syn match  pythonEscape		    "\\\o\o\=\o\=" display contained
167
-syn match  pythonEscapeError	"\\\o\{,2}[89]" display contained
168
-syn match  pythonEscape		    "\\x\x\{2}" display contained
169
-syn match  pythonEscapeError	"\\x\x\=\X" display contained
170
-syn match  pythonEscape		    "\\$"
171
-syn match  pythonEscape         "\\u\x\{4}" display contained
172
-syn match  pythonEscapeError	"\\u\x\{,3}\X" display contained
173
-syn match  pythonEscape	        "\\U\x\{8}" display contained
174
-syn match  pythonEscapeError	"\\U\x\{,7}\X" display contained
175
-syn match  pythonEscape	        "\\N{[A-Z ]\+}" display contained
176
-syn match  pythonEscapeError	"\\N{[^A-Z ]\+}" display contained
177
-
178
-" Raw strings
179
-syn region pythonRawString	start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
180
-syn region pythonRawString	start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
181
-syn region pythonRawString	start=+[bB]\=[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
182
-syn region pythonRawString	start=+[bB]\=[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
183
-
184
-syn match pythonRawEscape	+\\['"]+ display transparent contained
185
-
186
-" Bytes
187
-syn region pythonBytes		start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
188
-syn region pythonBytes		start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
189
-syn region pythonBytes		start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
190
-syn region pythonBytes		start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
191
-
192
-syn match pythonBytesError    ".\+" display contained
193
-syn match pythonBytesContent    "[\u0000-\u00ff]\+" display contained contains=pythonBytesEscape,pythonBytesEscapeError
194
-
195
-syn match pythonBytesEscape	    +\\[abfnrtv'"\\]+ display contained
196
-syn match pythonBytesEscape	    "\\\o\o\=\o\=" display contained
197
-syn match pythonBytesEscapeError	"\\\o\{,2}[89]" display contained
198
-syn match pythonBytesEscape	    "\\x\x\{2}" display contained
199
-syn match pythonBytesEscapeError	"\\x\x\=\X" display contained
200
-syn match pythonBytesEscape	    "\\$"
201
-
202
-if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0
203
-  " String formatting
204
-  syn match pythonStrFormatting	"%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
205
-  syn match pythonStrFormatting	"%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
206
-endif
207
-
208
-if exists("python_highlight_string_format") && python_highlight_string_format != 0
209
-  " str.format syntax
210
-  syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString
211
-  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
212
-endif
213
-
214
-if exists("python_highlight_string_templates") && python_highlight_string_templates != 0
215
-  " String templates
216
-  syn match pythonStrTemplate	"\$\$" contained containedin=pythonString,pythonRawString
217
-  syn match pythonStrTemplate	"\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonRawString
218
-  syn match pythonStrTemplate	"\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonRawString
219
-endif
220
-
221
-if exists("python_highlight_doctests") && python_highlight_doctests != 0
222
-  " DocTests
223
-  syn region pythonDocTest	start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
224
-  syn region pythonDocTest2	start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
225
-endif
226
-
227
-" Numbers (ints, longs, floats, complex)
228
-syn match   pythonHexError	"\<0[xX]\x*[g-zG-Z]\x*\>" display
229
-
230
-syn match   pythonHexNumber	"\<0[xX]\x\+\>" display
231
-syn match   pythonOctNumber "\<0[oO]\o\+\>" display
232
-syn match   pythonBinNumber "\<0[bB][01]\+\>" display
233
-
234
-syn match   pythonNumberError	"\<\d\+\D\>" display
235
-syn match   pythonNumberError	"\<0\d\+\>" display
236
-syn match   pythonNumber	"\<\d\>" display
237
-syn match   pythonNumber	"\<[1-9]\d\+\>" display
238
-syn match   pythonNumber	"\<\d\+[jJ]\>" display
239
-
240
-syn match   pythonFloat		"\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
241
-syn match   pythonFloat		"\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
242
-syn match   pythonFloat		"\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
243
-
244
-syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*\>" display
245
-syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*\>" display
246
-
247
-if exists("python_highlight_builtin_objs") && python_highlight_builtin_objs != 0
248
-  " Builtin objects and types
249
-  syn keyword pythonBuiltinObj	Ellipsis NotImplemented
250
-  syn keyword pythonBuiltinObj	__debug__ __doc__ __file__ __name__ __package__
251
-endif
252
-
253
-if exists("python_highlight_builtin_funcs") && python_highlight_builtin_funcs != 0
254
-  " Builtin functions
255
-  syn keyword pythonBuiltinFunc	__import__ abs all any ascii
256
-  syn keyword pythonBuiltinFunc	bin bool bytearray bytes
257
-  syn keyword pythonBuiltinFunc	chr classmethod cmp compile complex
258
-  syn keyword pythonBuiltinFunc	delattr dict dir divmod enumerate eval
259
-  syn keyword pythonBuiltinFunc	exec filter float format frozenset getattr
260
-  syn keyword pythonBuiltinFunc	globals hasattr hash hex id
261
-  syn keyword pythonBuiltinFunc	input int isinstance
262
-  syn keyword pythonBuiltinFunc	issubclass iter len list locals map max
263
-  syn keyword pythonBuiltinFunc	memoryview min next object oct open ord
264
-  syn keyword pythonBuiltinFunc	pow print property range
265
-  syn keyword pythonBuiltinFunc	repr reversed round set setattr
266
-  syn keyword pythonBuiltinFunc	slice sorted staticmethod str sum super tuple
267
-  syn keyword pythonBuiltinFunc	type vars zip
268
-endif
269
-
270
-if exists("python_highlight_exceptions") && python_highlight_exceptions != 0
271
-  " Builtin exceptions and warnings
272
-  syn keyword pythonExClass	BaseException
273
-  syn keyword pythonExClass	Exception ArithmeticError
274
-  syn keyword pythonExClass	LookupError EnvironmentError
275
-
276
-  syn keyword pythonExClass	AssertionError AttributeError BufferError EOFError
277
-  syn keyword pythonExClass	FloatingPointError GeneratorExit IOError
278
-  syn keyword pythonExClass	ImportError IndexError KeyError
279
-  syn keyword pythonExClass	KeyboardInterrupt MemoryError NameError
280
-  syn keyword pythonExClass	NotImplementedError OSError OverflowError
281
-  syn keyword pythonExClass	ReferenceError RuntimeError StopIteration
282
-  syn keyword pythonExClass	SyntaxError IndentationError TabError
283
-  syn keyword pythonExClass	SystemError SystemExit TypeError
284
-  syn keyword pythonExClass	UnboundLocalError UnicodeError
285
-  syn keyword pythonExClass	UnicodeEncodeError UnicodeDecodeError
286
-  syn keyword pythonExClass	UnicodeTranslateError ValueError VMSError
287
-  syn keyword pythonExClass	WindowsError ZeroDivisionError
288
-
289
-  syn keyword pythonExClass	Warning UserWarning BytesWarning DeprecationWarning
290
-  syn keyword pythonExClass	PendingDepricationWarning SyntaxWarning
291
-  syn keyword pythonExClass	RuntimeWarning FutureWarning
292
-  syn keyword pythonExClass	ImportWarning UnicodeWarning
293
-endif
294
-
295
-if exists("python_slow_sync") && python_slow_sync != 0
296
-  syn sync minlines=2000
297
-else
298
-  " This is fast but code inside triple quoted strings screws it up. It
299
-  " is impossible to fix because the only way to know if you are inside a
300
-  " triple quoted string is to start from the beginning of the file.
301
-  syn sync match pythonSync grouphere NONE "):$"
302
-  syn sync maxlines=200
303
-endif
304
-
305
-if version >= 508 || !exists("did_python_syn_inits")
306
-  if version <= 508
307
-    let did_python_syn_inits = 1
308
-    command -nargs=+ HiLink hi link <args>
309
-  else
310
-    command -nargs=+ HiLink hi def link <args>
311
-  endif
312
-
313
-  HiLink pythonStatement	Statement
314
-  HiLink pythonPreCondit	Statement
315
-  HiLink pythonFunction		Function
316
-  HiLink pythonConditional	Conditional
317
-  HiLink pythonRepeat		Repeat
318
-  HiLink pythonException	Exception
319
-  HiLink pythonOperator		Operator
320
-
321
-  HiLink pythonDecorator	Define
322
-  HiLink pythonDottedName	Function
323
-  HiLink pythonDot          Normal
324
-
325
-  HiLink pythonComment		Comment
326
-  HiLink pythonCoding		Special
327
-  HiLink pythonRun		Special
328
-  HiLink pythonTodo		Todo
329
-
330
-  HiLink pythonError		Error
331
-  HiLink pythonIndentError	Error
332
-  HiLink pythonSpaceError	Error
333
-
334
-  HiLink pythonString		String
335
-  HiLink pythonRawString	String
336
-  HiLink pythonEscape			Special
337
-  HiLink pythonEscapeError		Error
338
-
339
-  HiLink pythonBytes		    String
340
-  HiLink pythonBytesContent	    String
341
-  HiLink pythonBytesError	    Error
342
-  HiLink pythonBytesEscape		Special
343
-  HiLink pythonBytesEscapeError	Error
344
-
345
-  HiLink pythonStrFormatting	Special
346
-  HiLink pythonStrFormat    	Special
347
-  HiLink pythonStrTemplate	    Special
348
-
349
-  HiLink pythonDocTest		Special
350
-  HiLink pythonDocTest2		Special
351
-
352
-  HiLink pythonNumber		Number
353
-  HiLink pythonHexNumber	Number
354
-  HiLink pythonOctNumber	Number
355
-  HiLink pythonBinNumber	Number
356
-  HiLink pythonFloat		Float
357
-  HiLink pythonNumberError  Error
358
-  HiLink pythonOctError	    Error
359
-  HiLink pythonHexError		Error
360
-  HiLink pythonBinError		Error
361
-
362
-  HiLink pythonBuiltinObj	Structure
363
-  HiLink pythonBuiltinFunc	Function
364
-
365
-  HiLink pythonExClass	Structure
366
-
367
-  delcommand HiLink
368
-endif
369
-
370
-let b:current_syntax = "python"

+ 4
- 1
test.py View File

42
 UnicodeTranslateError ValueError WindowsError ZeroDivisionError
42
 UnicodeTranslateError ValueError WindowsError ZeroDivisionError
43
 
43
 
44
 Warning UserWarning DeprecationWarning PendingDepricationWarning SyntaxWarning
44
 Warning UserWarning DeprecationWarning PendingDepricationWarning SyntaxWarning
45
-RuntimeWarning FutureWarning OverflowWarning ImportWarning UnicodeWarning
45
+RuntimeWarning FutureWarning ImportWarning UnicodeWarning
46
 
46
 
47
 # Decorators.
47
 # Decorators.
48
 
48
 
85
 # Formattings
85
 # Formattings
86
 
86
 
87
 " %f "
87
 " %f "
88
+b" %f "
88
 
89
 
89
 "{0.name!r:b} {0[n]} {name!s:  } {{test}} {{}} {} {.__len__:s}"
90
 "{0.name!r:b} {0[n]} {name!s:  } {{test}} {{}} {} {.__len__:s}"
91
+b"{0.name!r:b} {0[n]} {name!s:  } {{test}} {{}} {} {.__len__:s}"
90
 
92
 
91
 "${test} ${test ${test}aname $$$ $test+nope"
93
 "${test} ${test ${test}aname $$$ $test+nope"
94
+b"${test} ${test ${test}aname $$$ $test+nope"
92
 
95
 
93
 # Doctests.
96
 # Doctests.
94
 
97