Skip to content

Commit

Permalink
feat: Add LLVM support
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Dec 6, 2023
1 parent 542f4cc commit 4cd6bea
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -534,3 +534,9 @@
update = none
ignore = dirty
branch = main
[submodule "repos/llvm"]
path = repos/llvm
url = https://github.com/benwilliamgraham/tree-sitter-llvm
update = none
ignore = dirty
branch = main
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Add `LLVM` support

## 0.12.82 - 2023-12-03

Expand Down
156 changes: 156 additions & 0 deletions queries/llvm/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
(type) @type
(type_keyword) @type.builtin

(type [
(local_var)
(global_var)
] @type)

(argument) @variable.parameter

(_ inst_name: _ @keyword)

[
"catch"
"filter"
] @keyword

[
"to"
"nuw"
"nsw"
"exact"
"unwind"
"from"
"cleanup"
"swifterror"
"volatile"
"inbounds"
"inrange"
] @keyword
(icmp_cond) @keyword
(fcmp_cond) @keyword

(fast_math) @keyword

(_ callee: _ @function)
(function_header name: _ @function)

[
"declare"
"define"
] @keyword.function
(calling_conv) @keyword

[
"target"
"triple"
"datalayout"
"source_filename"
"addrspace"
"blockaddress"
"align"
"syncscope"
"within"
"uselistorder"
"uselistorder_bb"
"module"
"asm"
"sideeffect"
"alignstack"
"inteldialect"
"unwind"
"type"
"global"
"constant"
"externally_initialized"
"alias"
"ifunc"
"section"
"comdat"
"thread_local"
"localdynamic"
"initialexec"
"localexec"
"any"
"exactmatch"
"largest"
"nodeduplicate"
"samesize"
"distinct"
"attributes"
"vscale"
"no_cfi"
] @keyword

(linkage_aux) @keyword
(dso_local) @keyword
(visibility) @keyword
(dll_storage_class) @keyword
(unnamed_addr) @keyword
(attribute_name) @keyword

(function_header [
(linkage)
(calling_conv)
(unnamed_addr)
] @keyword)

(number) @cnumber
(comment) @comment
(string) @string
(cstring) @string
(label) @label
(_ inst_name: "ret" @keyword)
(float) @number

[
(local_var)
(global_var)
] @variable

[
(struct_value)
(array_value)
(vector_value)
] @constructor

[
"("
")"
"["
"]"
"{"
"}"
"<"
">"
"<{"
"}>"
] @punctuation.bracket

[
","
":"
] @punctuation.delimiter

[
"="
"|"
"x"
"..."
] @operator

[
"true"
"false"
] @constant.builtin

[
"undef"
"poison"
"null"
"none"
"zeroinitializer"
] @constant.builtin

(ERROR) @error
1 change: 1 addition & 0 deletions repos/llvm
Submodule llvm added at 1b96e5
1 change: 1 addition & 0 deletions tree-sitter-langs.el
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ See `tree-sitter-langs-repos'."
(julia-mode . julia)
(kotlin-mode . kotlin)
(latex-mode . latex)
(llvm-mode . llvm)
(lua-mode . lua)
(makefile-mode . make)
(makefile-automake-mode . make)
Expand Down

0 comments on commit 4cd6bea

Please sign in to comment.