annotate runtime/syntax/python.vim @ 29533:34c1f4cd0c18

Update runtime files Commit: https://github.com/vim/vim/commit/2ecbe53f452e92e941aff623f6a0b72f80e43d07 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 29 21:36:21 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Fri, 29 Jul 2022 22:45:04 +0200
parents 3a63b1e4a6f4
children b2412874362f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Python
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6070
diff changeset
3 " Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
29533
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
4 " Last Change: 2022 Jun 28
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6070
diff changeset
5 " Credits: Neil Schemenauer <nas@python.ca>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
6 " Dmitry Vasiliev
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
8 " This version is a major rewrite by Zvezdan Petkovic.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
10 " - introduced highlighting of doctests
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
11 " - updated keywords, built-ins, and exceptions
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
12 " - corrected regular expressions for
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
14 " * functions
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
15 " * decorators
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
16 " * strings
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
17 " * escapes
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
18 " * numbers
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
19 " * space error
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
21 " - corrected synchronization
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
22 " - more highlighting is ON by default, except
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
23 " - space error highlighting is OFF by default
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
25 " Optional highlighting can be controlled using these variables.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
27 " let python_no_builtin_highlight = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
28 " let python_no_doctest_code_highlight = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
29 " let python_no_doctest_highlight = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
30 " let python_no_exception_highlight = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
31 " let python_no_number_highlight = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
32 " let python_space_error_highlight = 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
34 " All the options above can be switched on together.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
35 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
36 " let python_highlight_all = 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
39 " quit when a syntax file was already loaded.
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
40 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
2587
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
44 " We need nocompatible mode in order to continue lines with backslashes.
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
45 " Original setting will be restored.
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
46 let s:cpo_save = &cpo
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
47 set cpo&vim
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
48
10319
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
49 if exists("python_no_doctest_highlight")
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
50 let python_no_doctest_code_highlight = 1
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
51 endif
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
52
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
53 if exists("python_highlight_all")
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
54 if exists("python_no_builtin_highlight")
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
55 unlet python_no_builtin_highlight
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
56 endif
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
57 if exists("python_no_doctest_code_highlight")
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
58 unlet python_no_doctest_code_highlight
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
59 endif
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
60 if exists("python_no_doctest_highlight")
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
61 unlet python_no_doctest_highlight
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
62 endif
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
63 if exists("python_no_exception_highlight")
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
64 unlet python_no_exception_highlight
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
65 endif
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
66 if exists("python_no_number_highlight")
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
67 unlet python_no_number_highlight
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
68 endif
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
69 let python_space_error_highlight = 1
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
70 endif
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
71
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
72 " Keep Python keywords in alphabetical order inside groups for easy
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
73 " comparison with the table in the 'Python Language Reference'
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
74 " https://docs.python.org/reference/lexical_analysis.html#keywords.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
75 " Groups are in the order presented in NAMING CONVENTIONS in syntax.txt.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
76 " Exceptions come last at the end of each group (class and def below).
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
77 "
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
78 " The list can be checked using:
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
79 "
26591
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
80 " python3 -c 'import keyword, pprint; pprint.pprint(keyword.kwlist + keyword.softkwlist, compact=True)'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
81 "
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 8497
diff changeset
82 syn keyword pythonStatement False None True
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
83 syn keyword pythonStatement as assert break continue del global
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
84 syn keyword pythonStatement lambda nonlocal pass return with yield
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
85 syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
86 syn keyword pythonConditional elif else if
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 syn keyword pythonRepeat for while
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 syn keyword pythonOperator and in is not or
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
89 syn keyword pythonException except finally raise try
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
90 syn keyword pythonInclude from import
7147
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 6951
diff changeset
91 syn keyword pythonAsync async await
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
29533
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
93 " Soft keywords
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
94 " These keywords do not mean anything unless used in the right context
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
95 " See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
96 " for more on this.
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
97 syn match pythonConditional "^\s*\zscase\%(\s\+.*:.*$\)\@="
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
98 syn match pythonConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@="
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
99
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
100 " Decorators
10319
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
101 " A dot must be allowed because of @MyClass.myfunc decorators.
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
102 syn match pythonDecorator "@" display contained
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
103 syn match pythonDecoratorName "@\s*\h\%(\w\|\.\)*" display contains=pythonDecorator
9975
03fa8a51e9dc commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents: 9644
diff changeset
104
10319
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
105 " Python 3.5 introduced the use of the same symbol for matrix multiplication:
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
106 " https://www.python.org/dev/peps/pep-0465/. We now have to exclude the
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
107 " symbol from highlighting when used in that context.
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
108 " Single line multiplication.
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
109 syn match pythonMatrixMultiply
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
110 \ "\%(\w\|[])]\)\s*@"
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
111 \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
112 \ transparent
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
113 " Multiplication continued on the next line after backslash.
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
114 syn match pythonMatrixMultiply
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
115 \ "[^\\]\\\s*\n\%(\s*\.\.\.\s\)\=\s\+@"
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
116 \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
117 \ transparent
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
118 " Multiplication in a parenthesized expression over multiple lines with @ at
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
119 " the start of each continued line; very similar to decorators and complex.
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
120 syn match pythonMatrixMultiply
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
121 \ "^\s*\%(\%(>>>\|\.\.\.\)\s\+\)\=\zs\%(\h\|\%(\h\|[[(]\).\{-}\%(\w\|[])]\)\)\s*\n\%(\s*\.\.\.\s\)\=\s\+@\%(.\{-}\n\%(\s*\.\.\.\s\)\=\s\+@\)*"
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
122 \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
123 \ transparent
9975
03fa8a51e9dc commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents: 9644
diff changeset
124
10319
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
125 syn match pythonFunction "\h\w*" display contained
859
99305c4c42d4 updated for version 7.0g02
vimboss
parents: 818
diff changeset
126
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
127 syn match pythonComment "#.*$" contains=pythonTodo,@Spell
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
128 syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
129
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
130 " Triple-quoted strings can contain doctests.
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6070
diff changeset
131 syn region pythonString matchgroup=pythonQuotes
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
132 \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
133 \ contains=pythonEscape,@Spell
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6070
diff changeset
134 syn region pythonString matchgroup=pythonTripleQuotes
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
135 \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
136 \ contains=pythonEscape,pythonSpaceError,pythonDoctest,@Spell
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6070
diff changeset
137 syn region pythonRawString matchgroup=pythonQuotes
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
138 \ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
139 \ contains=@Spell
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6070
diff changeset
140 syn region pythonRawString matchgroup=pythonTripleQuotes
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
141 \ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
142 \ contains=pythonSpaceError,pythonDoctest,@Spell
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
143
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
144 syn match pythonEscape +\\[abfnrtv'"\\]+ contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
145 syn match pythonEscape "\\\o\{1,3}" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
146 syn match pythonEscape "\\x\x\{2}" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
147 syn match pythonEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
148 " Python allows case-insensitive Unicode IDs: http://www.unicode.org/charts/
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6070
diff changeset
149 syn match pythonEscape "\\N{\a\+\%(\s\a\+\)*}" contained
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
150 syn match pythonEscape "\\$"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
152 " It is very important to understand all details before changing the
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
153 " regular expressions below or their order.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
154 " The word boundaries are *not* the floating-point number boundaries
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
155 " because of a possible leading or trailing decimal point.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
156 " The expressions below ensure that all valid number literals are
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
157 " highlighted, and invalid number literals are not. For example,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
158 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
159 " - a decimal point in '4.' at the end of a line is highlighted,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
160 " - a second dot in 1.0.0 is not highlighted,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
161 " - 08 is not highlighted,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
162 " - 08e0 or 08j are highlighted,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
163 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
164 " and so on, as specified in the 'Python Language Reference'.
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
165 " https://docs.python.org/reference/lexical_analysis.html#numeric-literals
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
166 if !exists("python_no_number_highlight")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 " numbers (including longs and complex)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
168 syn match pythonNumber "\<0[oO]\=\o\+[Ll]\=\>"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
169 syn match pythonNumber "\<0[xX]\x\+[Ll]\=\>"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
170 syn match pythonNumber "\<0[bB][01]\+[Ll]\=\>"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
171 syn match pythonNumber "\<\%([1-9]\d*\|0\)[Ll]\=\>"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
172 syn match pythonNumber "\<\d\+[jJ]\>"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
173 syn match pythonNumber "\<\d\+[eE][+-]\=\d\+[jJ]\=\>"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
174 syn match pythonNumber
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
175 \ "\<\d\+\.\%([eE][+-]\=\d\+\)\=[jJ]\=\%(\W\|$\)\@="
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
176 syn match pythonNumber
6951
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
177 \ "\%(^\|\W\)\zs\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
180 " Group the built-ins in the order in the 'Python Library Reference' for
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
181 " easier comparison.
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
182 " https://docs.python.org/library/constants.html
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
183 " http://docs.python.org/library/functions.html
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
184 " Python built-in functions are in alphabetical order.
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
185 "
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
186 " The list can be checked using:
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
187 "
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
188 " python3 -c 'import builtins, pprint; pprint.pprint(dir(builtins), compact=True)'
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
189 "
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
190 " The constants added by the `site` module are not listed below because they
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
191 " should not be used in programs, only in interactive interpreter.
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
192 " Similarly for some other attributes and functions `__`-enclosed from the
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
193 " output of the above command.
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
194 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
195 if !exists("python_no_builtin_highlight")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
196 " built-in constants
6951
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
197 " 'False', 'True', and 'None' are also reserved words in Python 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
198 syn keyword pythonBuiltin False True None
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
199 syn keyword pythonBuiltin NotImplemented Ellipsis __debug__
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
200 " constants added by the `site` module
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
201 syn keyword pythonBuiltin quit exit copyright credits license
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
202 " built-in functions
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
203 syn keyword pythonBuiltin abs all any ascii bin bool breakpoint bytearray
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
204 syn keyword pythonBuiltin bytes callable chr classmethod compile complex
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
205 syn keyword pythonBuiltin delattr dict dir divmod enumerate eval exec
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
206 syn keyword pythonBuiltin filter float format frozenset getattr globals
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
207 syn keyword pythonBuiltin hasattr hash help hex id input int isinstance
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
208 syn keyword pythonBuiltin issubclass iter len list locals map max
6951
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
209 syn keyword pythonBuiltin memoryview min next object oct open ord pow
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
210 syn keyword pythonBuiltin print property range repr reversed round set
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
211 syn keyword pythonBuiltin setattr slice sorted staticmethod str sum super
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
212 syn keyword pythonBuiltin tuple type vars zip __import__
8497
da01d5da2cfa commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents: 7147
diff changeset
213 " avoid highlighting attributes as builtins
10319
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
214 syn match pythonAttribute /\.\h\w*/hs=s+1
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
215 \ contains=ALLBUT,pythonBuiltin,pythonFunction,pythonAsync
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
216 \ transparent
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
219 " From the 'Python Library Reference' class hierarchy at the bottom.
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
220 " http://docs.python.org/library/exceptions.html
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
221 if !exists("python_no_exception_highlight")
6951
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
222 " builtin base exceptions (used mostly as base classes for other exceptions)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
223 syn keyword pythonExceptions BaseException Exception
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
224 syn keyword pythonExceptions ArithmeticError BufferError LookupError
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
225 " builtin exceptions (actually raised)
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
226 syn keyword pythonExceptions AssertionError AttributeError EOFError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
227 syn keyword pythonExceptions FloatingPointError GeneratorExit ImportError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
228 syn keyword pythonExceptions IndentationError IndexError KeyError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
229 syn keyword pythonExceptions KeyboardInterrupt MemoryError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
230 syn keyword pythonExceptions ModuleNotFoundError NameError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
231 syn keyword pythonExceptions NotImplementedError OSError OverflowError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
232 syn keyword pythonExceptions RecursionError ReferenceError RuntimeError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
233 syn keyword pythonExceptions StopAsyncIteration StopIteration SyntaxError
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
234 syn keyword pythonExceptions SystemError SystemExit TabError TypeError
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
235 syn keyword pythonExceptions UnboundLocalError UnicodeDecodeError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
236 syn keyword pythonExceptions UnicodeEncodeError UnicodeError
6951
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
237 syn keyword pythonExceptions UnicodeTranslateError ValueError
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
238 syn keyword pythonExceptions ZeroDivisionError
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
239 " builtin exception aliases for OSError
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
240 syn keyword pythonExceptions EnvironmentError IOError WindowsError
6951
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
241 " builtin OS exceptions in Python 3
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
242 syn keyword pythonExceptions BlockingIOError BrokenPipeError
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
243 syn keyword pythonExceptions ChildProcessError ConnectionAbortedError
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
244 syn keyword pythonExceptions ConnectionError ConnectionRefusedError
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
245 syn keyword pythonExceptions ConnectionResetError FileExistsError
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
246 syn keyword pythonExceptions FileNotFoundError InterruptedError
b2673982c625 Updated and new runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6840
diff changeset
247 syn keyword pythonExceptions IsADirectoryError NotADirectoryError
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
248 syn keyword pythonExceptions PermissionError ProcessLookupError TimeoutError
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
249 " builtin warnings
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
250 syn keyword pythonExceptions BytesWarning DeprecationWarning FutureWarning
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
251 syn keyword pythonExceptions ImportWarning PendingDeprecationWarning
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
252 syn keyword pythonExceptions ResourceWarning RuntimeWarning
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10319
diff changeset
253 syn keyword pythonExceptions SyntaxWarning UnicodeWarning
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
254 syn keyword pythonExceptions UserWarning Warning
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
257 if exists("python_space_error_highlight")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 " trailing whitespace
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
259 syn match pythonSpaceError display excludenl "\s\+$"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 " mixed tabs and spaces
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
261 syn match pythonSpaceError display " \+\t"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
262 syn match pythonSpaceError display "\t\+ "
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
265 " Do not spell doctests inside strings.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
266 " Notice that the end of a string, either ''', or """, will end the contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
267 " doctest too. Thus, we do *not* need to have it as an end pattern.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
268 if !exists("python_no_doctest_highlight")
4186
7ffc704cb7c1 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2587
diff changeset
269 if !exists("python_no_doctest_code_highlight")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
270 syn region pythonDoctest
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
271 \ start="^\s*>>>\s" end="^\s*$"
10319
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
272 \ contained contains=ALLBUT,pythonDoctest,pythonFunction,@Spell
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
273 syn region pythonDoctestValue
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
274 \ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
275 \ contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
276 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
277 syn region pythonDoctest
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
278 \ start="^\s*>>>" end="^\s*$"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
279 \ contained contains=@NoSpell
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
280 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
281 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
282
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
283 " Sync at the beginning of class, function, or method definition.
10319
169a62d5bcb9 commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents: 10211
diff changeset
284 syn sync match pythonSync grouphere NONE "^\%(def\|class\)\s\+\h\w*\s*[(:]"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
286 " The default highlight links. Can be overridden later.
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
287 hi def link pythonStatement Statement
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
288 hi def link pythonConditional Conditional
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
289 hi def link pythonRepeat Repeat
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
290 hi def link pythonOperator Operator
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
291 hi def link pythonException Exception
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
292 hi def link pythonInclude Include
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
293 hi def link pythonAsync Statement
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
294 hi def link pythonDecorator Define
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
295 hi def link pythonDecoratorName Function
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
296 hi def link pythonFunction Function
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
297 hi def link pythonComment Comment
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
298 hi def link pythonTodo Todo
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
299 hi def link pythonString String
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
300 hi def link pythonRawString String
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
301 hi def link pythonQuotes String
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
302 hi def link pythonTripleQuotes pythonQuotes
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
303 hi def link pythonEscape Special
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
304 if !exists("python_no_number_highlight")
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
305 hi def link pythonNumber Number
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
306 endif
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
307 if !exists("python_no_builtin_highlight")
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
308 hi def link pythonBuiltin Function
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
309 endif
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
310 if !exists("python_no_exception_highlight")
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
311 hi def link pythonExceptions Structure
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
312 endif
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
313 if exists("python_space_error_highlight")
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
314 hi def link pythonSpaceError Error
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
315 endif
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
316 if !exists("python_no_doctest_highlight")
10211
b7da8d4c594c commit https://github.com/vim/vim/commit/d07969093a9b3051511c478d71c36de6fc33c0d6
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
317 hi def link pythonDoctest Special
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
318 hi def link pythonDoctestValue Define
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
319 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 let b:current_syntax = "python"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322
2587
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
323 let &cpo = s:cpo_save
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
324 unlet s:cpo_save
d0049ff5969e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
325
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1125
diff changeset
326 " vim:set sw=2 sts=2 ts=8 noet: