The commit expands the source location tracking through the AST by: 1. Switching from raw Expr/Stmt nodes to AstNode wrappers containing source slices 2. Updating interpreter and parser to preserve location info through node traversal 3. Enhancing error reporting with richer source context information
27 lines
303 B
Lox
27 lines
303 B
Lox
// Test file for source slice tracking
|
|
var x = 42;
|
|
print x;
|
|
|
|
if x > 0 then do
|
|
print "positive";
|
|
var y = x + 1;
|
|
end
|
|
elif x == 0 then do
|
|
print "zero";
|
|
end
|
|
else do
|
|
print "negative";
|
|
end
|
|
|
|
while x > 0 do
|
|
x = x - 1;
|
|
print x;
|
|
end
|
|
|
|
do
|
|
var z = 10;
|
|
print z * 2;
|
|
end
|
|
|
|
return x + 5;
|