소스 검색

Negative Numbers, Docstrings, self (builtin object)

Asa Jay 8 년 전
부모
커밋
f229187852
1개의 변경된 파일20개의 추가작업 그리고 3개의 파일을 삭제
  1. 20
    3
      syntax/python.vim

+ 20
- 3
syntax/python.vim 파일 보기

@@ -3,9 +3,9 @@
3 3
 " Current Maintainer:   Dmitry Vasiliev <dima at hlabs dot org>
4 4
 " Previous Maintainer:  Neil Schemenauer <nas at python dot ca>
5 5
 " URL:                  https://github.com/hdima/python-syntax
6
-" Last Change:          2015-11-01
6
+" Last Change:          2016-07-30
7 7
 " Filenames:            *.py
8
-" Version:              3.6.0
8
+" Version:              3.6.1
9 9
 "
10 10
 " Based on python.vim (from Vim 6.1 distribution)
11 11
 " by Neil Schemenauer <nas at python dot ca>
@@ -38,6 +38,7 @@
38 38
 "   Victor Salgado
39 39
 "   Will Gray
40 40
 "   Yuri Habrusiev
41
+"   Arthur Jaron
41 42
 "
42 43
 " Options
43 44
 " =======
@@ -276,8 +277,12 @@ else
276 277
   syn region pythonString   start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
277 278
   syn region pythonString   start=+"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
278 279
   syn region pythonString   start=+'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
280
+
279 281
 endif
280 282
 
283
+syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
284
+syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
285
+
281 286
 if s:Python2Syntax()
282 287
   " Python 2 Unicode raw strings
283 288
   syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
@@ -368,6 +373,11 @@ if s:Python2Syntax()
368 373
   syn match   pythonNumber	"\<[0-9]\d\+[lL]\=\>" display
369 374
   syn match   pythonNumber	"\<\d\+[lLjJ]\>" display
370 375
 
376
+  " For completeness
377
+  syn match   pythonNumber	"\<-\d[lL]\=\>" display
378
+  syn match   pythonNumber	"\<-[0-9]\d\+[lL]\=\>" display
379
+  syn match   pythonNumber	"\<-\d\+[lLjJ]\>" display
380
+
371 381
   syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display
372 382
   syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*[lL]\=\>" display
373 383
 else
@@ -385,6 +395,11 @@ else
385 395
   syn match   pythonNumber	"\<[1-9]\d\+\>" display
386 396
   syn match   pythonNumber	"\<\d\+[jJ]\>" display
387 397
 
398
+  " Negative numbers, why missing?
399
+  syn match   pythonNumber	"\<-\d\>" display
400
+  syn match   pythonNumber	"\<-[1-9]\d\+\>" display
401
+  syn match   pythonNumber	"\<-\d\+[jJ]\>" display
402
+
388 403
   syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*\>" display
389 404
   syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*\>" display
390 405
 endif
@@ -402,7 +417,7 @@ if s:Enabled("g:python_highlight_builtin_objs")
402 417
     syn keyword pythonBuiltinObj	None
403 418
     syn keyword pythonBoolean		True False
404 419
   endif
405
-  syn keyword pythonBuiltinObj	Ellipsis NotImplemented
420
+  syn keyword pythonBuiltinObj	Ellipsis NotImplemented self
406 421
   syn keyword pythonBuiltinObj	__debug__ __doc__ __file__ __name__ __package__
407 422
 endif
408 423
 
@@ -521,6 +536,8 @@ if version >= 508 || !exists("did_python_syn_inits")
521 536
   HiLink pythonString           String
522 537
   HiLink pythonRawString        String
523 538
 
539
+  HiLink pythonDocstring        Docstring
540
+
524 541
   HiLink pythonUniEscape        Special
525 542
   HiLink pythonUniEscapeError   Error
526 543