uyha / tree-sitter-cmake

A Tree-sitter parser for CMake
MIT License
41 stars 9 forks source link

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

Closed chuxubank closed 9 months ago

chuxubank commented 9 months ago

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 9 months ago

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

uyha commented 9 months ago

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.

chuxubank commented 9 months ago

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 9 months ago

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