Skip to content

Commit

Permalink
Add llvm grammar (helix-editor#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirawi authored Nov 29, 2021
1 parent dc53e65 commit 6f1a7b1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,7 @@
path = helix-syntax/languages/tree-sitter-wgsl
url = https://github.com/szebniok/tree-sitter-wgsl
shallow = true
[submodule "helix-syntax/tree-sitter-llvm"]
path = helix-syntax/languages/tree-sitter-llvm
url = https://github.com/benwilliamgraham/tree-sitter-llvm
shallow = true
5 changes: 3 additions & 2 deletions book/src/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,12 @@ We use a similar set of scopes as
- `conditional` - `if`, `else`
- `repeat` - `for`, `while`, `loop`
- `import` - `import`, `export`
- (TODO: return?)
- `return`
- `operator` - `or`, `in`
- `directive` - Preprocessor directives (`#if` in C)
- `function` - `fn`, `func`

- `operator` - `||`, `+=`, `>`, `or`
- `operator` - `||`, `+=`, `>`

- `function`
- `builtin`
Expand Down
8 changes: 8 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,11 @@ file-types = ["wgsl"]
roots = []
comment-token = "//"
indent = { tab-width = 4, unit = " " }

[[language]]
name = "llvm"
scope = "source.llvm"
roots = []
file-types = ["ll"]
comment-token = ";"
indent = { tab-width = 2, unit = " " }
14 changes: 14 additions & 0 deletions runtime/queries/llvm/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(type) @type
(statement) @keyword.operator
(number) @constant.numeric.integer
(comment) @comment
(string) @string
(label) @label
(keyword) @keyword
"ret" @keyword.control.return
(boolean) @constant.builtin.boolean
(float) @constant.numeric.float
(constant) @constant
(identifier) @variable
(symbol) @punctuation.delimiter
(bracket) @punctuation.bracket

0 comments on commit 6f1a7b1

Please sign in to comment.