uyha/tree-sitter-cmake

Error when use with Emacs's cmake-ts-mode

chuxubank opened this issue · 4 comments

When I want to use cmake-ts-mode inside of Emacs 29, the error in message buffer shows up and the syntax is not highlighted at all.

Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Structure error at" 19 "((foreach_command ((argument) @font-lock-constant-face (#match \"\\\\(?:^\\\\(?:I\\\\(?:N\\\\|TEMS\\\\)\\\\|LISTS\\\\|RANGE\\\\|ZIP_LISTS\\\\)$\\\\)\" @font-lock-constant-face)))) ((if_command ((argument) @font-lock-constant-face (#match \"\\\\(?:^\\\\(?:AND\\\\|COMMAND\\\\|DEFINED\\\\|E\\\\(?:QUAL\\\\|XISTS\\\\)\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\|MATCHES\\\\|NOT\\\\|OR\\\\|PATH_EQUAL\\\\|STR\\\\(?:EQUAL\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\)\\\\|VERSION_\\\\(?:EQUAL\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\)\\\\)$\\\\)\" @font-lock-constant-face))))" "Debug the query with `treesit-query-validate'") [2 times]
Error during redisplay: (jit-lock-function 37) signaled (treesit-query-error "Structure error at" 19 "((foreach_command ((argument) @font-lock-constant-face (#match \"\\\\(?:^\\\\(?:I\\\\(?:N\\\\|TEMS\\\\)\\\\|LISTS\\\\|RANGE\\\\|ZIP_LISTS\\\\)$\\\\)\" @font-lock-constant-face)))) ((if_command ((argument) @font-lock-constant-face (#match \"\\\\(?:^\\\\(?:AND\\\\|COMMAND\\\\|DEFINED\\\\|E\\\\(?:QUAL\\\\|XISTS\\\\)\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\|MATCHES\\\\|NOT\\\\|OR\\\\|PATH_EQUAL\\\\|STR\\\\(?:EQUAL\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\)\\\\|VERSION_\\\\(?:EQUAL\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\)\\\\)$\\\\)\" @font-lock-constant-face))))" "Debug the query with `treesit-query-validate'")
Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Structure error at" 19 "((foreach_command ((argument) @font-lock-constant-face (#match \"\\\\(?:^\\\\(?:I\\\\(?:N\\\\|TEMS\\\\)\\\\|LISTS\\\\|RANGE\\\\|ZIP_LISTS\\\\)$\\\\)\" @font-lock-constant-face)))) ((if_command ((argument) @font-lock-constant-face (#match \"\\\\(?:^\\\\(?:AND\\\\|COMMAND\\\\|DEFINED\\\\|E\\\\(?:QUAL\\\\|XISTS\\\\)\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\|MATCHES\\\\|NOT\\\\|OR\\\\|PATH_EQUAL\\\\|STR\\\\(?:EQUAL\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\)\\\\|VERSION_\\\\(?:EQUAL\\\\|GREATER\\\\(?:_EQUAL\\\\)?\\\\|LESS\\\\(?:_EQUAL\\\\)?\\\\)\\\\)$\\\\)\" @font-lock-constant-face))))" "Debug the query with `treesit-query-validate'")
image

Minimal reproduce file:

cmake_minimum_required(VERSION 3.27)
uyha commented

this seems to be a problem with the queries that your Emac is using, not a problem with the parser itself

uyha commented

maybe the queries are too old for the tree-sitter-cmake version you have, I made a big change in v0.4.0 and the queries don't seem to be updated with that change.

Thanks for the explaination.
So, it seemed not a good idea to use the xxx-ts-mode carried with Emacs 🤔
I will try to use cmake-mode for the time beining.

uyha commented

maybe you can create an issue on the Emac package side, I don't use Emac so I don't know the ecosystem there.