better parser errors

This commit is contained in:
Masashi 2025-12-15 21:26:39 +05:30
commit dde1da8656
7 changed files with 93 additions and 113 deletions

View file

@ -17,19 +17,16 @@ fn test() -> int
fn test() -> int
for in [1, 2, 3]
item
0
# Missing 'in' keyword in for loop
fn test() -> int
for item [1, 2, 3]
item
0
# Missing iterable in for loop
fn test() -> int
for item in
item
0
# Invalid while syntax
fn test() -> int
@ -40,10 +37,8 @@ fn test() -> int
fn test() -> int
let f = lambda
42
f()
# Missing closing parenthesis in lambda
fn test() -> int
let f = lambda(x
x
f(5)