]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix some tree-sitter :match regexps
authorBasil L. Contovounesios <contovob@tcd.ie>
Tue, 13 Jun 2023 12:53:31 +0000 (13:53 +0100)
committerBasil L. Contovounesios <contovob@tcd.ie>
Sat, 17 Jun 2023 15:41:35 +0000 (16:41 +0100)
The shy groups were caught by modified versions of the GNU ELPA
packages xr and relint:
- https://github.com/mattiase/xr/pull/6
- https://github.com/mattiase/relint/pull/14

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Quote special
character in regexp.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings):
* lisp/progmodes/js.el (js--plain-method-re):
(js--treesit-font-lock-settings):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Replace character
alternative [\\d], which matches '\' or 'd', with the most likely
intention [0-9].  Fix shy groups mistyped as optional colons.
Remove unneeded numbered :match group in rust-ts-mode (bug#64019).

lisp/progmodes/java-ts-mode.el
lisp/progmodes/js.el
lisp/progmodes/ruby-ts-mode.el
lisp/progmodes/rust-ts-mode.el
lisp/progmodes/typescript-ts-mode.el

index 463872dcbc821b8f7d151c5fe929b32022aa271d..7f2fc4188a307c9821e4c794e215c14fc8f6ce27 100644 (file)
@@ -168,7 +168,7 @@ the available version of Tree-sitter for java."
    :override t
    :feature 'constant
    `(((identifier) @font-lock-constant-face
-      (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
+      (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face))
      [(true) (false)] @font-lock-constant-face)
    :language 'java
    :override t
index 414b6eb2baff7071b3bfcee94ecd398e0e3f7ee2..48fecf6953701b025cb68473b084d61a1c36d319 100644 (file)
@@ -106,7 +106,7 @@ name.")
 
 (defconst js--plain-method-re
   (concat "^\\s-*?\\(" js--dotted-name-re "\\)\\.prototype"
-          "\\.\\(" js--name-re "\\)\\s-*?=\\s-*?\\(\\(:?async[ \t\n]+\\)function\\)\\_>")
+          "\\.\\(" js--name-re "\\)\\s-*?=\\s-*?\\(\\(?:async[ \t\n]+\\)function\\)\\_>")
   "Regexp matching an explicit JavaScript prototype \"method\" declaration.
 Group 1 is a (possibly-dotted) class name, group 2 is a method name,
 and group 3 is the `function' keyword.")
@@ -3493,7 +3493,7 @@ This function is intended for use in `after-change-functions'."
    :language 'javascript
    :feature 'constant
    '(((identifier) @font-lock-constant-face
-      (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
+      (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face))
 
      [(true) (false) (null)] @font-lock-constant-face)
 
@@ -3612,7 +3612,7 @@ This function is intended for use in `after-change-functions'."
    :feature 'number
    '((number) @font-lock-number-face
      ((identifier) @font-lock-number-face
-      (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face)))
+      (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face)))
 
    :language 'javascript
    :feature 'operator
index 91d65a2777b751c165b6fd5a79b32dbd1937d4d6..4b951f7606fa3768df42be9ac4b3e1e0c94ef9d3 100644 (file)
@@ -1021,7 +1021,7 @@ leading double colon is not added."
                               (:match "\\`\\$[#\"'`:?]" @global_var))
                              ;; ?' ?" ?` are character literals.
                              ((character) @char
-                              (:match "\\`?[#\"'`:?]" @char))
+                              (:match "\\`\\?[#\"'`:?]" @char))
                              ;; Symbols like :+, :<=> or :foo=.
                              ((simple_symbol) @symbol
                               (:match "\\s." @symbol))
index b55af0b49e367dbcada9cc3eff589739f93ece54..999c1d7ae9628e689c1d5b843859dd440f9c991c 100644 (file)
                               eol))
                       @font-lock-builtin-face)))
      ((identifier) @font-lock-type-face
-      (:match "\\`\\(:?Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face)))
+      (:match "\\`\\(?:Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face)))
 
    :language 'rust
    :feature 'comment
      (type_identifier) @font-lock-type-face
      ((scoped_identifier name: (identifier) @rust-ts-mode--fontify-tail))
      ((scoped_identifier path: (identifier) @font-lock-type-face)
-      (:match
-       "\\`\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)\\'"
-       @font-lock-type-face))
+      (:match ,(rx bos
+                   (or "u8" "u16" "u32" "u64" "u128" "usize"
+                       "i8" "i16" "i32" "i64" "i128" "isize"
+                       "char" "str")
+                   eos)
+              @font-lock-type-face))
      ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope))
      ((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope))
      (type_identifier) @font-lock-type-face)
    :feature 'constant
    `((boolean_literal) @font-lock-constant-face
      ((identifier) @font-lock-constant-face
-      (:match "\\`[A-Z][A-Z\\d_]*\\'" @font-lock-constant-face)))
+      (:match "\\`[A-Z][0-9A-Z_]*\\'" @font-lock-constant-face)))
 
    :language 'rust
    :feature 'variable
index 5df34de04722755ffec3d321898873a615715b06..68aefd90f92fe81f6f73a25cb2697e1eb1cadd35 100644 (file)
@@ -153,7 +153,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
    :language language
    :feature 'constant
    `(((identifier) @font-lock-constant-face
-      (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
+      (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face))
      [(true) (false) (null)] @font-lock-constant-face)
 
    :language language
@@ -311,7 +311,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
    :feature 'number
    `((number) @font-lock-number-face
      ((identifier) @font-lock-number-face
-      (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face)))
+      (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face)))
 
    :language language
    :feature 'operator