summaryrefslogtreecommitdiff
path: root/ident.ha
diff options
context:
space:
mode:
authorLassi Pulkkinen <lassi@pulk.fi>2024-10-31 03:11:21 +0200
committerLassi Pulkkinen <lassi@pulk.fi>2024-10-31 03:51:35 +0200
commitae44478b30d890fe0fb04022f44d474dcdcc3f9d (patch)
tree5f462459ae4b47d22114eed717d1382d08cf4dfe /ident.ha
Initial commit (import old repo)HEADmain
Diffstat (limited to 'ident.ha')
-rw-r--r--ident.ha19
1 files changed, 19 insertions, 0 deletions
diff --git a/ident.ha b/ident.ha
new file mode 100644
index 0000000..446fbad
--- /dev/null
+++ b/ident.ha
@@ -0,0 +1,19 @@
+use strings;
+
+def DEFAULT_NS = "minecraft";
+
+fn ident_split(ident: str) (str, str) = {
+ assert(strings::contains(ident, ":"));
+ return strings::cut(ident, ":");
+};
+
+fn ident_make(ns: str, name: str) str =
+ strings::concat(ns, ":", name);
+
+fn ident_qual(ident: str) str = {
+ if (strings::contains(ident, ":")) {
+ return strings::dup(ident);
+ } else {
+ return ident_make(DEFAULT_NS, ident);
+ };
+};