diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 01f7f251edd..375b9fedc9d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -384,7 +384,10 @@ | |||
| 384 | (defconst python-rx-constituents | 384 | (defconst python-rx-constituents |
| 385 | `((block-start . ,(rx symbol-start | 385 | `((block-start . ,(rx symbol-start |
| 386 | (or "def" "class" "if" "elif" "else" "try" | 386 | (or "def" "class" "if" "elif" "else" "try" |
| 387 | "except" "finally" "for" "while" "with") | 387 | "except" "finally" "for" "while" "with" |
| 388 | ;; Python 3.5+ PEP492 | ||
| 389 | (and "async" (+ space) | ||
| 390 | (or "def" "for" "with"))) | ||
| 388 | symbol-end)) | 391 | symbol-end)) |
| 389 | (dedenter . ,(rx symbol-start | 392 | (dedenter . ,(rx symbol-start |
| 390 | (or "elif" "else" "except" "finally") | 393 | (or "elif" "else" "except" "finally") |
| @@ -395,7 +398,11 @@ | |||
| 395 | symbol-end)) | 398 | symbol-end)) |
| 396 | (decorator . ,(rx line-start (* space) ?@ (any letter ?_) | 399 | (decorator . ,(rx line-start (* space) ?@ (any letter ?_) |
| 397 | (* (any word ?_)))) | 400 | (* (any word ?_)))) |
| 398 | (defun . ,(rx symbol-start (or "def" "class") symbol-end)) | 401 | (defun . ,(rx symbol-start |
| 402 | (or "def" "class" | ||
| 403 | ;; Python 3.5+ PEP492 | ||
| 404 | (and "async" (+ space) "def")) | ||
| 405 | symbol-end)) | ||
| 399 | (if-name-main . ,(rx line-start "if" (+ space) "__name__" | 406 | (if-name-main . ,(rx line-start "if" (+ space) "__name__" |
| 400 | (+ space) "==" (+ space) | 407 | (+ space) "==" (+ space) |
| 401 | (any ?' ?\") "__main__" (any ?' ?\") | 408 | (any ?' ?\") "__main__" (any ?' ?\") |
| @@ -527,6 +534,8 @@ The type returned can be `comment', `string' or `paren'." | |||
| 527 | ;; fontified like that in order to keep font-lock consistent between | 534 | ;; fontified like that in order to keep font-lock consistent between |
| 528 | ;; Python versions. | 535 | ;; Python versions. |
| 529 | "nonlocal" | 536 | "nonlocal" |
| 537 | ;; Python 3.5+ PEP492 | ||
| 538 | (and "async" (+ space) (or "def" "for" "with")) | ||
| 530 | ;; Extra: | 539 | ;; Extra: |
| 531 | "self") | 540 | "self") |
| 532 | symbol-end) | 541 | symbol-end) |