diff --git a/lib/parser.ml b/lib/parser.ml index 7f459ef..d60605d 100644 --- a/lib/parser.ml +++ b/lib/parser.ml @@ -11,8 +11,10 @@ type stmt_result = (stmt_node, parser_error) result type expr_result = (expr_node, parser_error) result let with_is_in_loop (f : state -> 'a) (state : state) : 'a = - let state = { state with is_in_loop = true } in - f state + let new_state = { state with is_in_loop = true } in + let result = f new_state in + state.tokens <- new_state.tokens; + result let make_state tokens = { tokens; is_in_loop = false }