forked from helix-editor/helix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Odin grammar to
ap29600/tree-sitter-odin
(helix-editor#6766)
* Change Odin grammar to `ap29600/tree-sitter-odin` The previously adopted grammar, `MineBill/tree-sitter-odin`, is unmaintained and mentions my repository as an alternative source. * update queries * docgen * fix queries * Update runtime/queries/odin/highlights.scm Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * remove `ERROR` query for `odin` * track the latest rev in `ap29600/tree-sitter-odin` * runtime/queries/odin/highlights.scm: update rune highlight class Co-authored-by: Michael Davis <mcarsondavis@gmail.com> --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
- Loading branch information
Showing
4 changed files
with
36 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,26 @@ | ||
; Function calls | ||
(keyword) @keyword | ||
(operator) @operator | ||
|
||
(call_expression | ||
function: (identifier) @function) | ||
|
||
(call_expression | ||
function: (selector_expression | ||
field: (field_identifier) @function)) | ||
|
||
|
||
; ; Function definitions | ||
|
||
(function_declaration | ||
name: (identifier) @function) | ||
|
||
(proc_group | ||
(identifier) @function) | ||
|
||
; ; Identifiers | ||
|
||
(type_identifier) @type | ||
(field_identifier) @variable.other.member | ||
(identifier) @variable | ||
|
||
(const_declaration | ||
(identifier) @constant) | ||
(const_declaration_with_type | ||
(identifier) @constant) | ||
|
||
"any" @type | ||
|
||
(directive_identifier) @constant | ||
|
||
; ; Operators | ||
|
||
[ | ||
"?" | ||
"-" | ||
"-=" | ||
":=" | ||
"!" | ||
"!=" | ||
"*" | ||
"*" | ||
"*=" | ||
"/" | ||
"/=" | ||
"&" | ||
"&&" | ||
"&=" | ||
"%" | ||
"%=" | ||
"^" | ||
"+" | ||
"+=" | ||
"<-" | ||
"<" | ||
"<<" | ||
"<<=" | ||
"<=" | ||
"=" | ||
"==" | ||
">" | ||
">=" | ||
">>" | ||
">>=" | ||
"|" | ||
"|=" | ||
"||" | ||
"~" | ||
".." | ||
"..<" | ||
"..=" | ||
"::" | ||
] @operator | ||
|
||
; ; Keywords | ||
|
||
[ | ||
; "asm" | ||
"auto_cast" | ||
; "bit_set" | ||
"cast" | ||
; "context" | ||
; "or_else" | ||
; "or_return" | ||
"in" | ||
; "not_in" | ||
"distinct" | ||
"foreign" | ||
"transmute" | ||
; "typeid" | ||
|
||
"break" | ||
"case" | ||
"continue" | ||
"defer" | ||
"else" | ||
"using" | ||
"when" | ||
"where" | ||
"fallthrough" | ||
"for" | ||
"proc" | ||
"if" | ||
"import" | ||
"map" | ||
"package" | ||
"return" | ||
"struct" | ||
"union" | ||
"enum" | ||
"switch" | ||
"dynamic" | ||
] @keyword | ||
|
||
; ; Literals | ||
(int_literal) @constant.numeric.integer | ||
(float_literal) @constant.numeric.float | ||
(rune_literal) @constant.character | ||
(bool_literal) @constant.builtin.boolean | ||
(nil) @constant.builtin | ||
|
||
[ | ||
(interpreted_string_literal) | ||
(raw_string_literal) | ||
(rune_literal) | ||
] @string | ||
(type_identifier) @type | ||
(package_identifier) @namespace | ||
(label_identifier) @label | ||
|
||
(interpreted_string_literal) @string | ||
(raw_string_literal) @string | ||
(escape_sequence) @constant.character.escape | ||
|
||
(int_literal) @constant.numeric.integer | ||
(float_literal) @constant.numeric.float | ||
(imaginary_literal) @constant.numeric | ||
(comment) @comment | ||
(const_identifier) @constant | ||
|
||
[ | ||
(true) | ||
(false) | ||
] @constant.builtin.boolean | ||
|
||
[ | ||
(nil) | ||
(undefined) | ||
] @constant.builtin | ||
(compiler_directive) @keyword.directive | ||
(calling_convention) @string.special.symbol | ||
|
||
(comment) @comment.line | ||
(identifier) @variable | ||
(pragma_identifier) @keyword.directive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[ | ||
(foreign_block) | ||
(block) | ||
(compound_literal) | ||
(proc_call) | ||
(assignment_statement) | ||
(const_declaration) | ||
(var_declaration) | ||
(switch_statement) | ||
] @indent | ||
|
||
[ | ||
")" | ||
"}" | ||
] @outdent | ||
|