;; assignments
;; support for a = b = c = 5
(,(lambda (limit)
- (let ((re (python-rx (group (+ symbol-name))
- (? ?\[ (+ (not ?\])) ?\])
- (* space)
- ;; A type, like " : int ".
- (? ?:
- (* space)
- (+ not-simple-operator)
- (* space))
+ (let ((re (python-rx (group symbol-name)
+ ;; subscript, like "[5]"
+ (? ?\[ (+ (not ?\])) ?\]) (* space)
+ ;; type hint, like ": int" or ": Mapping[int, str]"
+ (? ?: (* space) (+ not-simple-operator) (* space))
assignment-operator))
(res nil))
(while (and (setq res (re-search-forward re limit t))
(1 font-lock-variable-name-face nil nil))
;; support for a, b, c = (1, 2, 3)
(,(lambda (limit)
- (let ((re (python-rx (group (+ symbol-name)) (* space)
- (* ?, (* space) (+ symbol-name) (* space))
- ?, (* space) (+ symbol-name) (* space)
+ (let ((re (python-rx (group symbol-name) (* space)
+ (* ?, (* space) symbol-name (* space))
+ ?, (* space) symbol-name (* space)
assignment-operator))
(res nil))
(while (and (setq res (re-search-forward re limit t))