Skip to content

Commit 9f7d4af

Browse files
committed
Fixed highlighting for bytes and numbers
1 parent 607f75e commit 9f7d4af

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Revision 3.0.5 (2010-11-11):
2+
3+
- Fixed highlighting for bytes. Patch by Anton Butanaev.
4+
- Fixed highlighting for numbers.
5+
16
Revision 3.0.4 (2010-11-09):
27

38
- Fixed highlighting for raw bytes literals. Patch by Anton Butanaev.

python3.0.vim

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
" Language: Python
33
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
44
" URL: http://www.hlabs.spb.ru/vim/python3.0.vim
5-
" Last Change: 2010-11-09
5+
" Last Change: 2010-11-11
66
" Filenames: *.py
7-
" Version: 3.0.4
7+
" Version: 3.0.5
88
"
99
" Based on python.vim (from Vim 6.1 distribution)
1010
" by Neil Schemenauer <nas@python.ca>
@@ -23,7 +23,7 @@
2323
" Andrea Riciputi
2424
" for the patch with new configuration options
2525
" Anton Butanaev
26-
" for the patch fixing raw bytes literals highlighting
26+
" for the patch fixing bytes literals highlighting
2727

2828
"
2929
" Options:
@@ -139,7 +139,7 @@ syn match pythonCoding "\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
139139
syn keyword pythonTodo TODO FIXME XXX contained
140140

141141
" Errors
142-
" syn match pythonError "\<\d\+\D\+\>" display
142+
syn match pythonError "\<\d\+\D\+\>" display
143143
syn match pythonError "[$?]" display
144144
syn match pythonError "[&|]\{2,}" display
145145
syn match pythonError "[=]\{3,}" display
@@ -183,13 +183,13 @@ syn region pythonRawString start=+[bB]\=[rR]'''+ end=+'''+ keepend contains=pyth
183183
syn match pythonRawEscape +\\['"]+ display transparent contained
184184

185185
" Bytes
186-
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,@Spell
187-
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,@Spell
188-
syn region pythonBytes start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,pythonDocTest2,pythonSpaceError,@Spell
189-
syn region pythonBytes start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,pythonDocTest,pythonSpaceError,@Spell
186+
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
187+
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
188+
syn region pythonBytes start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
189+
syn region pythonBytes start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
190190

191-
syn match pythonBytesContent "[\u0001-\u007f]\+" display contained
192-
syn match pythonBytesError "[^\u0001-\u007f]\+" display contained
191+
syn match pythonBytesError ".\+" display contained
192+
syn match pythonBytesContent "[\u0000-\u00ff]\+" display contained contains=pythonBytesEscape,pythonBytesEscapeError
193193

194194
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
195195
syn match pythonBytesEscape "\\\o\o\=\o\=" display contained
@@ -230,10 +230,11 @@ syn match pythonHexNumber "\<0[xX]\x\+\>" display
230230
syn match pythonOctNumber "\<0[oO]\o\+\>" display
231231
syn match pythonBinNumber "\<0[bB][01]\+\>" display
232232

233+
syn match pythonNumberError "\<\d\+\D\>" display
234+
syn match pythonNumberError "\<0\d\+\>" display
233235
syn match pythonNumber "\<\d\>" display
234236
syn match pythonNumber "\<[1-9]\d\+\>" display
235237
syn match pythonNumber "\<\d\+[jJ]\>" display
236-
syn match pythonNumberError "\<0\d\+\>" display
237238

238239
syn match pythonFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
239240
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display

test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Класс
5151

5252
# Numbers
5353

54-
0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77
54+
0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77 1023434 0x0
5555

5656
# Erroneous numbers
5757

@@ -74,11 +74,13 @@ class Класс
7474

7575
b"test"
7676

77+
b"test\r\n\xffff"
78+
7779
b"тестtest"
7880

7981
br"test"
8082

81-
br"\a\b"
83+
br"\a\b\n\r"
8284

8385
# Formattings
8486

0 commit comments

Comments
 (0)