Fix for grammar change of keyword "virtual" in tree-sitter-cpp

The new rule works with both the new (>= 0.22.1) and the
old (<= 0.22.0) grammar libraries.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--keywords): Removed
the keyword "virtual".
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
New font lock rule. (Bug#71518)
This commit is contained in:
Vincenzo Pupillo 2024-06-22 16:22:16 +02:00 committed by Eli Zaretskii
parent fa364a0d46
commit 014aab9847

View file

@ -572,7 +572,7 @@ MODE is either `c' or `cpp'."
"not" "not_eq" "operator" "or" "not" "not_eq" "operator" "or"
"or_eq" "override" "private" "protected" "or_eq" "override" "private" "protected"
"public" "requires" "template" "throw" "public" "requires" "template" "throw"
"try" "typename" "using" "virtual" "try" "typename" "using"
"xor" "xor_eq")) "xor" "xor_eq"))
(append '("auto") c-keywords)))) (append '("auto") c-keywords))))
@ -635,7 +635,8 @@ MODE is either `c' or `cpp'."
`([,@(c-ts-mode--keywords mode)] @font-lock-keyword-face `([,@(c-ts-mode--keywords mode)] @font-lock-keyword-face
,@(when (eq mode 'cpp) ,@(when (eq mode 'cpp)
'((auto) @font-lock-keyword-face '((auto) @font-lock-keyword-face
(this) @font-lock-keyword-face))) (this) @font-lock-keyword-face
(virtual) @font-lock-keyword-face)))
:language mode :language mode
:feature 'operator :feature 'operator