Add TextWriter, IOException, per-VM module data and pre-load imports; Add console module with Console class

This commit is contained in:
2026-11-23 18:36:46 +01:00
parent 2243557bf5
commit 4d06edd045
55 changed files with 1679 additions and 675 deletions
+11 -10
View File
@@ -1,30 +1,31 @@
import 'console';
class Test {
public void goto_test1() {
int $i = 0;
a:
print("Foo $i\n");
Console::Print("Foo $i\n");
if($i > 5)
goto b;
$i++;
goto a;
b:
print("Bar $i\n\n");
Console::Print("Bar $i\n\n");
}
public void goto_test2(int $a = 2) {
switch($a) {
case 1:
print("\$a is 1\n\n");
Console::Print("\$a is 1\n\n");
goto out;
case 2:
print("\$a is 2\n\n");
Console::Print("\$a is 2\n\n");
goto out;
case 3:
print("\$a is 3\n\n");
Console::Print("\$a is 3\n\n");
goto out;
case 4:
print("\$a is 4\n\n");
Console::Print("\$a is 4\n\n");
goto out;
}
out:
@@ -34,11 +35,11 @@ class Test {
int $a = 10;
a:
$a--;
print("$a\n");
Console::Print("$a\n");
if($a > 5) {
goto a;
}
print("\n");
Console::Print("\n");
}
public void goto_test4() {
@@ -47,9 +48,9 @@ class Test {
int $c;
hIterator: {
$c = 0;
print($headers[$pos], "\n");
Console::Print($headers[$pos] + "\n");
cIterator: {
print(" ", $headers[$pos][$c], "\n");
Console::Print(" " + $headers[$pos][$c] + "\n");
if(strlen($headers[$pos]) <= ++$c) {
goto cIteratorExit;
}