Variable: sh-mode--treesit-settings

sh-mode--treesit-settings is a variable defined in sh-script.el.gz.

Value

((#<treesit-compiled-query> t comment nil)
 (#<treesit-compiled-query> t function nil)
 (#<treesit-compiled-query> t string nil)
 (#<treesit-compiled-query> t string-interpolation t)
 (#<treesit-compiled-query> t heredoc nil)
 (#<treesit-compiled-query> t variable nil)
 (#<treesit-compiled-query> t keyword nil)
 (#<treesit-compiled-query> t command nil)
 (#<treesit-compiled-query> t declaration-command nil)
 (#<treesit-compiled-query> t constant nil)
 (#<treesit-compiled-query> t operator nil)
 (#<treesit-compiled-query> t builtin-variable nil)
 (#<treesit-compiled-query> t number nil)
 (#<treesit-compiled-query> t bracket nil)
 (#<treesit-compiled-query> t delimiter nil)
 (#<treesit-compiled-query> t misc-punctuation nil))

Documentation

Tree-sitter font-lock settings for sh-mode.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
(defvar sh-mode--treesit-settings
  (treesit-font-lock-rules
   :feature 'comment
   :language 'bash
   '((comment) @font-lock-comment-face)

   :feature 'function
   :language 'bash
   '((function_definition name: (word) @font-lock-function-name-face))

   :feature 'string
   :language 'bash
   '([(string) (raw_string)] @font-lock-string-face)

   :feature 'string-interpolation
   :language 'bash
   :override t
   '((command_substitution) @sh-quoted-exec
     (string (expansion (variable_name) @font-lock-variable-use-face)))

   :feature 'heredoc
   :language 'bash
   '([(heredoc_start) (heredoc_body)] @sh-heredoc)

   :feature 'variable
   :language 'bash
   '((variable_name) @font-lock-variable-name-face)

   :feature 'keyword
   :language 'bash
   `(;; keywords
     [ ,@sh-mode--treesit-keywords ] @font-lock-keyword-face
     ;; reserved words
     (command_name
      ((word) @font-lock-keyword-face
       (:match
        ,(rx-to-string
          `(seq bol
                (or ,@(sh-mode--treesit-other-keywords))
                eol))
        @font-lock-keyword-face))))

   :feature 'command
   :language 'bash
   `(;; function/non-builtin command calls
     (command_name (word) @font-lock-function-name-face)
     ;; builtin commands
     (command_name
      ((word) @font-lock-builtin-face
       (:match ,(let ((builtins
                       (sh-feature sh-builtins)))
                  (rx-to-string
                   `(seq bol
                         (or ,@builtins)
                         eol)))
               @font-lock-builtin-face))))

   :feature 'declaration-command
   :language 'bash
   `([,@sh-mode--treesit-declaration-commands] @font-lock-keyword-face)

   :feature 'constant
   :language 'bash
   '((case_item value: (word) @font-lock-constant-face)
     (file_descriptor) @font-lock-constant-face)

   :feature 'operator
   :language 'bash
   `([,@sh-mode--treesit-operators] @font-lock-operator-face)

   :feature 'builtin-variable
   :language 'bash
   `(((special_variable_name) @font-lock-builtin-face
      (:match ,(let ((builtin-vars (sh-feature sh-variables)))
                 (rx-to-string
                  `(seq bol
                        (or ,@builtin-vars)
                        eol)))
              @font-lock-builtin-face)))

   :feature 'number
   :language 'bash
   `(((word) @font-lock-number-face
      (:match "\\`[0-9]+\\'" @font-lock-number-face)))

   :feature 'bracket
   :language 'bash
   '((["(" ")" "((" "))" "[" "]" "[[" "]]" "{" "}"]) @font-lock-bracket-face)

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

   :feature 'misc-punctuation
   :language 'bash
   '((["$"]) @font-lock-misc-punctuation-face))
  "Tree-sitter font-lock settings for `sh-mode'.")