From c6d14302438d3b605e4ed8cd145586bad2458ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Fri, 26 May 2023 11:16:23 +0900 Subject: [PATCH] Drop old cairo grammar, alias to rust for now --- languages.toml | 7 +- runtime/queries/cairo/highlights.scm | 95 +-------------------------- runtime/queries/cairo/indents.scm | 1 + runtime/queries/cairo/injections.scm | 6 +- runtime/queries/cairo/locals.scm | 1 + runtime/queries/cairo/textobjects.scm | 1 + 6 files changed, 9 insertions(+), 102 deletions(-) create mode 100644 runtime/queries/cairo/indents.scm create mode 100644 runtime/queries/cairo/locals.scm create mode 100644 runtime/queries/cairo/textobjects.scm diff --git a/languages.toml b/languages.toml index d270c2ea5..915fd81fc 100644 --- a/languages.toml +++ b/languages.toml @@ -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" diff --git a/runtime/queries/cairo/highlights.scm b/runtime/queries/cairo/highlights.scm index c10ce5e07..ae55c7faf 100644 --- a/runtime/queries/cairo/highlights.scm +++ b/runtime/queries/cairo/highlights.scm @@ -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 diff --git a/runtime/queries/cairo/indents.scm b/runtime/queries/cairo/indents.scm new file mode 100644 index 000000000..ae55c7faf --- /dev/null +++ b/runtime/queries/cairo/indents.scm @@ -0,0 +1 @@ +; inherits: rust diff --git a/runtime/queries/cairo/injections.scm b/runtime/queries/cairo/injections.scm index e6f9be1ba..a2358b1ca 100644 --- a/runtime/queries/cairo/injections.scm +++ b/runtime/queries/cairo/injections.scm @@ -1,5 +1,3 @@ -((hint) @injection.content - (#set! injection.language "python")) - -((comment) @injection.content +([(line_comment) (block_comment)] @injection.content (#set! injection.language "comment")) + diff --git a/runtime/queries/cairo/locals.scm b/runtime/queries/cairo/locals.scm new file mode 100644 index 000000000..ae55c7faf --- /dev/null +++ b/runtime/queries/cairo/locals.scm @@ -0,0 +1 @@ +; inherits: rust diff --git a/runtime/queries/cairo/textobjects.scm b/runtime/queries/cairo/textobjects.scm new file mode 100644 index 000000000..ae55c7faf --- /dev/null +++ b/runtime/queries/cairo/textobjects.scm @@ -0,0 +1 @@ +; inherits: rust