From f76a1fcfd4560667ebb3fb2a32ea0c213c222060 Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Wed, 1 Apr 2026 14:50:58 +0200 Subject: [PATCH] :goat: Various fixes --- README.md | 13 +++++++------ centvrion/ast_nodes.py | 8 ++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 59fd098..4becda6 100644 --- a/README.md +++ b/README.md @@ -67,13 +67,13 @@ Strings are written as text in quotes (`'` or `"`). DESIGNA x VT "this is a string" ``` -Strings are concatenated with `:`: +Strings are concatenated with `&`: ``` -DESIGNA greeting VT "Hello, " : "world!" +DESIGNA greeting VT "Hello, " & "world!" ``` -`NVLLVS` coerces to an empty string when used with `:`. Note: `+` is for arithmetic only — using it on strings raises an error. +`NVLLVS` coerces to an empty string when used with `&`. Note: `+` is for arithmetic only — using it on strings raises an error. ### Integers Integers must be written in roman numerals using the following symbols: @@ -165,12 +165,13 @@ SI x TVNC { ``` DESIGNA x VT II -SI x EST I TVNC +SI x EST I TVNC { DICE(I) -ALVID SI x EST II TVNC +} ALVID SI x EST II TVNC { DICE(II) -ALVID +} ALVID { DICE(III) +} > II ``` diff --git a/centvrion/ast_nodes.py b/centvrion/ast_nodes.py index 96b9c09..c12ba7e 100644 --- a/centvrion/ast_nodes.py +++ b/centvrion/ast_nodes.py @@ -259,9 +259,11 @@ class DataRangeArray(Node): def _eval(self, vtable): vtable, from_val = self.from_value.eval(vtable) vtable, to_val = self.to_value.eval(vtable) - if not isinstance(from_val, ValInt) or not isinstance(to_val, ValInt): + if not isinstance(from_val, (ValInt, ValNul)) or not isinstance(to_val, (ValInt, ValNul)): raise CentvrionError("Range bounds must be numbers") - return vtable, ValList([ValInt(i) for i in range(from_val.value(), to_val.value())]) + from_int = from_val.value() or 0 + to_int = to_val.value() or 0 + return vtable, ValList([ValInt(i) for i in range(from_int, to_int)]) class String(Node): @@ -894,4 +896,6 @@ class Program(BaseBox): last_val = ValNul() for statement in self.statements: vtable, last_val = statement.eval(vtable) + if vtable["#return"] is not None: + return vtable["#return"] return last_val