diff options
| author | Yuan Fu | 2025-11-02 16:16:50 -0800 |
|---|---|---|
| committer | Yuan Fu | 2025-11-02 17:11:55 -0800 |
| commit | b01435306a36e4e75671fbe7bacea351f89947d5 (patch) | |
| tree | 702393061f1a049f87c892637365a0582170b136 /test/src | |
| parent | 68290e1a03ba4f264eab5d25960cf907b0c903fe (diff) | |
| download | emacs-b01435306a36e4e75671fbe7bacea351f89947d5.tar.gz emacs-b01435306a36e4e75671fbe7bacea351f89947d5.zip | |
Change tree-sitter query predicate names (bug#79687)
Latest tree-sitter library throws a syntax error if the
predicate names in a query don't end with question mark. So we
made the following change:
:equal changed to :eq?
:match changed to :match?
:pred changed to :pred?
Old names are transparently converted to new names when
expanding patterns.
:match predicate can now take the regexp and the node in any
order: it'll figure out which is which automatically. This way
it works with current Emacs convention (regexp first), as well
as tree-sitter's match convention (regexp second).
* doc/lispref/parsing.texi (Pattern Matching): Update manuel to
use new predicate names.
* src/treesit.c:
(Ftreesit_pattern_expand):
(Ftreesit_query_expand):
(treesit_predicate_match):
(treesit_eval_predicates):
(syms_of_treesit): Use new predicate names.
* test/src/treesit-tests.el (treesit-query-api): Update test.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/treesit-tests.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el index b5ea63a53f3..89303114735 100644 --- a/test/src/treesit-tests.el +++ b/test/src/treesit-tests.el | |||
| @@ -547,10 +547,10 @@ BODY is the test body." | |||
| 547 | ;; String query. | 547 | ;; String query. |
| 548 | '("(string) @string | 548 | '("(string) @string |
| 549 | (pair key: (_) @keyword) | 549 | (pair key: (_) @keyword) |
| 550 | ((_) @bob (#match \"\\\\`B.b\\\\'\" @bob)) | 550 | ((_) @bob (#match? \"\\\\`B.b\\\\'\" @bob)) |
| 551 | (number) @number | 551 | (number) @number |
| 552 | ((number) @n3 (#equal \"3\" @n3)) | 552 | ((number) @n3 (#eq? \"3\" @n3)) |
| 553 | ((number) @n3p (#pred treesit--ert-pred-last-sibling @n3p))" | 553 | ((number) @n3p (#pred? treesit--ert-pred-last-sibling @n3p))" |
| 554 | ;; Sexp query. | 554 | ;; Sexp query. |
| 555 | ((string) @string | 555 | ((string) @string |
| 556 | (pair key: (_) @keyword) | 556 | (pair key: (_) @keyword) |