Add support for Odin

This commit is contained in:
hcssmith 2023-08-19 23:49:10 +01:00 committed by Lewis Russell
parent 5dd8c21211
commit 14856c9ee6
3 changed files with 86 additions and 0 deletions

View file

@ -47,6 +47,7 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
- [x] `norg`
- [x] `ocaml_interface`
- [x] `ocaml`
- [x] `odin`
- [x] `php`
- [x] `prisma`
- [x] `python`

8
queries/odin/context.scm Normal file
View file

@ -0,0 +1,8 @@
([
(struct_declaration)
(if_statement)
(for_statement)
(procedure_declaration)
(switch_statement)
(switch_case)
] @context)

77
test/test.odin Normal file
View file

@ -0,0 +1,77 @@
package main
import "core:fmt"
demo_struct :: struct($T: typeid) {
name: string,
payload: T,
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
}
main :: proc() {
a := 1
if a > 0 {
a = do_stuff(a)
}
//comment
//comment
//comment
//comment
//comment
//comment
//comment
//commen
for x:=0; x<100; x+=1 {
//comment
//comment
//comment
//comment
//comment
//comment
//comment
//comment
fmt.printf("{0}\n", x)
}
//comment
fmt.printf("{0}\n", a)
}
do_stuff :: proc(x: int) -> int {
switch x {
case 1:
return 42
case 0:
return 420
}
return 0
}