mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
minor fixups
This commit is contained in:
parent
b425a59db5
commit
f4ddaeb11d
2 changed files with 3 additions and 3 deletions
|
|
@ -79,7 +79,7 @@ let collect_chain (tts : token_type array) (collector : state -> ('a, parser_err
|
||||||
in
|
in
|
||||||
collect_chain_rec [] |> Result.map List.rev
|
collect_chain_rec [] |> Result.map List.rev
|
||||||
|
|
||||||
let primary (state : state) : expr_result =
|
let atom (state : state) : expr_result =
|
||||||
let pos = cur_pos state in
|
let pos = cur_pos state in
|
||||||
match peek_tt state with
|
match peek_tt state with
|
||||||
| Number x ->
|
| Number x ->
|
||||||
|
|
@ -115,7 +115,7 @@ let rec grouping (state : state) : expr_result =
|
||||||
let tt = peek_tt state in
|
let tt = peek_tt state in
|
||||||
let msg = Printf.sprintf "Expected RightParen, got %s instead" (show_token_type tt) in
|
let msg = Printf.sprintf "Expected RightParen, got %s instead" (show_token_type tt) in
|
||||||
Error { pos; msg })
|
Error { pos; msg })
|
||||||
else primary state
|
else atom state
|
||||||
|
|
||||||
and call (state : state) : expr_result =
|
and call (state : state) : expr_result =
|
||||||
let* expr = grouping state in
|
let* expr = grouping state in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ type lox_function = {
|
||||||
env : environment;
|
env : environment;
|
||||||
arity : int;
|
arity : int;
|
||||||
arg_names : string list;
|
arg_names : string list;
|
||||||
body : Stmt.stmt_node; [@printer fun fmt _ -> fprintf fmt "<body>"]
|
body : Stmt.stmt_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
and native_function = {
|
and native_function = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue