feat: add break statement support with loop tracking and error handling
Add TOKEN_BREAK keyword recognition and a loopBody field to the compiler to track the innermost loop's first instruction index. The break statement emits a jump to the end of the current loop, and compile-time errors are reported when break appears outside a loop body, inside a function defined within a loop, or inside a method defined within a loop. New test files verify correct behavior for break in while loops, nested loops, and error cases for invalid break usage.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
break // expect error
|
||||
Reference in New Issue
Block a user