Skip to content

Commit

Permalink
Drop old cairo grammar, alias to rust for now
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed May 26, 2023
1 parent 207829e commit c6d1430
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 102 deletions.
7 changes: 3 additions & 4 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1700,10 +1700,9 @@ file-types = ["cairo"]
roots = []
comment-token = "//"
indent = { tab-width = 4, unit = " " }

[[grammar]]
name = "cairo"
source = { git = "https://github.com/archseer/tree-sitter-cairo", rev = "b249662a1eefeb4d71c9529cdd971e74fecc10fe" }
# auto-format = true
language-server = { command = "cairo-language-server", args = [] }
grammar = "rust"

[[language]]
name = "cpon"
Expand Down
95 changes: 1 addition & 94 deletions runtime/queries/cairo/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,94 +1 @@
(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"
"assert"
"with"
"with_attr"
] @keyword.control

[
"from"
"import"
"func"
"namespace"
] @keyword ; keyword.declaration

[
"let"
"const"
"local"
"struct"
"alloc_locals"
"tempvar"
] @keyword

(decorator) @attribute

[
"="
"+"
"-"
"*"
"/"
; "%"
; "!"
; ">"
; "<"
; "\\"
; "&"
; "?"
; "^"
; "~"
"=="
"!="
"new"
] @operator

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

[
","
":"
] @punctuation.delimiter
; inherits: rust
1 change: 1 addition & 0 deletions runtime/queries/cairo/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: rust
6 changes: 2 additions & 4 deletions runtime/queries/cairo/injections.scm
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
((hint) @injection.content
(#set! injection.language "python"))

((comment) @injection.content
([(line_comment) (block_comment)] @injection.content
(#set! injection.language "comment"))

1 change: 1 addition & 0 deletions runtime/queries/cairo/locals.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: rust
1 change: 1 addition & 0 deletions runtime/queries/cairo/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: rust

0 comments on commit c6d1430

Please sign in to comment.