diff options
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | queries/earthfile/highlights.scm | 129 | ||||
| -rw-r--r-- | queries/earthfile/injections.scm | 9 |
4 files changed, 149 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json index 34cb87b21..536f1a36e 100644 --- a/lockfile.json +++ b/lockfile.json @@ -131,6 +131,9 @@ "dtd": { "revision": "2282ad5cb8e815523e70d5c82404620bd9a1494c" }, + "earthfile": { + "revision": "2a6ab191f5f962562e495a818aa4e7f45f8a556a" + }, "ebnf": { "revision": "8e635b0b723c620774dfb8abf382a7f531894b40" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 255efe570..39c3b1875 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -443,6 +443,14 @@ list.dtd = { maintainers = { "@ObserverOfTime" }, } +list.earthfile = { + install_info = { + url = "https://github.com/glehmann/tree-sitter-earthfile", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@glehmann" }, +} + list.ebnf = { install_info = { url = "https://github.com/RubixDev/ebnf", diff --git a/queries/earthfile/highlights.scm b/queries/earthfile/highlights.scm new file mode 100644 index 000000000..cc7dce298 --- /dev/null +++ b/queries/earthfile/highlights.scm @@ -0,0 +1,129 @@ +(string_array + "," @punctuation.delimiter) + +(string_array + [ + "[" + "]" + ] @punctuation.bracket) + +[ + "ARG" + "AS LOCAL" + "BUILD" + "CACHE" + "CMD" + "COPY" + "DO" + "ENTRYPOINT" + "ENV" + "EXPOSE" + "FROM DOCKERFILE" + "FROM" + "FUNCTION" + "GIT CLONE" + "HOST" + "IMPORT" + "LABEL" + "LET" + "PROJECT" + "RUN" + "SAVE ARTIFACT" + "SAVE IMAGE" + "SET" + "USER" + "VERSION" + "VOLUME" + "WORKDIR" +] @keyword + +(for_command + [ + "FOR" + "IN" + "END" + ] @keyword.repeat) + +(if_command + [ + "IF" + "END" + ] @keyword.conditional) + +(elif_block + "ELSE IF" @keyword.conditional) + +(else_block + "ELSE" @keyword.conditional) + +(import_command + [ + "IMPORT" + "AS" + ] @keyword.import) + +(try_command + [ + "TRY" + "FINALLY" + "END" + ] @keyword.exception) + +(wait_command + [ + "WAIT" + "END" + ] @keyword) + +(with_docker_command + [ + "WITH DOCKER" + "END" + ] @keyword) + +[ + (comment) + (line_continuation_comment) +] @comment @spell + +[ + (target_ref) + (target_artifact) + (function_ref) +] @function + +(target + (identifier) @function) + +[ + (double_quoted_string) + (single_quoted_string) +] @string + +(unquoted_string) @string.special + +(escape_sequence) @string.escape + +(variable) @variable + +(expansion + [ + "$" + "{" + "}" + "(" + ")" + ] @punctuation.special) + +(build_arg + [ + "--" + (variable) + ] @variable.parameter) + +(options + (_) @property) + +"=" @operator + +(line_continuation) @operator diff --git a/queries/earthfile/injections.scm b/queries/earthfile/injections.scm new file mode 100644 index 000000000..7435a400e --- /dev/null +++ b/queries/earthfile/injections.scm @@ -0,0 +1,9 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((line_continuation_comment) @injection.content + (#set! injection.language "comment")) + +((shell_fragment) @injection.content + (#set! injection.language "bash") + (#set! injection.include-children)) |
