* cli: Specify abi version via env var * bindings: Correct Zig bindings to expose a language function * lib: Prevent finished_tree assertion failure * Correct build steps for WASM files * rust: Correct doc comments - update to 0.25.0: Full changelog: https://github.com/tree-sitter/tree-sitter/releases/tag/v0.25.0 Notices: * web-tree-sitter was rewritten in TypeScript * Parsing and Querying should be cancelled using the "progress callback", rather than setting a timeout or a cancellation flag * MISSING nodes can now be queried * The ts_node_child_containing_descendant function was removed; use ts_node_child_with_descendant * TSInput now includes a (mandatory) new field DecodeFunction Breaking: * Properly handle UTF-16 endianness encoding * Bump internal abi to 15 * Update playground with new web bindings * bindings: Update swift bindings * cli: Remove migration code for tree-sitter.json * generate: Use regex_syntax::Hir for expanding regexes * lib: Remove ts_node_child_containing_descendant * lib: Add the ability to specify a custom decode function * web: Rewrite the library in TypeScript * web: Use the WASM module in the bindings, and not the other way around * web: Rename pattern to patternIndex in QueryMatch * web: Deprecate Language.query in favor of new Query OBS-URL: https://build.opensuse.org/package/show/editors:tree-sitter/tree-sitter?expand=0&rev=6
65 lines
2.1 KiB
Bash
65 lines
2.1 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# SPDX-FileCopyrightText: 2024 Björn Bidar
|
|
# based of compile-macros.sh from python-rpm-macros
|
|
mkdir -p macros
|
|
|
|
### Lua: generate automagic from macros.in and macros.lua
|
|
(
|
|
# copy macros.in up to LUA-MACROS
|
|
sed -n -e '1,/^### LUA-MACROS ###$/p' macros.in
|
|
|
|
# include "functions.lua", without empty lines, as %_treesitter_definitions
|
|
echo "%_treesitter_definitions %{lua:"
|
|
sed -n -r \
|
|
-e 's/\\/\\\\/g' \
|
|
-e '/^.+$/p' \
|
|
functions.lua
|
|
echo "}"
|
|
|
|
INFUNC=0
|
|
INMULTILINE_MACRO=0
|
|
# brute line-by-line read of macros.lua
|
|
IFS=""
|
|
while read -r line; do
|
|
if [ $INFUNC = 0 ] ; then
|
|
if [ $INMULTILINE_MACRO = 1 ] ;then
|
|
if echo "$line" | grep -qE '^.*\]\]' ; then
|
|
INMULTILINE_MACRO=0
|
|
fi
|
|
echo "# $line"
|
|
elif echo "$line" | grep -qE -- '--\[\[' ; then
|
|
INMULTILINE_MACRO=1
|
|
echo "# $line"
|
|
elif echo "$line" | grep -qE -- '^--' ; then
|
|
echo "# $line"
|
|
elif echo "$line" | grep -q '^function '; then
|
|
# entering top-level Lua function
|
|
INFUNC=1;
|
|
echo "$line" | sed -r -e 's/^function (.*)\((.*)\)$/%\1(\2) %{lua: \\/'
|
|
else
|
|
# outside function, copy
|
|
# (usually this is newline)
|
|
echo "$line"
|
|
fi
|
|
else
|
|
if [ "$line" = "end" ]; then
|
|
# leaving top-level Lua function
|
|
INFUNC=0;
|
|
echo '}'
|
|
elif [ $INFUNC = 1 ]; then
|
|
# inside function
|
|
# double backslashes and add backslash to end of line
|
|
echo "$line" | sed -e 's/\\/\\\\/g' -e 's/$/\\/'
|
|
fi
|
|
fi
|
|
done < macros.lua
|
|
|
|
# copy rest of macros.in
|
|
sed -n -e '/^### LUA-MACROS ###$/,$p' macros.in
|
|
) > macros/050-automagic
|
|
|
|
|
|
### final step: cat macros/*, but with files separated by additional newlines
|
|
sed -e '$s/$/\n/' -s macros/* > macros.treesitter
|