Full changelog: https://github.com/tree-sitter/tree-sitter/releases/tag/v0.25.3 Bug Fixes * Fixed an infinite loop that could happen in some grammars during error recovery if the end of the file was reached. * Fixed a parser-generation error where internal character set constants were given external linkage, which could cause linking errors on some platforms if multiple Tree-sitter parsers were linked into the same application. - update to 0.25.2: Full changelog: https://github.com/tree-sitter/tree-sitter/releases/tag/v0.25.2 Bug Fixes * Fixed a crash that could occur when loading WASM-compiled languages that were generated with an earlier version of the Tree-sitter CLI. * Fixed incorrect tokenization when using WASM-compiled languages, if the language's external scanner did not assign to result_symbol * Fixed an infinite loop that could occur if external scanners returned empty extra tokens OBS-URL: https://build.opensuse.org/package/show/editors:tree-sitter/tree-sitter?expand=0&rev=7
61 lines
1.2 KiB
Lua
61 lines
1.2 KiB
Lua
--[[
|
|
SPDX-License-Identifier: GPL-2.0
|
|
SPDX-FileCopyrightText: 2024 Björn Bidar
|
|
|
|
partly based of functions.lua from python-rpm-macros
|
|
--]]
|
|
|
|
-- declare common functions
|
|
function string.startswith(str, prefix)
|
|
return str:sub(1, prefix:len()) == prefix
|
|
end
|
|
|
|
function string.endswith(str, suffix)
|
|
return str:sub(-suffix:len()) == suffix
|
|
end
|
|
|
|
function string.dirname(str)
|
|
if str:match("(.*)/") == "" then
|
|
return nil
|
|
else
|
|
return str:match("(.*)/")
|
|
end
|
|
end
|
|
|
|
function string.basename(str)
|
|
while true do
|
|
local idx = str:find("/")
|
|
if not idx then return str end
|
|
str = str:sub(idx + 1)
|
|
end
|
|
end
|
|
|
|
function string.split(str, sep)
|
|
if sep == nil then
|
|
sep = '%s'
|
|
end
|
|
|
|
local res = {}
|
|
local func = function(w)
|
|
table.insert(res, w)
|
|
end
|
|
|
|
string.gsub(str, '[^'..sep..']+', func)
|
|
return res
|
|
end
|
|
|
|
function arg_compat()
|
|
--[[
|
|
Compat macro as workaround for older rpm not having function
|
|
arguments available as table arg(uments)
|
|
--]]
|
|
local arg_count = rpm.expand("%#")
|
|
local arg = {}
|
|
|
|
for arg_num = 1,arg_count do
|
|
arg[arg_num] = rpm.expand(("%" .. arg_num))
|
|
end
|
|
|
|
return arg
|
|
end
|