aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliot Fontaine <92150839+elliotfontaine@users.noreply.github.com>2024-10-31 17:56:58 +0100
committerGitHub <noreply@github.com>2024-10-31 17:56:58 +0100
commit92d2501d698e0fe855bd222540f9648890fab6c7 (patch)
tree65337feab645d7fd47a6bbd579a11f5dd7be01e4
parentbot(lockfile): update editorconfig, gleam, heex, superhtml (diff)
downloadnvim-treesitter-92d2501d698e0fe855bd222540f9648890fab6c7.tar
nvim-treesitter-92d2501d698e0fe855bd222540f9648890fab6c7.tar.gz
nvim-treesitter-92d2501d698e0fe855bd222540f9648890fab6c7.tar.bz2
nvim-treesitter-92d2501d698e0fe855bd222540f9648890fab6c7.tar.lz
nvim-treesitter-92d2501d698e0fe855bd222540f9648890fab6c7.tar.xz
nvim-treesitter-92d2501d698e0fe855bd222540f9648890fab6c7.tar.zst
nvim-treesitter-92d2501d698e0fe855bd222540f9648890fab6c7.zip
feat(cylc): add parser and queries (#7225)
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/cylc/folds.scm10
-rw-r--r--queries/cylc/highlights.scm72
-rw-r--r--queries/cylc/indents.scm16
-rw-r--r--queries/cylc/injections.scm11
7 files changed, 121 insertions, 0 deletions
diff --git a/README.md b/README.md
index e1a7b6325..167753300 100644
--- a/README.md
+++ b/README.md
@@ -207,6 +207,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [csv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
- [x] [cuda](https://github.com/theHamsta/tree-sitter-cuda) (maintained by @theHamsta)
- [x] [cue](https://github.com/eonpatapon/tree-sitter-cue) (maintained by @amaanq)
+- [x] [cylc](https://github.com/elliotfontaine/tree-sitter-cylc) (maintained by @elliotfontaine)
- [x] [d](https://github.com/gdamore/tree-sitter-d) (maintained by @amaanq)
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @akinsho)
- [x] [desktop](https://github.com/ValdezFOmar/tree-sitter-desktop) (maintained by @ValdezFOmar)
diff --git a/lockfile.json b/lockfile.json
index ef2fb39e8..29e80ffdf 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -101,6 +101,9 @@
"cue": {
"revision": "8a5f273bfa281c66354da562f2307c2d394b6c81"
},
+ "cylc": {
+ "revision": "30dd40d9bf23912e4aefa93eeb4c7090bda3d0f6"
+ },
"d": {
"revision": "45e5f1e9d6de2c68591bc8e5ec662cf18e950b4a"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index fd79f8af7..8e3ce2cf4 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -349,6 +349,14 @@ list.cue = {
maintainers = { "@amaanq" },
}
+list.cylc = {
+ install_info = {
+ url = "https://github.com/elliotfontaine/tree-sitter-cylc",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@elliotfontaine" },
+}
+
list.d = {
install_info = {
url = "https://github.com/gdamore/tree-sitter-d",
diff --git a/queries/cylc/folds.scm b/queries/cylc/folds.scm
new file mode 100644
index 000000000..c8bd40703
--- /dev/null
+++ b/queries/cylc/folds.scm
@@ -0,0 +1,10 @@
+[
+ (multiline_string)
+ (multiline_graph_string)
+ (top_section)
+ (sub_section_1)
+ (sub_section_2)
+ (runtime_section)
+ (task_section)
+ (graph_section)
+] @fold
diff --git a/queries/cylc/highlights.scm b/queries/cylc/highlights.scm
new file mode 100644
index 000000000..a744caa52
--- /dev/null
+++ b/queries/cylc/highlights.scm
@@ -0,0 +1,72 @@
+(comment) @comment @spell
+
+(key) @property
+
+(boolean) @boolean
+
+(datetime) @string.special
+
+(task_name) @function
+
+(include_directive) @keyword.import
+
+[
+ (section_name)
+ (namespace)
+] @markup.heading
+
+[
+ (integer)
+ (recurrence)
+] @number
+
+[
+ "["
+ "]"
+ "[["
+ "]]"
+ "[[["
+ "]]]"
+ "<"
+ ">"
+ (graph_parenthesis)
+] @punctuation.bracket
+
+[
+ "\""
+ "\"\"\""
+ (unquoted_string)
+ (quoted_string)
+ (multiline_string)
+] @string
+
+[
+ (xtrigger_annotation)
+ (suicide_annotation)
+] @attribute
+
+[
+ "="
+ (assignment_operator)
+ (graph_logical)
+ (graph_arrow)
+] @operator
+
+(include_statement
+ path: (_)? @string.special.path)
+
+(task_parameter
+ name: (_)? @variable.parameter
+ selection: (_)? @variable.parameter)
+
+(task_output
+ ":" @tag
+ (nametag) @variable.builtin
+ "?"? @tag)
+
+[
+ (jinja2_expression)
+ (jinja2_statement)
+ (jinja2_comment)
+ (jinja2_shebang)
+] @keyword.directive
diff --git a/queries/cylc/indents.scm b/queries/cylc/indents.scm
new file mode 100644
index 000000000..0457e4580
--- /dev/null
+++ b/queries/cylc/indents.scm
@@ -0,0 +1,16 @@
+[
+ (top_section)
+ (sub_section_1)
+ (sub_section_2)
+ (graph_section)
+ (runtime_section)
+ (task_section)
+] @indent.begin
+
+(multiline_string
+ quotes_close: _ @indent.end) @indent.begin
+
+(multiline_graph_string
+ quotes_close: _ @indent.end) @indent.begin
+
+(line_continuation) @indent.zero
diff --git a/queries/cylc/injections.scm b/queries/cylc/injections.scm
new file mode 100644
index 000000000..41becd699
--- /dev/null
+++ b/queries/cylc/injections.scm
@@ -0,0 +1,11 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+; https://cylc.github.io/cylc-doc/latest/html/user-guide/task-implementation/job-scripts.html#jobscripts
+((setting
+ key: (key) @_key
+ (#any-of? @_key
+ "script" "init-script" "env-script" "pre-script" "post-script" "err-script" "exit-script")
+ value: (_
+ (string_content) @injection.content))
+ (#set! injection.language "bash"))