mirror of
https://github.com/vim-python/python-syntax.git
synced 2025-12-08 13:44:48 +08:00
Fixed highlighting for bytes and numbers
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Revision 3.0.5 (2010-11-11):
|
||||||
|
|
||||||
|
- Fixed highlighting for bytes. Patch by Anton Butanaev.
|
||||||
|
- Fixed highlighting for numbers.
|
||||||
|
|
||||||
Revision 3.0.4 (2010-11-09):
|
Revision 3.0.4 (2010-11-09):
|
||||||
|
|
||||||
- Fixed highlighting for raw bytes literals. Patch by Anton Butanaev.
|
- Fixed highlighting for raw bytes literals. Patch by Anton Butanaev.
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
" Language: Python
|
" Language: Python
|
||||||
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
|
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
|
||||||
" URL: http://www.hlabs.spb.ru/vim/python3.0.vim
|
" URL: http://www.hlabs.spb.ru/vim/python3.0.vim
|
||||||
" Last Change: 2010-11-09
|
" Last Change: 2010-11-11
|
||||||
" Filenames: *.py
|
" Filenames: *.py
|
||||||
" Version: 3.0.4
|
" Version: 3.0.5
|
||||||
"
|
"
|
||||||
" Based on python.vim (from Vim 6.1 distribution)
|
" Based on python.vim (from Vim 6.1 distribution)
|
||||||
" by Neil Schemenauer <nas@python.ca>
|
" by Neil Schemenauer <nas@python.ca>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
" Andrea Riciputi
|
" Andrea Riciputi
|
||||||
" for the patch with new configuration options
|
" for the patch with new configuration options
|
||||||
" Anton Butanaev
|
" Anton Butanaev
|
||||||
" for the patch fixing raw bytes literals highlighting
|
" for the patch fixing bytes literals highlighting
|
||||||
|
|
||||||
"
|
"
|
||||||
" Options:
|
" Options:
|
||||||
@@ -139,7 +139,7 @@ syn match pythonCoding "\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
|
|||||||
syn keyword pythonTodo TODO FIXME XXX contained
|
syn keyword pythonTodo TODO FIXME XXX contained
|
||||||
|
|
||||||
" Errors
|
" Errors
|
||||||
" syn match pythonError "\<\d\+\D\+\>" display
|
syn match pythonError "\<\d\+\D\+\>" display
|
||||||
syn match pythonError "[$?]" display
|
syn match pythonError "[$?]" display
|
||||||
syn match pythonError "[&|]\{2,}" display
|
syn match pythonError "[&|]\{2,}" display
|
||||||
syn match pythonError "[=]\{3,}" display
|
syn match pythonError "[=]\{3,}" display
|
||||||
@@ -183,13 +183,13 @@ syn region pythonRawString start=+[bB]\=[rR]'''+ end=+'''+ keepend contains=pyth
|
|||||||
syn match pythonRawEscape +\\['"]+ display transparent contained
|
syn match pythonRawEscape +\\['"]+ display transparent contained
|
||||||
|
|
||||||
" Bytes
|
" Bytes
|
||||||
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,@Spell
|
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
|
||||||
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,@Spell
|
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
|
||||||
syn region pythonBytes start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
syn region pythonBytes start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
|
||||||
syn region pythonBytes start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
syn region pythonBytes start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
|
||||||
syn match pythonBytesContent "[\u0001-\u007f]\+" display contained
|
syn match pythonBytesError ".\+" display contained
|
||||||
syn match pythonBytesError "[^\u0001-\u007f]\+" display contained
|
syn match pythonBytesContent "[\u0000-\u00ff]\+" display contained contains=pythonBytesEscape,pythonBytesEscapeError
|
||||||
|
|
||||||
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
|
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
|
||||||
syn match pythonBytesEscape "\\\o\o\=\o\=" display contained
|
syn match pythonBytesEscape "\\\o\o\=\o\=" display contained
|
||||||
@@ -230,10 +230,11 @@ syn match pythonHexNumber "\<0[xX]\x\+\>" display
|
|||||||
syn match pythonOctNumber "\<0[oO]\o\+\>" display
|
syn match pythonOctNumber "\<0[oO]\o\+\>" display
|
||||||
syn match pythonBinNumber "\<0[bB][01]\+\>" display
|
syn match pythonBinNumber "\<0[bB][01]\+\>" display
|
||||||
|
|
||||||
|
syn match pythonNumberError "\<\d\+\D\>" display
|
||||||
|
syn match pythonNumberError "\<0\d\+\>" display
|
||||||
syn match pythonNumber "\<\d\>" display
|
syn match pythonNumber "\<\d\>" display
|
||||||
syn match pythonNumber "\<[1-9]\d\+\>" display
|
syn match pythonNumber "\<[1-9]\d\+\>" display
|
||||||
syn match pythonNumber "\<\d\+[jJ]\>" display
|
syn match pythonNumber "\<\d\+[jJ]\>" display
|
||||||
syn match pythonNumberError "\<0\d\+\>" display
|
|
||||||
|
|
||||||
syn match pythonFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
|
syn match pythonFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
|
||||||
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
|
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
|
||||||
|
|||||||
6
test.py
6
test.py
@@ -51,7 +51,7 @@ RuntimeWarning FutureWarning OverflowWarning ImportWarning UnicodeWarning
|
|||||||
|
|
||||||
# Numbers
|
# Numbers
|
||||||
|
|
||||||
0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77
|
0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77 1023434 0x0
|
||||||
|
|
||||||
# Erroneous numbers
|
# Erroneous numbers
|
||||||
|
|
||||||
@@ -74,11 +74,13 @@ r" \" \' "
|
|||||||
|
|
||||||
b"test"
|
b"test"
|
||||||
|
|
||||||
|
b"test\r\n\xffff"
|
||||||
|
|
||||||
b"тестtest"
|
b"тестtest"
|
||||||
|
|
||||||
br"test"
|
br"test"
|
||||||
|
|
||||||
br"\a\b"
|
br"\a\b\n\r"
|
||||||
|
|
||||||
# Formattings
|
# Formattings
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user