-
Notifications
You must be signed in to change notification settings - Fork 0
Zr v1.0.0 Refactor #14
Comments
Looking at implementing also:
|
Array Syntax: [ item, item2, ... ]
# or
[ item item2 item3 ... ] Commas are optional list separator items. Can even nest arrays 👍 [ "Nested Array Example" [ "Oh yes :-)" ] ] |
Added explicit call mode command hello 10 true
command("hello", 10, true) The latter will (soon) allow doing command(othercommand("Argument")) Where The other option would be something like command $(othercommand argument) Not sure if I would want the latter in this case. We'll see. |
Can now access properties via This does not work with InterpolatedString. If that's required, you can always use $playerName = $player.Name
echo "Hello, $playerName!" |
ArrayIndexExpression added via |
Implemented IfStatement if <expr> {
<body>
}
if <expr> {
<body>
} else {
<body>
} |
ElseIf now a thing. if <expr> {
<body>
} else if <expr> {
<body>
} else {
<body>
} Same structure as how TS does it. https://ts-ast-viewer.com/#code/MYewdgzgLgBAHjAvDKAnArgUwNwChcCWAZjABRwCUMA3vgL4yYA2EmMxZlN9jLbtMQTFx0gA |
Short-form if: if $value: <expr> syntactically equivalent to if $value {
<expr>
} |
Functions function print($x) {
echo $x
} with parameter types: function print($x: string) {
echo $x
} Eventually the type parsing will allow things like union types. |
Added ForIn # Array or Object iteration
for $value in $array {
# do stuff with $value
}
# Command result iteration
for $value in <command> {
# do stuff with value, expects command returns array
} Plan with the second one is to have inbuilts like |
Cleaned up block code handling - for-in also now supports inline block: for $value in <expression>: <statement> |
Multi-line support for: arrays $test = [
"Hello"
"There"
] explicit calls command(
"Test",
"Test2",
[
"Test Array Value",
]
) |
Now supporting command(innerCommand("Example")) |
for $value in example(
1,
[
"Test",
"Test2"
]
) {
} I've created a monster. |
Support multiline for command call command \
"Hello, World!" \
10 \
true which is the same as command(
"Hello, World!",
10,
true
) |
Implemented $x = {
a: 10,
b: command,
c: [
"Hello there",
10
]
} |
At the moment the Parser for Zirconium is a bit of... a mess. Makes a lot of assumptions in places and isn't really easily extended.
Ideally would want to separate it into:
The text was updated successfully, but these errors were encountered: