Some grammars packages (like, for example, tree-sitter-agda) uses
different versioning scheme from vast majority of grammars in
tree-sitter github organization.
Also, third-party grammars doesn't follow tree-sitter versioning.
Also, some grammars (like tree-sitter-haskell, for example) only had
old release tagged, but having compatible and useful grammars in
current HEAD.
Also, some grammars like tree-sitter-verilog, even have only v0.0 tag.
So, instead of assuming grammar ABI version based on ${PV} (ver_test)
we decided to take ABI version drectly from source code.
Signed-off-by: Vadim Misbakh-Soloviov <
[email protected]>
---
Changes since previous commit: applied @mgorny's suggestion about sed
script.
eclass/tree-sitter-grammar.eclass | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/eclass/tree-sitter-grammar.eclass b/eclass/tree-sitter-grammar.eclass
index 46573027f96..7207ecf3ddd 100644
--- a/eclass/tree-sitter-grammar.eclass
+++ b/eclass/tree-sitter-grammar.eclass
@@ -40,15 +40,13 @@ EXPORT_FUNCTIONS src_compile src_install
# @INTERNAL
# @DESCRIPTION:
# This internal function determines the ABI version of a grammar library based -# on the package version.
+# on a constant in the source file.
_get_tsg_abi_ver() {
- if ver_test -gt 0.21; then
- die "Grammar too new; unknown ABI version"
- elif ver_test -ge 0.19.0; then
- echo 13
- else
- die "Grammar too old; unknown ABI version"
- fi
+ # This sed script finds ABI definition string in parser source file,
+ # substitutes all the string until the ABI number, and prints remains
+ # (the ABI number its