From 9941f16f11d35de92558e354944791197c293ac5 Mon Sep 17 00:00:00 2001 From: Glenn Jackman Date: Fri, 5 Dec 2025 10:03:13 -0500 Subject: [PATCH] Add Odin language --- lib/languages/odin.txt | 5 +++++ tests/odin/sample/code.odin | 17 +++++++++++++++++ tests/odin/sample/expected_snippet.odin | 5 +++++ 3 files changed, 27 insertions(+) create mode 100644 lib/languages/odin.txt create mode 100644 tests/odin/sample/code.odin create mode 100644 tests/odin/sample/expected_snippet.odin diff --git a/lib/languages/odin.txt b/lib/languages/odin.txt new file mode 100644 index 0000000..4671b1b --- /dev/null +++ b/lib/languages/odin.txt @@ -0,0 +1,5 @@ +!e +//\p +import +package +/*\pj-->>*/\pj \ No newline at end of file diff --git a/tests/odin/sample/code.odin b/tests/odin/sample/code.odin new file mode 100644 index 0000000..5a641f4 --- /dev/null +++ b/tests/odin/sample/code.odin @@ -0,0 +1,17 @@ +// Package gigasecond constains functionality to add a gigasecond +// to a period of time +package gigasecond + +import "core:time/datetime" + +/*Giga seconds +are 10^3 bigger than Mega seconds +*/ +Gigasecond := datetime.Delta{seconds = 1e9} + +// add_gigasecond adds a Gigasecond to the given time +add_gigasecond :: proc(time: datetime.DateTime) -> datetime.DateTime { //Even more comments + /* We'll ignore any errors + */ + return datetime.add_delta_to_date(time, Gigasecond) +} diff --git a/tests/odin/sample/expected_snippet.odin b/tests/odin/sample/expected_snippet.odin new file mode 100644 index 0000000..3a506da --- /dev/null +++ b/tests/odin/sample/expected_snippet.odin @@ -0,0 +1,5 @@ +Gigasecond := datetime.Delta{seconds = 1e9} + +add_gigasecond :: proc(time: datetime.DateTime) -> datetime.DateTime { + return datetime.add_delta_to_date(time, Gigasecond) +}