on master help sign in
Change Odin grammar to `ap29600/tree-sitter-odin` (#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>

commit9cdc6b2e8a0193881297e15641cd801384cd8865 authorap29600 <66381278+ap29600@users.noreply.github.com> dateThu 27 Apr 2023, 16:32 (4 years ago) parent2836ea2
4 files changed+36−135
book/src/generated/lang-support.md+1−1 languages.toml+1−1 runtime/queries/odin/highlights.scm+18−133 runtime/queries/odin/indents.scm+16
book/src/generated/lang-support.md+1−1
@@ -98,7 +98,7 @@
9898| nu | ✓ | | | |
9999| ocaml | ✓ | | ✓ | `ocamllsp` |
100100| ocaml-interface | ✓ | | | `ocamllsp` |
101−| odin | ✓ | | | `ols` |
101+| odin | ✓ | | ✓ | `ols` |
102102| opencl | ✓ | ✓ | ✓ | `clangd` |
103103| openscad | ✓ | | | `openscad-lsp` |
104104| org | ✓ | | | |
languages.toml+1−1
@@ -1675,7 +1675,7 @@ indent = { tab-width = 4, unit = "\t" }
16751675
16761676[[grammar]]
16771677name = "odin"
1678−source = { git = "https://github.com/MineBill/tree-sitter-odin", rev = "da885f4a387f169b9b69fe0968259ee257a8f69a" }
1678+source = { git = "https://github.com/ap29600/tree-sitter-odin", rev = "b219207e49ffca2952529d33e94ed63b1b75c4f1" }
16791679
16801680[[language]]
16811681name = "meson"
runtime/queries/odin/highlights.scm+18−133
@@ -1,141 +1,26 @@
1−; Function calls
1+(keyword) @keyword
2+(operator) @operator
23
3−(call_expression
4− function: (identifier) @function)
5−
6−(call_expression
7− function: (selector_expression
8− field: (field_identifier) @function))
9−
10−
11−; ; Function definitions
12−
13−(function_declaration
14− name: (identifier) @function)
15−
16−(proc_group
17− (identifier) @function)
18−
19−; ; Identifiers
20−
21−(type_identifier) @type
22−(field_identifier) @variable.other.member
23−(identifier) @variable
24−
25−(const_declaration
26− (identifier) @constant)
27−(const_declaration_with_type
28− (identifier) @constant)
29−
30−"any" @type
31−
32−(directive_identifier) @constant
33−
34−; ; Operators
35−
36−[
37− "?"
38− "-"
39− "-="
40− ":="
41− "!"
42− "!="
43− "*"
44− "*"
45− "*="
46− "/"
47− "/="
48− "&"
49− "&&"
50− "&="
51− "%"
52− "%="
53− "^"
54− "+"
55− "+="
56− "<-"
57− "<"
58− "<<"
59− "<<="
60− "<="
61− "="
62− "=="
63− ">"
64− ">="
65− ">>"
66− ">>="
67− "|"
68− "|="
69− "||"
70− "~"
71− ".."
72− "..<"
73− "..="
74− "::"
75−] @operator
76−
77−; ; Keywords
78−
79−[
80− ; "asm"
81− "auto_cast"
82− ; "bit_set"
83− "cast"
84− ; "context"
85− ; "or_else"
86− ; "or_return"
87− "in"
88− ; "not_in"
89− "distinct"
90− "foreign"
91− "transmute"
92− ; "typeid"
93−
94− "break"
95− "case"
96− "continue"
97− "defer"
98− "else"
99− "using"
100− "when"
101− "where"
102− "fallthrough"
103− "for"
104− "proc"
105− "if"
106− "import"
107− "map"
108− "package"
109− "return"
110− "struct"
111− "union"
112− "enum"
113− "switch"
114− "dynamic"
115−] @keyword
116−
117−; ; Literals
4+(int_literal) @constant.numeric.integer
5+(float_literal) @constant.numeric.float
6+(rune_literal) @constant.character
7+(bool_literal) @constant.builtin.boolean
8+(nil) @constant.builtin
1189
119−[
120− (interpreted_string_literal)
121− (raw_string_literal)
122− (rune_literal)
123−] @string
10+(type_identifier) @type
11+(package_identifier) @namespace
12+(label_identifier) @label
12413
14+(interpreted_string_literal) @string
15+(raw_string_literal) @string
12516(escape_sequence) @constant.character.escape
12617
127−(int_literal) @constant.numeric.integer
128−(float_literal) @constant.numeric.float
129−(imaginary_literal) @constant.numeric
18+(comment) @comment
19+(const_identifier) @constant
13020
131−[
132− (true)
133− (false)
134−] @constant.builtin.boolean
13521
136−[
137− (nil)
138− (undefined)
139−] @constant.builtin
22+(compiler_directive) @keyword.directive
23+(calling_convention) @string.special.symbol
14024
141−(comment) @comment.line
25+(identifier) @variable
26+(pragma_identifier) @keyword.directive
runtime/queries/odin/indents.scmnew file+16
@@ -0,0 +1,16 @@
1+[
2+ (foreign_block)
3+ (block)
4+ (compound_literal)
5+ (proc_call)
6+ (assignment_statement)
7+ (const_declaration)
8+ (var_declaration)
9+ (switch_statement)
10+] @indent
11+
12+[
13+ ")"
14+ "}"
15+] @outdent
16+