Function: java-ts-mode--fontify-constant

java-ts-mode--fontify-constant is a byte-compiled function defined in java-ts-mode.el.gz.

Signature

(java-ts-mode--fontify-constant NODE OVERRIDE START END &rest _)

Documentation

Fontify a Java constant.

In Java the names of variables declared class constants and of ANSI constants should be all uppercase with words separated by underscores. This function also prevents annotations from being highlighted as if they were constants. For NODE, OVERRIDE, START, and END, see treesit-font-lock-rules.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/java-ts-mode.el.gz
(defun java-ts-mode--fontify-constant (node override start end &rest _)
  "Fontify a Java constant.
In Java the names of variables declared class constants and of ANSI
constants should be all uppercase with words separated by underscores.
This function also prevents annotations from being highlighted as if
they were constants.
For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'."
  (let ((node-start (treesit-node-start node))
	(case-fold-search nil))
    (when (and
	   (not (equal (char-before node-start) ?@)) ;; skip annotations
	   (string-match "\\`[A-Z_][0-9A-Z_]*\\'" (treesit-node-text node)))
      (treesit-fontify-with-override
       node-start (treesit-node-end node)
       'font-lock-constant-face override
       start end))))