mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
fixed bug wih with_is_in_loop
This commit is contained in:
parent
6206ee4a00
commit
94ccf91689
1 changed files with 4 additions and 2 deletions
|
|
@ -11,8 +11,10 @@ type stmt_result = (stmt_node, parser_error) result
|
||||||
type expr_result = (expr_node, parser_error) result
|
type expr_result = (expr_node, parser_error) result
|
||||||
|
|
||||||
let with_is_in_loop (f : state -> 'a) (state : state) : 'a =
|
let with_is_in_loop (f : state -> 'a) (state : state) : 'a =
|
||||||
let state = { state with is_in_loop = true } in
|
let new_state = { state with is_in_loop = true } in
|
||||||
f state
|
let result = f new_state in
|
||||||
|
state.tokens <- new_state.tokens;
|
||||||
|
result
|
||||||
|
|
||||||
let make_state tokens = { tokens; is_in_loop = false }
|
let make_state tokens = { tokens; is_in_loop = false }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue