aboutsummaryrefslogtreecommitdiffstats
path: root/queries/ralph
diff options
context:
space:
mode:
authorArstoien <2979182+tdroxler@users.noreply.github.com>2024-06-04 09:49:26 +0200
committerGitHub <noreply@github.com>2024-06-04 09:49:26 +0200
commit512e2122e0c4332006c8ba9806ef1d4d5e878e25 (patch)
tree5db28af4735871f36e8a1d588eb6095763c79ff2 /queries/ralph
parentbot(lockfile): update arduino, earthfile, koto, rego, slint, sql, teal, typespec (diff)
downloadnvim-treesitter-512e2122e0c4332006c8ba9806ef1d4d5e878e25.tar
nvim-treesitter-512e2122e0c4332006c8ba9806ef1d4d5e878e25.tar.gz
nvim-treesitter-512e2122e0c4332006c8ba9806ef1d4d5e878e25.tar.bz2
nvim-treesitter-512e2122e0c4332006c8ba9806ef1d4d5e878e25.tar.lz
nvim-treesitter-512e2122e0c4332006c8ba9806ef1d4d5e878e25.tar.xz
nvim-treesitter-512e2122e0c4332006c8ba9806ef1d4d5e878e25.tar.zst
nvim-treesitter-512e2122e0c4332006c8ba9806ef1d4d5e878e25.zip
feat: add `ralph` (#6675)
https://github.com/alephium/tree-sitter-ralph
Diffstat (limited to 'queries/ralph')
-rw-r--r--queries/ralph/highlights.scm137
-rw-r--r--queries/ralph/injections.scm2
2 files changed, 139 insertions, 0 deletions
diff --git a/queries/ralph/highlights.scm b/queries/ralph/highlights.scm
new file mode 100644
index 000000000..e56ffa5a2
--- /dev/null
+++ b/queries/ralph/highlights.scm
@@ -0,0 +1,137 @@
+(type_identifier) @type
+
+(identifier) @variable
+
+[
+ (primitive_type)
+ (alph_token_id)
+] @type.builtin
+
+(var_declaration) @variable
+
+(struct_field
+ (identifier) @variable.member)
+
+(arg_def
+ (identifier) @variable.parameter)
+
+(event_field
+ (identifier) @variable.parameter)
+
+(struct_constructor_field
+ (identifier) @variable.parameter)
+
+[
+ (hex_num)
+ (integer)
+ (typed_num)
+] @number
+
+[
+ (bool)
+ (bytes)
+ (address)
+] @constant.builtin
+
+(func_id
+ [
+ (identifier)
+ "!"
+ ] @function)
+
+(annotation
+ [
+ "@"
+ (identifier)
+ ] @attribute)
+
+(map_def
+ (identifier) @variable.parameter)
+
+"fn" @keyword.function
+
+[
+ "Contract"
+ "TxScript"
+ "Interface"
+ "AssetScript"
+ "struct"
+ "enum"
+ "event"
+ "mapping"
+] @keyword.type
+
+[
+ "pub"
+ "Abstract"
+ (mutable)
+] @keyword.modifier
+
+[
+ "while"
+ "for"
+] @keyword.repeat
+
+"return" @keyword.return
+
+[
+ "if"
+ "else"
+] @keyword.conditional
+
+[
+ "const"
+ "let"
+ "emit"
+ "extends"
+ "embeds"
+ "implements"
+] @keyword
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "."
+ ","
+ ":"
+ ";"
+] @punctuation.delimiter
+
+[
+ "="
+ "->"
+ (op_byte_vec_add)
+ (op_add)
+ (op_sub)
+ (op_mul)
+ (op_exp)
+ (op_mod_exp)
+ (op_div)
+ (op_mod)
+ (op_mod_add)
+ (op_mod_sub)
+ (op_mod_mul)
+ (op_shl)
+ (op_shr)
+ (op_bit_and)
+ (op_xor)
+ (op_bit_or)
+ (op_eq)
+ (op_ne)
+ (op_lt)
+ (op_le)
+ (op_gt)
+ (op_ge)
+ (op_and)
+ (op_or)
+ (op_not)
+] @operator
+
+(line_comment) @comment @spell
diff --git a/queries/ralph/injections.scm b/queries/ralph/injections.scm
new file mode 100644
index 000000000..36849c873
--- /dev/null
+++ b/queries/ralph/injections.scm
@@ -0,0 +1,2 @@
+((line_comment) @injection.content
+ (#set! injection.language "comment"))