Variable: sh-mode--treesit-settings

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

Value

Large value
((((comment) @font-lock-comment-face) t comment nil nil bash)
 (((function_definition name: (word) @font-lock-function-name-face)) t
  function nil nil bash)
 (([(string) (raw_string)] @font-lock-string-face) t string nil nil
  bash)
 (((command_substitution (command) @sh-quoted-exec)
   (expansion (variable_name) @font-lock-variable-use-face)
   (expansion ["${" "}"] @font-lock-bracket-face)
   (simple_expansion "$" @font-lock-bracket-face (variable_name)
		     @font-lock-variable-use-face))
  t string-interpolation t nil bash)
 (([(heredoc_start) (heredoc_body)] @sh-heredoc) t heredoc nil nil
  bash)
 (((variable_name) @font-lock-variable-name-face) t variable nil nil
  bash)
 ((["case" "do" "done" "elif" "else" "esac" "export" "fi" "for"
    "function" "if" "in" "unset" "while" "then"]
   @font-lock-keyword-face
   (command_name
    ((word) @font-lock-keyword-face
     (:match
      "\\(?:^\\(?:!\\|break\\|continue\\|ex\\(?:ec\\|it\\)\\|return\\|t\\(?:rap\\|ype\\)\\|until\\)$\\)"
      @font-lock-keyword-face))))
  t keyword nil nil bash)
 (((command_name (word) @font-lock-function-call-face)
   (command_name
    ((word) @font-lock-builtin-face
     (:match
      "\\(?:^\\(?:cd\\|e\\(?:cho\\|val\\|xport\\)\\|getopts\\|hash\\|newgrp\\|pwd\\|read\\(?:only\\)?\\|s\\(?:\\(?:e\\|hif\\)t\\)\\|t\\(?:est\\|imes\\|ype\\)\\|u\\(?:limit\\|mask\\|nset\\)\\|wait\\)$\\)"
      @font-lock-builtin-face))))
  t command nil nil bash)
 ((["declare" "typeset" "export" "readonly" "local"]
   @font-lock-keyword-face)
  t declaration-command nil nil bash)
 (((case_item value: (word) @font-lock-constant-face)
   (file_descriptor) @font-lock-constant-face)
  t constant nil nil bash)
 ((["|" "|&" "||" "&&" ">" ">>" "<" "<<" "<<-" "<<<" "==" "!=" ";&"
    ";;&"]
   @font-lock-operator-face)
  t operator nil nil bash)
 ((((special_variable_name) @font-lock-builtin-face
    (:match
     "\\(?:^\\(?:C\\(?:DPATH\\|OLUMNS\\)\\|EDITOR\\|H\\(?:OME\\|USHLOGIN\\)\\|IFS\\|L\\(?:ANG\\|C_\\(?:C\\(?:\\(?:OLLAT\\|TYP\\)E\\)\\|M\\(?:ESSAGES\\|ONETARY\\)\\|NUMERIC\\|TIME\\)\\|INES\\|OGNAME\\)\\|MAIL\\(?:CHECK\\|PATH\\)?\\|OPT\\(?:ARG\\|IND\\)\\|P\\(?:A\\(?:GER\\|TH\\)\\|S[12]\\)\\|SHELL\\|TERM\\(?:CAP\\|INFO\\)?\\|VISUAL\\)$\\)"
     @font-lock-builtin-face)))
  t builtin-variable nil nil bash)
 ((((word) @font-lock-number-face
    (:match "\\`[0-9]+\\'" @font-lock-number-face)))
  t number nil nil bash)
 (((["(" ")" "((" "))" "[" "]" "[[" "]]" "{" "}"])
   @font-lock-bracket-face)
  t bracket nil nil bash)
 ((([";" ";;"]) @font-lock-delimiter-face) t delimiter nil nil bash)
 (((["$"]) @font-lock-misc-punctuation-face) t misc-punctuation nil
  nil bash))

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 (command) @sh-quoted-exec)
     (expansion (variable_name) @font-lock-variable-use-face)
     (expansion ["${" "}"] @font-lock-bracket-face)
     (simple_expansion
      "$" @font-lock-bracket-face
      (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-call-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'.")