Compare commits

..

14 commits

Author SHA1 Message Date
Bruno BELANYI 6b2ecc78ac Test more 'select' related indentation cases
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-04-25 11:27:43 +00:00
Bruno BELANYI 626ffea712 Add queries to Rust bindings
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-04-23 15:52:56 +00:00
Bruno BELANYI 6918efba46 Add queries to 'package.json' 2024-04-23 15:52:56 +00:00
Bruno BELANYI d5654de519 Expose 'condition' node 2024-04-23 15:47:30 +00:00
Bruno BELANYI f267a5be95 Add multi-valued select expression 2024-04-23 15:43:10 +00:00
Bruno BELANYI 96ae542119 Name 'commaSeparated*' helpers consistently 2024-04-23 15:27:52 +00:00
Bruno BELANYI 8166742493 Remove trailing commas in 'select_value' arguments 2024-04-23 15:23:06 +00:00
Bruno BELANYI 7d8f958a90 Add boolean-typed select values 2024-04-23 15:14:16 +00:00
Bruno BELANYI 3bc77aab19 Remove 'selection_type' alias 2024-04-23 15:13:53 +00:00
Bruno BELANYI 734f4452dd Rename fields in 'select_value'
This aligns with upstream, and makes more sense given their usage.
2024-04-23 15:12:55 +00:00
Bruno BELANYI c56e2eca70 Simplify 'select_value' rule
Upstream has greatly simplified the parsing of `select` expressions, in
order to add multi-valued `select`.

To this end, we remove the hard-coded list of function names, and accept
an arbitrary number of arguments.
2024-04-23 15:11:00 +00:00
Bruno BELANYI b2e113a821 Relax ordering in 'select' cases
We shouldn't really care whether or not `default` *is* the last value...
2024-04-23 14:38:32 +00:00
Bruno BELANYI 93a71d095b Add more generated files attributes
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-04-22 09:54:16 +00:00
Bruno BELANYI bc4db561ca Bump flake inputs
All checks were successful
ci/woodpecker/push/check Pipeline was successful
This means regenerating all the tree-sitter files, and adding newly
generated outputs (mostly new bindings).

The `--apply-all-captures` flag has been removed, it is now the default
(and only) matching behaviour.
2024-04-22 09:49:18 +00:00
7 changed files with 5 additions and 61 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "tree-sitter-bp"
description = "Blueprint grammar for the tree-sitter parsing library"
version = "0.4.0"
version = "0.3.0"
keywords = ["incremental", "parsing", "android", "blueprint"]
categories = ["parsing", "text-editors"]
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-bp"

View file

@ -61,10 +61,6 @@
export NVIM_TREESITTER_TEXTOBJECTS='${pkgs.vimPlugins.nvim-treesitter-textobjects}'
export NVIM_TREESITTER_PARSER='${pkgs.vimPlugins.nvim-treesitter.grammarToPlugin self.packages.${system}.tree-sitter-bp}'
# FIXME: not sure why, but I get different behaviour when left untouched
XDG_CONFIG_HOME=$(mktemp -d)
export XDG_CONFIG_HOME
nvim --headless --noplugin -u ${scripts/minimal_init.lua} \
-c "PlenaryBustedDirectory test/ { minimal_init = '${./scripts/minimal_init.lua}' }"
'';
@ -78,9 +74,8 @@
${pkgs.jq}/bin/jq ".version = \"''${NEW_VERSION}\"" package.json > package.json.tmp
mv package.json.tmp package.json
${pkgs.gnused}/bin/sed -i -e "s/version = \"[0-9.]\\+\"/version = \"''${NEW_VERSION}\"/" Cargo.toml
${pkgs.gnused}/bin/sed -i -e "s/version = \"[0-9.]\\+\"/version = \"''${NEW_VERSION}\"/" pyproject.toml
git add Cargo.toml package.json pyproject.toml
git add Cargo.toml package.json
echo "Release ''${NEW_VERSION}" | git commit -eF -
git tag -a "v''${NEW_VERSION}" -m "Release ''${NEW_VERSION}"
'';

View file

@ -1,6 +1,6 @@
{
"name": "tree-sitter-bp",
"version": "0.4.0",
"version": "0.3.0",
"description": "Blueprint grammar for tree-sitter",
"main": "bindings/node",
"types": "bindings/node",

View file

@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "tree-sitter-bp"
description = "Bp grammar for tree-sitter"
version = "0.4.0"
version = "0.0.1"
keywords = ["incremental", "parsing", "tree-sitter", "bp"]
classifiers = [
"Intended Audience :: Developers",

View file

@ -11,15 +11,6 @@
(select_expression
")" @indent.branch)
(select_value) @indent.begin
(select_value
")" @indent.branch)
(select_pattern
"(" @indent.begin)
(select_pattern
")" @indent.branch)
(select_cases) @indent.begin
(select_cases
"}" @indent.branch)

View file

@ -26,35 +26,3 @@ foo = select(
default: 0,
}
)
foo = select((
arch(),
os(),
), {
(default, default): [],
})
foo = select(
(arch(), os()),
{
(default, default): [],
}
)
// We're really getting into more and more unlikely choices here...
foo = select(
(
arch(),
os(),
),
{
(default, default): [],
}
)
foo = select((arch(), os()), {
(
default,
default,
): [],
})

View file

@ -1,7 +1,6 @@
package.path = package.path .. ";" .. vim.env.NVIM_TREESITTER .. "/?.lua"
local Runner = require("tests.indent.common").Runner
local XFAIL = require("tests.indent.common").XFAIL
-- FIXME: path to root
local runner = Runner:new(it, ".", {
@ -20,7 +19,7 @@ describe("indent Blueprint:", function()
})
runner:whole_file("test/indent/", {
expected_failures = {
"test/indent/select.bp",
-- NOTE: none for now
},
})
end)
@ -48,14 +47,5 @@ describe("indent Blueprint:", function()
runner:new_line("test/indent/select.bp", { on_line = 26, text = 'default: "value"', indent = 8 }, "default case, trailing, alternate formatting")
runner:new_line("test/indent/select.bp", { on_line = 26, text = '}', indent = 4 }, "select cases closing delimiter, alternate formatting")
runner:new_line("test/indent/select.bp", { on_line = 27, text = ')', indent = 0 }, "select expression closing delimiter, alternate formatting")
runner:new_line("test/indent/select.bp", { on_line = 30, text = 'device()', indent = 4 }, "multi-valued select condition, begin")
runner:new_line("test/indent/select.bp", { on_line = 31, text = 'device()', indent = 4 }, "multi-valued select condition, middle")
runner:new_line("test/indent/select.bp", { on_line = 32, text = 'device()', indent = 4 }, "multi-valued select condition, end")
runner:new_line("test/indent/select.bp", { on_line = 46, text = 'device()', indent = 8 }, "multi-valued select condition, begin, alternate formatting")
runner:new_line("test/indent/select.bp", { on_line = 47, text = 'device()', indent = 8 }, "multi-valued select condition, middle, alternate formatting")
runner:new_line("test/indent/select.bp", { on_line = 48, text = 'device()', indent = 8 }, "multi-valued select condition, end, alternate formatting")
runner:new_line("test/indent/select.bp", { on_line = 56, text = 'default,', indent = 8 }, "multi-valued select case, begin", XFAIL)
runner:new_line("test/indent/select.bp", { on_line = 57, text = 'default,', indent = 8 }, "multi-valued select case, middle", XFAIL)
runner:new_line("test/indent/select.bp", { on_line = 58, text = 'default,', indent = 8 }, "multi-valued select case, end", XFAIL)
end)
end)