feat(cylc): add parser and queries (#7225)

This commit is contained in:
Elliot Fontaine 2024-10-31 17:56:58 +01:00 committed by GitHub
parent f9e9370a6f
commit 92d2501d69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 121 additions and 0 deletions

View file

@ -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)

View file

@ -101,6 +101,9 @@
"cue": {
"revision": "8a5f273bfa281c66354da562f2307c2d394b6c81"
},
"cylc": {
"revision": "30dd40d9bf23912e4aefa93eeb4c7090bda3d0f6"
},
"d": {
"revision": "45e5f1e9d6de2c68591bc8e5ec662cf18e950b4a"
},

View file

@ -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",

10
queries/cylc/folds.scm Normal file
View file

@ -0,0 +1,10 @@
[
(multiline_string)
(multiline_graph_string)
(top_section)
(sub_section_1)
(sub_section_2)
(runtime_section)
(task_section)
(graph_section)
] @fold

View file

@ -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

16
queries/cylc/indents.scm Normal file
View file

@ -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

View file

@ -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"))