feat: add ObjBlock type, block compilation, and newline skipping in parser
Introduce a new ObjBlock object type with OBJ_BLOCK tag, replacing the placeholder OBJ_NUM in makeBlock(). Refactor the compiler to separate Parser and Compiler structs, adding skipNewlines and hasError fields to Parser and a parent pointer to Compiler for nested block support. Implement compileBlock() function that compiles a block up to a specified end token, and update callBlock() in the VM to push empty slots for local variables. Adjust token reading functions to accept Parser instead of Compiler, and remove the MAX_TOKEN enum entry.
This commit is contained in:
+3
-1
@@ -1,4 +1,6 @@
|
||||
class Foo {}
|
||||
{
|
||||
123
|
||||
}
|
||||
var a = 123
|
||||
var b = 345
|
||||
a
|
||||
|
||||
Reference in New Issue
Block a user