From 63810ab197346a57f78161c2175593eab6df618c Mon Sep 17 00:00:00 2001 From: Cyrill Date: Fri, 15 Sep 2023 09:33:20 +0200 Subject: [PATCH] gas: Add grammar --- book/src/generated/lang-support.md | 1 + languages.toml | 15 ++++++++++++++- runtime/queries/gas/highlights.scm | 24 ++++++++++++++++++++++++ runtime/queries/gas/injections.scm | 2 ++ runtime/queries/gas/textobjects.scm | 2 ++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/gas/highlights.scm create mode 100644 runtime/queries/gas/injections.scm create mode 100644 runtime/queries/gas/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index c1b0acfdbd69b..9d036b73cd042 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -44,6 +44,7 @@ | forth | ✓ | | | `forth-lsp` | | fortran | ✓ | | ✓ | `fortls` | | fsharp | ✓ | | | `fsautocomplete` | +| gas | ✓ | ✓ | | | | gdscript | ✓ | ✓ | ✓ | | | gemini | ✓ | | | | | git-attributes | ✓ | | | | diff --git a/languages.toml b/languages.toml index 37d2e94cf6027..5bed84f21cce7 100644 --- a/languages.toml +++ b/languages.toml @@ -2495,7 +2495,7 @@ source = { git = "https://github.com/erasin/tree-sitter-po", rev = "417cee9abb20 [[language]] name = "nasm" scope = "source.nasm" -file-types = ["asm", "s", "S", "nasm"] +file-types = ["asm", "S", "nasm"] injection-regex = "n?asm" roots = [] comment-token = ";" @@ -2505,6 +2505,19 @@ indent = { tab-width = 8, unit = " " } name = "nasm" source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "a0db15db6fcfb1bf2cc8702500e55e558825c48b" } +[[language]] +name = "gas" +scope = "source.gas" +file-types = ["s"] +injection-regex = "gas" +roots = [] +comment-token = "#" +indent = { tab-width = 8, unit = " " } + +[[grammar]] +name = "gas" +source = { git = "https://github.com/sirius94/tree-sitter-gas.git", rev = "fdfa7e5864a89b1c933f08d41c935afcd792465b" } + [[language]] name = "rst" scope = "source.rst" diff --git a/runtime/queries/gas/highlights.scm b/runtime/queries/gas/highlights.scm new file mode 100644 index 0000000000000..8413cac1c7331 --- /dev/null +++ b/runtime/queries/gas/highlights.scm @@ -0,0 +1,24 @@ +(comment) @comment +(number) @constant.numeric +(directive_name) @keyword.directive +(symbol) @variable +(label) @function +(label) +(instruction_prefix) @keyword +(instruction_name) @function.special +(register) @constant.builtin +(string) @string +(char) @char +(type) @type +(constant "$" @constant) + +(expression + "-" @operator + "+" @operator + "*" @operator + "/" @operator + "=" @operator) + +[ "(" ")" ] @punctuation.bracket + +[ "," ":" ] @punctuation.delimiter diff --git a/runtime/queries/gas/injections.scm b/runtime/queries/gas/injections.scm new file mode 100644 index 0000000000000..2f0e58eb64315 --- /dev/null +++ b/runtime/queries/gas/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/gas/textobjects.scm b/runtime/queries/gas/textobjects.scm new file mode 100644 index 0000000000000..4465c87686a6b --- /dev/null +++ b/runtime/queries/gas/textobjects.scm @@ -0,0 +1,2 @@ +(comment) @comment.inside +(comment)+ @comment.around