feat: add import keyword token and parser support with updated test syntax
Add TOKEN_IMPORT to the token enum and wire it into the keyword parser in readName(). Refactor string literal parsing by extracting stringConstant() helper that returns the constant index, allowing the new import parser to reuse it. Update all module test files to replace the old .import_() method calls with the new import "module" for Var syntax, and add new error test cases for missing string and missing for clause after import.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
// Should execute the module:
|
||||
// expect: ran module
|
||||
var DoesNotExist = "module".import_("DoesNotExist") // expect runtime error: Could not find a variable named 'DoesNotExist' in module 'module'.
|
||||
import "module" for DoesNotExist // expect runtime error: Could not find a variable named 'DoesNotExist' in module 'module'.
|
||||
|
||||
Reference in New Issue
Block a user