🐐 Various fixes
This commit is contained in:
13
README.md
13
README.md
@@ -67,13 +67,13 @@ Strings are written as text in quotes (`'` or `"`).
|
|||||||
DESIGNA x VT "this is a string"
|
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
|
||||||
Integers must be written in roman numerals using the following symbols:
|
Integers must be written in roman numerals using the following symbols:
|
||||||
@@ -165,12 +165,13 @@ SI x TVNC {
|
|||||||
|
|
||||||
```
|
```
|
||||||
DESIGNA x VT II
|
DESIGNA x VT II
|
||||||
SI x EST I TVNC
|
SI x EST I TVNC {
|
||||||
DICE(I)
|
DICE(I)
|
||||||
ALVID SI x EST II TVNC
|
} ALVID SI x EST II TVNC {
|
||||||
DICE(II)
|
DICE(II)
|
||||||
ALVID
|
} ALVID {
|
||||||
DICE(III)
|
DICE(III)
|
||||||
|
}
|
||||||
|
|
||||||
> II
|
> II
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -259,9 +259,11 @@ class DataRangeArray(Node):
|
|||||||
def _eval(self, vtable):
|
def _eval(self, vtable):
|
||||||
vtable, from_val = self.from_value.eval(vtable)
|
vtable, from_val = self.from_value.eval(vtable)
|
||||||
vtable, to_val = self.to_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")
|
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):
|
class String(Node):
|
||||||
@@ -894,4 +896,6 @@ class Program(BaseBox):
|
|||||||
last_val = ValNul()
|
last_val = ValNul()
|
||||||
for statement in self.statements:
|
for statement in self.statements:
|
||||||
vtable, last_val = statement.eval(vtable)
|
vtable, last_val = statement.eval(vtable)
|
||||||
|
if vtable["#return"] is not None:
|
||||||
|
return vtable["#return"]
|
||||||
return last_val
|
return last_val
|
||||||
|
|||||||
Reference in New Issue
Block a user