aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 90097df7ef1..9c23655b911 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -372,7 +372,10 @@
372 (defconst python-rx-constituents 372 (defconst python-rx-constituents
373 `((block-start . ,(rx symbol-start 373 `((block-start . ,(rx symbol-start
374 (or "def" "class" "if" "elif" "else" "try" 374 (or "def" "class" "if" "elif" "else" "try"
375 "except" "finally" "for" "while" "with") 375 "except" "finally" "for" "while" "with"
376 ;; Python 3.5+ PEP492
377 (and "async" (+ space)
378 (or "def" "for" "with")))
376 symbol-end)) 379 symbol-end))
377 (dedenter . ,(rx symbol-start 380 (dedenter . ,(rx symbol-start
378 (or "elif" "else" "except" "finally") 381 (or "elif" "else" "except" "finally")
@@ -383,7 +386,11 @@
383 symbol-end)) 386 symbol-end))
384 (decorator . ,(rx line-start (* space) ?@ (any letter ?_) 387 (decorator . ,(rx line-start (* space) ?@ (any letter ?_)
385 (* (any word ?_)))) 388 (* (any word ?_))))
386 (defun . ,(rx symbol-start (or "def" "class") symbol-end)) 389 (defun . ,(rx symbol-start
390 (or "def" "class"
391 ;; Python 3.5+ PEP492
392 (and "async" (+ space) "def"))
393 symbol-end))
387 (if-name-main . ,(rx line-start "if" (+ space) "__name__" 394 (if-name-main . ,(rx line-start "if" (+ space) "__name__"
388 (+ space) "==" (+ space) 395 (+ space) "==" (+ space)
389 (any ?' ?\") "__main__" (any ?' ?\") 396 (any ?' ?\") "__main__" (any ?' ?\")
@@ -515,6 +522,8 @@ The type returned can be `comment', `string' or `paren'."
515 ;; fontified like that in order to keep font-lock consistent between 522 ;; fontified like that in order to keep font-lock consistent between
516 ;; Python versions. 523 ;; Python versions.
517 "nonlocal" 524 "nonlocal"
525 ;; Python 3.5+ PEP492
526 (and "async" (+ space) (or "def" "for" "with"))
518 ;; Extra: 527 ;; Extra:
519 "self") 528 "self")
520 symbol-end) 529 symbol-end)