Function: java-ts-mode--font-lock-settings

java-ts-mode--font-lock-settings is a byte-compiled function defined in java-ts-mode.el.gz.

Signature

(java-ts-mode--font-lock-settings)

Documentation

Return tree-sitter font-lock settings for java-ts-mode.

Tree-sitter font-lock settings are evaluated the first time this function is called. Subsequent calls return the first evaluated value.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/java-ts-mode.el.gz
(defun java-ts-mode--font-lock-settings ()
  "Return tree-sitter font-lock settings for `java-ts-mode'.

Tree-sitter font-lock settings are evaluated the first time this
function is called.  Subsequent calls return the first evaluated value."
  (treesit-font-lock-rules
   :language 'java
   :override t
   :feature 'comment
   `((line_comment) @font-lock-comment-face
     (block_comment) @font-lock-comment-face)
   :language 'java
   :override t
   :feature 'keyword
   `([,@java-ts-mode--keywords
      (this)
      (super)] @font-lock-keyword-face
      (labeled_statement
       (identifier) @font-lock-keyword-face))
   :language 'java
   :override t
   :feature 'operator
   `([,@java-ts-mode--operators] @font-lock-operator-face
     "@" @font-lock-constant-face)
   :language 'java
   :override t
   :feature 'annotation
   `((annotation
      name: (identifier) @font-lock-constant-face)

     (marker_annotation
      name: (identifier) @font-lock-constant-face))
   :language 'java
   :override t
   :feature 'string
   (java-ts-mode--string-highlight-helper)
   :language 'java
   :override t
   :feature 'literal
   `((null_literal) @font-lock-constant-face
     (binary_integer_literal)  @font-lock-number-face
     (decimal_integer_literal) @font-lock-number-face
     (hex_integer_literal) @font-lock-number-face
     (octal_integer_literal) @font-lock-number-face
     (decimal_floating_point_literal) @font-lock-number-face
     (hex_floating_point_literal) @font-lock-number-face)
   :language 'java
   :override t
   :feature 'type
   '((annotation_type_declaration
      name: (identifier) @font-lock-type-face)

     (interface_declaration
      name: (identifier) @font-lock-type-face)

     (class_declaration
      name: (identifier) @font-lock-type-face)

     (record_declaration
      name: (identifier) @font-lock-type-face)

     (enum_declaration
      name: (identifier) @font-lock-type-face)

     (constructor_declaration
      name: (identifier) @font-lock-type-face)

     (compact_constructor_declaration
      name: (identifier) @font-lock-type-face)

     (method_reference (identifier) @font-lock-type-face)

     (scoped_identifier (identifier) @font-lock-constant-face)

     ((scoped_identifier name: (identifier) @font-lock-type-face)
      (:match "\\`[A-Z]" @font-lock-type-face))

     (type_identifier) @font-lock-type-face
     ;; In Java, var is not a keyword but rather a auto-determined type.
     ;; But we want to fontify it as a keyword.  (The override query is
     ;; below the general query because :override flag is set for this
     ;; rule.)
     ((type_identifier) @font-lock-keyword-face
      (:match "\\`var\\'" @font-lock-keyword-face))

     [(boolean_type)
      (integral_type)
      (floating_point_type)
      (void_type)] @font-lock-type-face)
   :language 'java
   :override t
   :feature 'definition
   `((annotation_type_element_declaration
      name: (identifier) @font-lock-function-name-face)

     (method_declaration
      name: (identifier) @font-lock-function-name-face)

     (variable_declarator
      name: (identifier) @font-lock-variable-name-face)

     (element_value_pair
      key: (identifier) @font-lock-property-use-face)

     (formal_parameter
      name: (identifier) @font-lock-variable-name-face)

     (catch_formal_parameter
      name: (identifier) @font-lock-variable-name-face))
   :language 'java
   :override t
   :feature 'expression
   '((method_invocation
      object: (identifier) @font-lock-variable-use-face)

     (method_invocation
      name: (identifier) @font-lock-function-call-face)

     (argument_list (identifier) @font-lock-variable-name-face)

     (expression_statement (identifier) @font-lock-variable-use-face))
   ;; Make sure the constant feature is after expression and definition,
   ;; because those two applies variable-name-face on some constants.
   :language 'java
   :override t
   :feature 'constant
   `((identifier) @java-ts-mode--fontify-constant
     [(true) (false)] @font-lock-constant-face)
   :language 'java
   :feature 'bracket
   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)

   :language 'java
   :feature 'delimiter
   '((["," ":" ";"]) @font-lock-delimiter-face)))