aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-05-01 02:24:17 +0000
committerBlaž Hrastnik2022-05-01 02:24:17 +0000
commit73879052c14a84de6efe6991881c53d542b7a8e6 (patch)
tree53b6fc36e18eac18901dc86a86157bc13e6f25e6 /runtime
parent2c60798b00cc9b8efc9fdbec304a7ea04d11de4c (diff)
Add Cairo support
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/cairo/highlights.scm96
-rw-r--r--runtime/queries/cairo/injections.scm5
2 files changed, 101 insertions, 0 deletions
diff --git a/runtime/queries/cairo/highlights.scm b/runtime/queries/cairo/highlights.scm
new file mode 100644
index 00000000..3a30d188
--- /dev/null
+++ b/runtime/queries/cairo/highlights.scm
@@ -0,0 +1,96 @@
+(ERROR) @error
+
+((identifier) @constant
+ (#match? @constant "^[A-Z][A-Z\\d_]+$"))
+((identifier_def) @constant
+ (#match? @constant "^[A-Z][A-Z\\d_]+$"))
+
+((identifier) @namespace
+ (#match? @namespace "^[A-Z]"))
+((identifier_def) @namespace
+ (#match? @namespace "^[A-Z]"))
+
+(identifier "." @punctuation)
+(function_call (identifier) @function)
+(func (identifier_def) @function)
+
+(string) @string
+(atom_short_string) @string
+
+(code_element_directive) @keyword.directive
+"return" @keyword
+
+(number) @constant.numeric
+(atom_hex_number) @constant.numeric
+
+(comment) @comment
+
+"*" @special
+(type) @type
+
+[
+ "felt"
+ ; "codeoffset"
+] @type.builtin
+
+[
+ "if"
+ "else"
+ "end"
+ "assert"
+ "with"
+ "with_attr"
+] @keyword.control
+
+[
+ "from"
+ "import"
+ "func"
+ "namespace"
+] @keyword ; keyword.declaration
+
+[
+ "let"
+ "const"
+ "local"
+ "struct"
+ "member"
+ "alloc_locals"
+ "tempvar"
+] @keyword
+
+(decorator) @attribute
+
+[
+ "="
+ "+"
+ "-"
+ "*"
+ "/"
+ ; "%"
+ ; "!"
+ ; ">"
+ ; "<"
+ ; "\\"
+ ; "&"
+ ; "?"
+ ; "^"
+ ; "~"
+ "=="
+ "!="
+ "new"
+] @operator
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ ","
+ ":"
+] @punctuation.delimiter
diff --git a/runtime/queries/cairo/injections.scm b/runtime/queries/cairo/injections.scm
new file mode 100644
index 00000000..e6f9be1b
--- /dev/null
+++ b/runtime/queries/cairo/injections.scm
@@ -0,0 +1,5 @@
+((hint) @injection.content
+ (#set! injection.language "python"))
+
+((comment) @injection.content
+ (#set! injection.language "comment"))