mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-20 18:17:20 +00:00
Accept versioned tree-sitter language grammar files
By discussion on emacs-devel, titled "Versioned Tree-sitter parser libraries". * src/treesit.c (Vtreesit_str_dot_0): New variable. (treesit_load_language_push_for_each_suffix): Additionally look for lib_base_name.0 and lib_base_name.0.0. (syms_of_treesit): Initialize Vtreesit_str_dot_0.
This commit is contained in:
parent
99add09d5e
commit
8f71c1546d
@ -404,6 +404,7 @@ init_treesit_functions (void)
|
||||
|
||||
static Lisp_Object Vtreesit_str_libtree_sitter;
|
||||
static Lisp_Object Vtreesit_str_tree_sitter;
|
||||
static Lisp_Object Vtreesit_str_dot_0;
|
||||
static Lisp_Object Vtreesit_str_dot;
|
||||
static Lisp_Object Vtreesit_str_question_mark;
|
||||
static Lisp_Object Vtreesit_str_star;
|
||||
@ -529,8 +530,19 @@ treesit_load_language_push_for_each_suffix (Lisp_Object lib_base_name,
|
||||
suffixes = Vdynamic_library_suffixes;
|
||||
|
||||
FOR_EACH_TAIL (suffixes)
|
||||
*path_candidates = Fcons (concat2 (lib_base_name, XCAR (suffixes)),
|
||||
*path_candidates);
|
||||
{
|
||||
Lisp_Object candidate1 = concat2 (lib_base_name, XCAR (suffixes));
|
||||
/* Support libraries named with ABI version numbers. In the
|
||||
foreseeable future we only need to support version 0.0. See
|
||||
the thread titled "Versioned Tree-sitter parser libraries" on
|
||||
emacs-devel. */
|
||||
Lisp_Object candidate2 = concat2 (candidate1, Vtreesit_str_dot_0);
|
||||
Lisp_Object candidate3 = concat2 (candidate2, Vtreesit_str_dot_0);
|
||||
|
||||
*path_candidates = Fcons (candidate3, *path_candidates);
|
||||
*path_candidates = Fcons (candidate2, *path_candidates);
|
||||
*path_candidates = Fcons (candidate1, *path_candidates);
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the dynamic library of LANGUAGE_SYMBOL and return the pointer
|
||||
@ -3583,6 +3595,8 @@ then in the system default locations for dynamic libraries, in that order. */);
|
||||
Vtreesit_str_libtree_sitter = build_pure_c_string ("libtree-sitter-");
|
||||
staticpro (&Vtreesit_str_tree_sitter);
|
||||
Vtreesit_str_tree_sitter = build_pure_c_string ("tree-sitter-");
|
||||
staticpro (&Vtreesit_str_dot_0);
|
||||
Vtreesit_str_dot_0 = build_pure_c_string (".0");
|
||||
staticpro (&Vtreesit_str_dot);
|
||||
Vtreesit_str_dot = build_pure_c_string (".");
|
||||
staticpro (&Vtreesit_str_question_mark);
|
||||
|
Loading…
Reference in New Issue
Block a user