on master help sign in
Add Cairo support
7387905Blaž Hrastnik
languages.toml+13
@@ -1276,3 +1276,16 @@ indent = { tab-width = 4, unit = "\t" }
1276[[grammar]]
1276[[grammar]]
1277name = "devicetree"
1277name = "devicetree"
1278source = { git = "https://github.com/joelspadin/tree-sitter-devicetree", rev = "877adbfa0174d25894c40fa75ad52d4515a36368" }
1278source = { git = "https://github.com/joelspadin/tree-sitter-devicetree", rev = "877adbfa0174d25894c40fa75ad52d4515a36368" }
1279+
1280+[[language]]
1281+name = "cairo"
1282+scope = "source.cairo"
1283+injection-regex = "cairo"
1284+file-types = ["cairo"]
1285+roots = []
1286+comment-token = "#"
1287+indent = { tab-width = 4, unit = " " }
1288+
1289+[[grammar]]
1290+name = "cairo"
1291+source = { git = "https://github.com/archseer/tree-sitter-cairo", rev = "5155c6eb40db6d437f4fa41b8bcd8890a1c91716" }
runtime/queries/cairo/highlights.scmnew file+96
@@ -0,0 +1,96 @@
1+(ERROR) @error
2+
3+((identifier) @constant
4+ (#match? @constant "^[A-Z][A-Z\\d_]+$"))
5+((identifier_def) @constant
6+ (#match? @constant "^[A-Z][A-Z\\d_]+$"))
7+
8+((identifier) @namespace
9+ (#match? @namespace "^[A-Z]"))
10+((identifier_def) @namespace
11+ (#match? @namespace "^[A-Z]"))
12+
13+(identifier "." @punctuation)
14+(function_call (identifier) @function)
15+(func (identifier_def) @function)
16+
17+(string) @string
18+(atom_short_string) @string
19+
20+(code_element_directive) @keyword.directive
21+"return" @keyword
22+
23+(number) @constant.numeric
24+(atom_hex_number) @constant.numeric
25+
26+(comment) @comment
27+
28+"*" @special
29+(type) @type
30+
31+[
32+ "felt"
33+ ; "codeoffset"
34+] @type.builtin
35+
36+[
37+ "if"
38+ "else"
39+ "end"
40+ "assert"
41+ "with"
42+ "with_attr"
43+] @keyword.control
44+
45+[
46+ "from"
47+ "import"
48+ "func"
49+ "namespace"
50+] @keyword ; keyword.declaration
51+
52+[
53+ "let"
54+ "const"
55+ "local"
56+ "struct"
57+ "member"
58+ "alloc_locals"
59+ "tempvar"
60+] @keyword
61+
62+(decorator) @attribute
63+
64+[
65+ "="
66+ "+"
67+ "-"
68+ "*"
69+ "/"
70+ ; "%"
71+ ; "!"
72+ ; ">"
73+ ; "<"
74+ ; "\\"
75+ ; "&"
76+ ; "?"
77+ ; "^"
78+ ; "~"
79+ "=="
80+ "!="
81+ "new"
82+] @operator
83+
84+[
85+ "("
86+ ")"
87+ "["
88+ "]"
89+ "{"
90+ "}"
91+] @punctuation.bracket
92+
93+[
94+ ","
95+ ":"
96+] @punctuation.delimiter
runtime/queries/cairo/injections.scmnew file+5
@@ -0,0 +1,5 @@
1+((hint) @injection.content
2+ (#set! injection.language "python"))
3+
4+((comment) @injection.content
5+ (#set! injection.language "comment"))