Skip to content

Commit 2e7ab99

Browse files
committed
Add Odin submodule and syntax test file
1 parent 5c43ddb commit 2e7ab99

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,6 @@
266266
[submodule "assets/syntaxes/02_Extra/Idris2"]
267267
path = assets/syntaxes/02_Extra/Idris2
268268
url = https://github.com/buzden/sublime-syntax-idris2
269+
[submodule "assets/syntaxes/02_Extra/sublime-odin"]
270+
path = assets/syntaxes/02_Extra/sublime-odin
271+
url = https://github.com/odin-lang/sublime-odin

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- Map `ndjson` extension to JSON syntax, see #3209 (@keith-hall)
2323
- Map files with `csproj`, `vbproj`, `props` and `targets` extensions to XML syntax, see #3213 (@keith-hall)
2424
- Add debsources syntax to highlight `/etc/apt/sources.list` files, see #3215 (@keith-hall)
25+
- Add syntax test file for GDScript highlighting, see #XYZ (@chetanjangir0)
2526

2627
## Themes
2728

assets/syntaxes/02_Extra/sublime-odin

Submodule sublime-odin added at 5d6a0ed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package main
2+
3+
import "core:fmt"
4+
import "core:math"
5+
6+
Vector :: struct {
7+
 components: []f64,
8+
}
9+
10+
euclidean_distance :: proc(v1: Vector, v2: Vector) -> f64 {
11+
 if len(v1.components) != len(v2.components) {
12+
 panic("Vectors must be same dimension")
13+
 }
14+
 sum: f64 = 0.0;
15+
 for i, comp in v1.components {
16+
 diff := comp - v2.components[i];
17+
 sum += diff * diff;
18+
 }
19+
 return math.sqrt(sum);
20+
}
21+
22+
main :: proc() {
23+
 v1: Vector = Vector{components = []f64{1.0, 2.0, 3.0}};
24+
 v2: Vector = Vector{components = []f64{4.0, 6.0, 8.0}};
25+
 dist: f64 = euclidean_distance(v1, v2);
26+
 fmt.println("Distance:", dist);
27+
}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package main
2+
3+
import "core:fmt"
4+
import "core:math"
5+
6+
Vector :: struct {
7+
components: []f64,
8+
}
9+
10+
euclidean_distance :: proc(v1: Vector, v2: Vector) -> f64 {
11+
if len(v1.components) != len(v2.components) {
12+
panic("Vectors must be same dimension")
13+
}
14+
sum: f64 = 0.0;
15+
for i, comp in v1.components {
16+
diff := comp - v2.components[i];
17+
sum += diff * diff;
18+
}
19+
return math.sqrt(sum);
20+
}
21+
22+
main :: proc() {
23+
v1: Vector = Vector{components = []f64{1.0, 2.0, 3.0}};
24+
v2: Vector = Vector{components = []f64{4.0, 6.0, 8.0}};
25+
dist: f64 = euclidean_distance(v1, v2);
26+
fmt.println("Distance:", dist);
27+
}

0 commit comments

Comments
 (0)