Function: python-font-lock-assignment-matcher
python-font-lock-assignment-matcher is a byte-compiled function
defined in python.el.gz.
Signature
(python-font-lock-assignment-matcher REGEXP)
Documentation
Font lock matcher for assignments based on REGEXP.
Search for next occurrence if REGEXP matched within a paren
context (to avoid, e.g., default values for arguments or passing
arguments by name being treated as assignments) or is followed by
an '=' sign (to avoid '==' being treated as an assignment. Set
point to the position one character before the end of the
occurrence found so that subsequent searches can detect the '='
sign in chained assignment.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-font-lock-assignment-matcher (regexp)
"Font lock matcher for assignments based on REGEXP.
Search for next occurrence if REGEXP matched within a `paren'
context (to avoid, e.g., default values for arguments or passing
arguments by name being treated as assignments) or is followed by
an '=' sign (to avoid '==' being treated as an assignment. Set
point to the position one character before the end of the
occurrence found so that subsequent searches can detect the '='
sign in chained assignment."
(lambda (limit)
(cl-loop while (re-search-forward regexp limit t)
unless (or (python-syntax-context 'paren)
(equal (char-after) ?=))
return (progn (backward-char) t))))