Variable: js--font-lock-keywords-3
js--font-lock-keywords-3 is a variable defined in js.el.gz.
Value
Large value
(("^#[ ]*\\(?:error\\|warning\\)[ ]+\\(.+\\)" 1 font-lock-warning-face prepend)
("^#[ ]*\\(?:import\\|include\\)[ ]*\\(<[^>\"\n]*>?\\)" 1 font-lock-string-face prepend)
("^#[ ]*define[ ]+\\([[:alpha:]_][[:alnum:]_$]*\\)("
(1 font-lock-function-name-face prepend)
((lambda
(limit)
(re-search-forward "\\(?:\\([[:alpha:]_][[:alnum:]_]*\\)[,]?\\)"
(or
(save-excursion
(re-search-forward ")" limit t))
limit)
t))
nil nil
(1 font-lock-variable-name-face prepend)))
("^#[ ]*\\(?:elif\\|if\\)\\>"
("\\<\\(defined\\)\\>[ ]*(?\\([[:alpha:]_][[:alnum:]_]*\\)?" nil nil
(1 font-lock-builtin-face prepend)
(2 font-lock-variable-name-face prepend t)))
("^\\(#[ ]*\\(?:define\\|e\\(?:l\\(?:if\\|se\\)\\|ndif\\|rror\\)\\|file\\|i\\(?:f\\(?:n?def\\)?\\|mport\\|nclude\\)\\|line\\|pragma\\|undef\\|warning\\)\\)\\>[ !]*\\([[:alpha:]_][[:alnum:]_]*\\)?"
(1 font-lock-preprocessor-face prepend)
(2 font-lock-variable-name-face nil t))
"\\_<import\\_>"
("^\\s-*function\\(?:\\s-\\|\\*\\)+\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)" 1 font-lock-function-name-face)
("^\\s-*\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)\\s-*:\\s-*function\\_>" 1 font-lock-function-name-face)
("\\_<\\(a\\(?:bstract\\|sync\\|wait\\)\\|break\\|c\\(?:a\\(?:se\\|tch\\)\\|lass\\|on\\(?:st\\|tinue\\)\\)\\|d\\(?:e\\(?:bugger\\|fault\\|lete\\)\\|o\\)\\|e\\(?:lse\\|num\\|x\\(?:port\\|tends\\)\\)\\|f\\(?:inal\\(?:ly\\)?\\|or\\|unction\\)\\|goto\\|i\\(?:mp\\(?:lements\\|ort\\)\\|n\\(?:stanceof\\|terface\\)\\|[fn]\\)\\|let\\|n\\(?:ative\\|ew\\)\\|of\\|p\\(?:ackage\\|r\\(?:ivate\\|otected\\)\\|ublic\\)\\|return\\|s\\(?:tatic\\|uper\\|witch\\|ynchronized\\)\\|t\\(?:hrows?\\|r\\(?:ansient\\|y\\)\\|ypeof\\)\\|v\\(?:ar\\|o\\(?:id\\|latile\\)\\)\\|w\\(?:hile\\|ith\\)\\|yield\\)\\_>" 1 font-lock-keyword-face)
("\\_<for\\_>" "\\s-+\\(each\\)\\_>" nil nil
(1 font-lock-keyword-face))
("\\_<\\(b\\(?:oolean\\|yte\\)\\|char\\|double\\|float\\|int\\|long\\|short\\|void\\)\\_>" . font-lock-type-face)
("\\_<\\(Infinity\\|NaN\\|arguments\\|false\\|null\\|t\\(?:his\\|rue\\)\\|undefined\\)\\_>" . font-lock-constant-face)
("\\.\\(prototype\\)\\_>"
(1 font-lock-constant-face))
(js--class-decl-matcher "\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)\\(?:\\.\\|.*$\\)"
(goto-char
(match-beginning 1))
nil
(1 font-lock-type-face))
(js--class-decl-matcher "\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)\\(?:\\.\\|.*$\\)"
(if
(match-beginning 2)
(progn
(setq js--tmp-location
(match-end 2))
(goto-char js--tmp-location)
(insert "=")
(goto-char
(match-beginning 2)))
(setq js--tmp-location nil)
(goto-char
(point-at-eol)))
(when js--tmp-location
(save-excursion
(goto-char js--tmp-location)
(delete-char 1)))
(1 font-lock-type-face))
(js--class-decl-matcher
(2 font-lock-type-face nil t))
(#[257 "\300\n>\205\303\301\304#\207"
[dojo "^\\s-*dojo\\.declare\\s-*(\"\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)\\(?:\"\\s-*,\\s-*\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)\\)?" js-enabled-frameworks re-search-forward t]
5 "\n\n(fn LIMIT)"]
(1 font-lock-type-face t)
(2 font-lock-type-face nil t))
(#[257 "\300\n>\205\303\301\304#\207"
[dojo "^\\s-*dojo\\.declare\\s-*(\"\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)\"\\s-*,\\s-*\\[" js-enabled-frameworks re-search-forward t]
5 "\n\n(fn LIMIT)"]
"[[,]\\s-*\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)\\s-*\\(?:\\].*$\\)?"
(backward-char)
(end-of-line)
(1 font-lock-type-face))
(#[257 "\300\n>\205\303\301\304#\207"
[dojo "^\\s-*[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\s-*[],]" js-enabled-frameworks re-search-forward t]
5 "\n\n(fn LIMIT)"]
"\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)\\s-*\\(?:\\].*$\\)?"
(if
(save-excursion
(backward-char)
(js--inside-dojo-class-list-p))
(forward-symbol -1)
(end-of-line))
(end-of-line)
(1 font-lock-type-face))
("\\_<\\(const\\|var\\|let\\)\\_>\\|\\_<\\(b\\(?:oolean\\|yte\\)\\|char\\|double\\|float\\|int\\|long\\|short\\|void\\)\\_>"
(js--variable-decl-matcher nil nil nil))
("\\_<new\\_>\\s-+\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)"
(1 font-lock-type-face))
("\\_<instanceof\\_>\\s-+\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)"
(1 font-lock-type-face))
("\\_<function\\_>\\(\\s-+[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)?\\s-*(\\s-*[[:alpha:]_$]"
("\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)\\(\\s-*).*\\)?"
(backward-char)
(end-of-line)
(1 font-lock-variable-name-face)))
("^\\s-*[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\s-*[,)]"
("[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*"
(if
(save-excursion
(backward-char)
(js--inside-param-list-p))
(forward-symbol -1)
(end-of-line))
(end-of-line)
(0 font-lock-variable-name-face)))
(js-jsx--match-tag-name 0 font-lock-function-name-face t)
(js-jsx--match-attribute-name 0 font-lock-variable-name-face t)
(js-jsx--match-text 0 'default t)
(js-jsx--match-tag-beg)
(js-jsx--match-tag-end)
(js-jsx--match-expr))
Documentation
Level three font lock for js-mode.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defconst js--font-lock-keywords-3
`(
;; This goes before keywords-2 so it gets used preferentially
;; instead of the keywords in keywords-2. Don't use override
;; because that will override syntactic fontification too, which
;; will fontify commented-out directives as if they weren't
;; commented out.
,@cpp-font-lock-keywords ; from font-lock.el
,@js--font-lock-keywords-2
("\\.\\(prototype\\)\\_>"
(1 font-lock-constant-face))
;; Highlights class being declared, in parts
(js--class-decl-matcher
,(concat "\\(" js--name-re "\\)\\(?:\\.\\|.*$\\)")
(goto-char (match-beginning 1))
nil
(1 font-lock-type-face))
;; Highlights parent class, in parts, if available
(js--class-decl-matcher
,(concat "\\(" js--name-re "\\)\\(?:\\.\\|.*$\\)")
(if (match-beginning 2)
(progn
(setq js--tmp-location (match-end 2))
(goto-char js--tmp-location)
(insert "=")
(goto-char (match-beginning 2)))
(setq js--tmp-location nil)
(goto-char (point-at-eol)))
(when js--tmp-location
(save-excursion
(goto-char js--tmp-location)
(delete-char 1)))
(1 font-lock-type-face))
;; Highlights parent class
(js--class-decl-matcher
(2 font-lock-type-face nil t))
;; Dojo needs its own matcher to override the string highlighting
(,(js--make-framework-matcher
'dojo
"^\\s-*dojo\\.declare\\s-*(\""
"\\(" js--dotted-name-re "\\)"
"\\(?:\"\\s-*,\\s-*\\(" js--dotted-name-re "\\)\\)?")
(1 font-lock-type-face t)
(2 font-lock-type-face nil t))
;; Match Dojo base classes. Of course Mojo has to be different
;; from everything else under the sun...
(,(js--make-framework-matcher
'dojo
"^\\s-*dojo\\.declare\\s-*(\""
"\\(" js--dotted-name-re "\\)\"\\s-*,\\s-*\\[")
,(concat "[[,]\\s-*\\(" js--dotted-name-re "\\)\\s-*"
"\\(?:\\].*$\\)?")
(backward-char)
(end-of-line)
(1 font-lock-type-face))
;; continued Dojo base-class list
(,(js--make-framework-matcher
'dojo
"^\\s-*" js--dotted-name-re "\\s-*[],]")
,(concat "\\(" js--dotted-name-re "\\)"
"\\s-*\\(?:\\].*$\\)?")
(if (save-excursion (backward-char)
(js--inside-dojo-class-list-p))
(forward-symbol -1)
(end-of-line))
(end-of-line)
(1 font-lock-type-face))
;; variable declarations
,(list
(concat "\\_<\\(const\\|var\\|let\\)\\_>\\|" js--basic-type-re)
(list #'js--variable-decl-matcher nil nil nil))
;; class instantiation
,(list
(concat "\\_<new\\_>\\s-+\\(" js--dotted-name-re "\\)")
(list 1 'font-lock-type-face))
;; instanceof
,(list
(concat "\\_<instanceof\\_>\\s-+\\(" js--dotted-name-re "\\)")
(list 1 'font-lock-type-face))
;; formal parameters
,(list
(concat
"\\_<function\\_>\\(\\s-+" js--name-re "\\)?\\s-*(\\s-*"
js--name-start-re)
(list (concat "\\(" js--name-re "\\)\\(\\s-*).*\\)?")
'(backward-char)
'(end-of-line)
'(1 font-lock-variable-name-face)))
;; continued formal parameter list
,(list
(concat
"^\\s-*" js--name-re "\\s-*[,)]")
(list js--name-re
'(if (save-excursion (backward-char)
(js--inside-param-list-p))
(forward-symbol -1)
(end-of-line))
'(end-of-line)
'(0 font-lock-variable-name-face)))
;; jsx (when enabled)
,@js-jsx--font-lock-keywords)
"Level three font lock for `js-mode'.")