Function: js--variable-decl-matcher
js--variable-decl-matcher is a byte-compiled function defined in
js.el.gz.
Signature
(js--variable-decl-matcher LIMIT)
Documentation
Font-lock matcher for variable names in a variable declaration.
This is a cc-mode-style matcher that *always* fails, from the
point of view of font-lock. It applies highlighting directly with
font-lock-apply-highlight.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--variable-decl-matcher (limit)
"Font-lock matcher for variable names in a variable declaration.
This is a cc-mode-style matcher that *always* fails, from the
point of view of font-lock. It applies highlighting directly with
`font-lock-apply-highlight'."
(condition-case nil
(save-restriction
(narrow-to-region (point-min) limit)
(let ((first t))
(forward-comment most-positive-fixnum)
(while
(and (or first
(when (eq (char-after) ?,)
(forward-char)
(forward-comment most-positive-fixnum)
t))
(cond ((looking-at js--name-re)
(font-lock-apply-highlight
'(0 font-lock-variable-name-face))
(goto-char (match-end 0)))
((save-excursion
(js--forward-destructuring-spec))
(js--forward-destructuring-spec
(lambda ()
(font-lock-apply-highlight
'(0 font-lock-variable-name-face)))))))
(forward-comment most-positive-fixnum)
(when (eq (char-after) ?=)
(forward-char)
(js--forward-expression)
(forward-comment most-positive-fixnum))
(setq first nil))))
;; Conditions to handle
(scan-error nil)
(end-of-buffer nil))
;; Matcher always "fails"
nil)