From 4c1a76ec236838a101e921ee349a47f323502092 Mon Sep 17 00:00:00 2001 From: Beartama <8091245+uyha@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:38:10 +0200 Subject: [PATCH] feat: add EDS --- lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 8 ++++++ queries/eds/folds.scm | 1 + queries/eds/highlights.scm | 49 +++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 queries/eds/folds.scm create mode 100644 queries/eds/highlights.scm diff --git a/lockfile.json b/lockfile.json index 15ff2ff72..89f215c27 100644 --- a/lockfile.json +++ b/lockfile.json @@ -116,6 +116,9 @@ "ebnf": { "revision": "8e635b0b723c620774dfb8abf382a7f531894b40" }, + "eds": { + "revision": "fde62029d4c715562230070b9af51a9500c2ce10" + }, "eex": { "revision": "f742f2fe327463335e8671a87c0b9b396905d1d1" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 460ccea18..6fc18cbf9 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -403,6 +403,14 @@ list.ebnf = { experimental = true, } +list.eds = { + install_info = { + url = "https://github.com/uyha/tree-sitter-eds", + files = { "src/parser.c" }, + }, + maintainers = { "@uyha" }, +} + list.eex = { install_info = { url = "https://github.com/connorlay/tree-sitter-eex", diff --git a/queries/eds/folds.scm b/queries/eds/folds.scm new file mode 100644 index 000000000..911798f5a --- /dev/null +++ b/queries/eds/folds.scm @@ -0,0 +1 @@ +(section) @fold diff --git a/queries/eds/highlights.scm b/queries/eds/highlights.scm new file mode 100644 index 000000000..42f408754 --- /dev/null +++ b/queries/eds/highlights.scm @@ -0,0 +1,49 @@ +"=" @punctuation.delimiter + +[ "[" "]" ] @punctuation.bracket + +((section_name) @variable.builtin + (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) + +((section_name) @variable.builtin + (#lua-match? @variable.builtin "^1")) + +(section + (section_name) @_name + (#match? @_name "\\c^Comments$")) @comment + +(section + (section_name) @_name + (statement (key) @_key) @string + (#match? @_key "\\c^ParameterName$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @type + (#match? @_key "\\c^ObjectType$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @type + (#match? @_key "\\c^DataType$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @type.qualifier + (#match? @_key "\\c^AccessType$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @attribute + (#match? @_key "\\c^PDOMapping$") + (#not-match? @_name "\\c^Comments$")) + +(section + (section_name) @_name + (statement (key) @_key) @number + (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") + (#not-match? @_name "\\c^Comments$"))