Fix Python font lock of chained assignment statement
* lisp/progmodes/python.el (python-font-lock-keywords-maximum-decoration): Allow chaining of single assignment statements. * test/lisp/progmodes/python-tests.el (python-font-lock-assignment-statement-20): New test. (Bug#71093)
This commit is contained in:
parent
3291dea441
commit
3647645e94
2 changed files with 11 additions and 2 deletions
|
@ -812,8 +812,7 @@ sign in chained assignment."
|
|||
;; c: Collection = {1, 2, 3}
|
||||
;; d: Mapping[int, str] = {1: 'bar', 2: 'baz'}
|
||||
(,(python-font-lock-assignment-matcher
|
||||
(python-rx (or line-start ?\;) (* space)
|
||||
grouped-assignment-target (* space)
|
||||
(python-rx grouped-assignment-target (* space)
|
||||
(? ?: (* space) (+ not-simple-operator) (* space))
|
||||
(group assignment-operator)))
|
||||
(1 font-lock-variable-name-face)
|
||||
|
|
|
@ -474,6 +474,16 @@ def f(x: CustomInt) -> CustomInt:
|
|||
(136 . font-lock-operator-face) (137)
|
||||
(144 . font-lock-keyword-face) (150))))
|
||||
|
||||
(ert-deftest python-font-lock-assignment-statement-20 ()
|
||||
(python-tests-assert-faces
|
||||
"a = b = c = 1"
|
||||
'((1 . font-lock-variable-name-face) (2)
|
||||
(3 . font-lock-operator-face) (4)
|
||||
(5 . font-lock-variable-name-face) (6)
|
||||
(7 . font-lock-operator-face) (8)
|
||||
(9 . font-lock-variable-name-face) (10)
|
||||
(11 . font-lock-operator-face) (12))))
|
||||
|
||||
(ert-deftest python-font-lock-escape-sequence-string-newline ()
|
||||
(python-tests-assert-faces
|
||||
"'\\n'
|
||||
|
|
Loading…
Add table
Reference in a new issue