Further regexp fixes to follow separately (bug#64019#29).
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
* lisp/progmodes/cmake-ts-mode.el
(cmake-ts-mode--font-lock-settings):
* lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings):
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
* lisp/progmodes/python.el (python--treesit-settings):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
* lisp/progmodes/sh-script.el (sh-mode--treesit-settings):
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings):
* test/src/treesit-tests.el (treesit-query-api): Anchor :match
regexps at beginning/end of string, not line.
`(((call_expression
(call_expression function: (identifier) @fn)
@c-ts-mode--fontify-DEFUN)
- (:match "^DEFUN$" @fn))
+ (:match "\\`DEFUN\\'" @fn))
((function_definition type: (_) @for-each-tail)
@c-ts-mode--fontify-for-each-tail
:language 'cmake
:feature 'number
'(((unquoted_argument) @font-lock-number-face
- (:match "^[[:digit:]]*\\.?[[:digit:]]*\\.?[[:digit:]]+$" @font-lock-number-face)))
+ (:match "\\`[[:digit:]]*\\.?[[:digit:]]*\\.?[[:digit:]]+\\'"
+ @font-lock-number-face)))
:language 'cmake
:feature 'string
:override t
:feature 'constant
`(((identifier) @font-lock-constant-face
- (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
+ (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
[(true) (false)] @font-lock-constant-face)
:language 'java
:override t
(scoped_identifier (identifier) @font-lock-constant-face)
((scoped_identifier name: (identifier) @font-lock-type-face)
- (:match "^[A-Z]" @font-lock-type-face))
+ (:match "\\`[A-Z]" @font-lock-type-face))
(type_identifier) @font-lock-type-face
:language 'javascript
:feature 'constant
'(((identifier) @font-lock-constant-face
- (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
+ (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
[(true) (false) (null)] @font-lock-constant-face)
: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
:language 'python
`([,@python--treesit-keywords] @font-lock-keyword-face
((identifier) @font-lock-keyword-face
- (:match "^self$" @font-lock-keyword-face)))
+ (:match "\\`self\\'" @font-lock-keyword-face)))
:feature 'definition
:language 'python
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
(scoped_use_list path: (scoped_identifier
name: (identifier) @font-lock-constant-face))
((use_as_clause alias: (identifier) @font-lock-type-face)
- (:match "^[A-Z]" @font-lock-type-face))
+ (:match "\\`[A-Z]" @font-lock-type-face))
((use_as_clause path: (identifier) @font-lock-type-face)
- (:match "^[A-Z]" @font-lock-type-face))
+ (:match "\\`[A-Z]" @font-lock-type-face))
((use_list (identifier) @font-lock-type-face)
- (:match "^[A-Z]" @font-lock-type-face))
+ (:match "\\`[A-Z]" @font-lock-type-face))
(use_wildcard [(identifier) @rust-ts-mode--fontify-scope
(scoped_identifier
name: (identifier) @rust-ts-mode--fontify-scope)])
((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\\)$"
+ "\\`\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)\\'"
@font-lock-type-face))
((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope))
((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope))
: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][A-Z\\d_]*\\'" @font-lock-constant-face)))
:language 'rust
:feature 'variable
:feature 'number
:language 'bash
`(((word) @font-lock-number-face
- (:match "^[0-9]+$" @font-lock-number-face)))
+ (:match "\\`[0-9]+\\'" @font-lock-number-face)))
:feature 'bracket
:language 'bash
:language language
:feature 'constant
`(((identifier) @font-lock-constant-face
- (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
+ (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face))
[(true) (false) (null)] @font-lock-constant-face)
:language language
: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
;; String query.
'("(string) @string
(pair key: (_) @keyword)
-((_) @bob (#match \"^B.b$\" @bob))
+((_) @bob (#match \"\\\\`B.b\\\\'\" @bob))
(number) @number
((number) @n3 (#equal \"3\" @n3))
((number) @n3p (#pred treesit--ert-pred-last-sibling @n3p))"
;; Sexp query.
((string) @string
(pair key: (_) @keyword)
- ((_) @bob (:match "^B.b$" @bob))
+ ((_) @bob (:match "\\`B.b\\'" @bob))
(number) @number
((number) @n3 (:equal "3" @n3))
((number) @n3p (:pred treesit--ert-pred-last-sibling