on master help sign in
Add llvm grammar (#1167)
commit6f1a7b1220c2ae565a2542fb089eb6d87f0a9421 authorKirawi <67773714+kirawi@users.noreply.github.com> dateSun 28 Nov 2021, 20:38 (5 years ago) parentdc53e65
4 files changed+29−2
.gitmodules+4 book/src/themes.md+3−2 languages.toml+8 runtime/queries/llvm/highlights.scm+14
.gitmodules+4
@@ -146,3 +146,7 @@
146146 path = helix-syntax/languages/tree-sitter-wgsl
147147 url = https://github.com/szebniok/tree-sitter-wgsl
148148 shallow = true
149+[submodule "helix-syntax/tree-sitter-llvm"]
150+ path = helix-syntax/languages/tree-sitter-llvm
151+ url = https://github.com/benwilliamgraham/tree-sitter-llvm
152+ shallow = true
book/src/themes.md+3−2
@@ -145,11 +145,12 @@ We use a similar set of scopes as
145145 - `conditional` - `if`, `else`
146146 - `repeat` - `for`, `while`, `loop`
147147 - `import` - `import`, `export`
148− - (TODO: return?)
148+ - `return`
149+ - `operator` - `or`, `in`
149150 - `directive` - Preprocessor directives (`#if` in C)
150151 - `function` - `fn`, `func`
151152
152−- `operator` - `||`, `+=`, `>`, `or`
153+- `operator` - `||`, `+=`, `>`
153154
154155- `function`
155156 - `builtin`
languages.toml+8
@@ -413,3 +413,11 @@ file-types = ["wgsl"]
413413roots = []
414414comment-token = "//"
415415indent = { tab-width = 4, unit = " " }
416+
417+[[language]]
418+name = "llvm"
419+scope = "source.llvm"
420+roots = []
421+file-types = ["ll"]
422+comment-token = ";"
423+indent = { tab-width = 2, unit = " " }
runtime/queries/llvm/highlights.scmnew file+14
@@ -0,0 +1,14 @@
1+(type) @type
2+(statement) @keyword.operator
3+(number) @constant.numeric.integer
4+(comment) @comment
5+(string) @string
6+(label) @label
7+(keyword) @keyword
8+"ret" @keyword.control.return
9+(boolean) @constant.builtin.boolean
10+(float) @constant.numeric.float
11+(constant) @constant
12+(identifier) @variable
13+(symbol) @punctuation.delimiter
14+(bracket) @punctuation.bracket