From f305c7299d8471957eaa66bb83a4c9a70cfc57a9 Mon Sep 17 00:00:00 2001 From: Lens0021 / Leslie Date: Fri, 22 Nov 2024 01:09:42 +0900 Subject: [PATCH] Add support for Amber-lang (#12021) Co-authored-by: Phoenix Himself Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 1 + languages.toml | 11 +++++ runtime/queries/amber/highlights.scm | 60 ++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 runtime/queries/amber/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 28f25ba3f..d85cebf06 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -3,6 +3,7 @@ | ada | ✓ | ✓ | | `ada_language_server` | | adl | ✓ | ✓ | ✓ | | | agda | ✓ | | | | +| amber | ✓ | | | | | astro | ✓ | | | | | awk | ✓ | ✓ | | `awk-language-server` | | bash | ✓ | ✓ | ✓ | `bash-language-server` | diff --git a/languages.toml b/languages.toml index ea6e6893f..54283ea8d 100644 --- a/languages.toml +++ b/languages.toml @@ -3931,3 +3931,14 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "spade" source = { git = "https://gitlab.com/spade-lang/tree-sitter-spade/", rev = "4d5b141017c61fe7e168e0a5c5721ee62b0d9572" } + +[[language]] +name = "amber" +scope = "source.ab" +file-types = ["ab"] +comment-token = "//" +indent = { tab-width = 4, unit = " " } + +[[grammar]] +name = "amber" +source = { git = "https://github.com/amber-lang/tree-sitter-amber", rev = "c6df3ec2ec243ed76550c525e7ac3d9a10c6c814" } diff --git a/runtime/queries/amber/highlights.scm b/runtime/queries/amber/highlights.scm new file mode 100644 index 000000000..39f965b58 --- /dev/null +++ b/runtime/queries/amber/highlights.scm @@ -0,0 +1,60 @@ +(comment) @comment + +[ + "if" + "loop" + "for" + "return" + "fun" + "else" + "then" + "break" + "continue" + "and" + "or" + "not" + "let" + "pub" + "main" + "echo" + "exit" + "fun" + "import" + "from" + "as" + "in" + "fail" + "failed" + "silent" + "nameof" + "is" + "unsafe" + "trust" +] @keyword + +; Literals +(boolean) @constant.builtin.boolean +(number) @constant.numeric +(null) @constant.numeric +(string) @string +(status) @keyword +(command) @string +(handler) @keyword +(block) @punctuation.delimiter +(variable_init) @keyword +(variable_assignment) @punctuation.delimiter +(variable) @variable +(escape_sequence) @constant.character.escape +(type_name_symbol) @type +(interpolation) @punctuation.delimiter +(reference) @keyword +(preprocessor_directive) @comment +(shebang) @comment +(function_definition + name: (variable) @function.method) +(function_call + name: (variable) @function.method) +(import_statement + "pub" @keyword + "import" @keyword + "from" @keyword)