Function: font-lock--match-keyword
font-lock--match-keyword is a byte-compiled function defined in
font-lock.el.gz.
Signature
(font-lock--match-keyword RULE KEYWORD)
Documentation
Return non-nil if font-lock KEYWORD matches RULE.
See font-lock-ignore for the possible rules.
Source Code
;; Defined in /usr/src/emacs/lisp/font-lock.el.gz
(defun font-lock--match-keyword (rule keyword)
"Return non-nil if font-lock KEYWORD matches RULE.
See `font-lock-ignore' for the possible rules."
(pcase-exhaustive rule
('* t)
((pred symbolp)
(let ((regexp (when (string-match-p "[*?]" (symbol-name rule))
(wildcard-to-regexp (symbol-name rule)))))
(named-let search ((obj keyword))
(cond
((consp obj) (or (search (car obj)) (search (cdr obj))))
((not regexp) (eq rule obj))
((symbolp obj) (string-match-p regexp (symbol-name obj)))))))
((pred stringp) (when (stringp (car keyword))
(string-match-p (concat "\\`\\(?:" (car keyword) "\\)")
rule)))
(`(or . ,rules) (let ((match nil))
(while rules
(pcase-exhaustive (pop rules)
(`(except ,rule)
(when match
(setq match (not (font-lock--match-keyword rule keyword)))))
(rule
(unless match
(setq match (font-lock--match-keyword rule keyword))))))
match))
(`(not ,rule) (not (font-lock--match-keyword rule keyword)))
(`(and . ,rules) (seq-every-p (lambda (rule)
(font-lock--match-keyword rule keyword))
rules))
(`(pred ,fun) (funcall fun keyword))))