mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
removed show from lox_value
This commit is contained in:
parent
dee73dea20
commit
34c279ec2e
2 changed files with 3 additions and 5 deletions
|
|
@ -16,7 +16,8 @@ let exit : native_function =
|
||||||
match n with
|
match n with
|
||||||
| Number n when Float.is_integer n -> Int.of_float n |> exit
|
| Number n when Float.is_integer n -> Int.of_float n |> exit
|
||||||
| _ ->
|
| _ ->
|
||||||
Printf.sprintf "Must call exit with integer, received %s instead" (show_lox_value n)
|
Printf.sprintf "Must call exit with integer, received %s instead"
|
||||||
|
(string_of_lox_value n)
|
||||||
|> Result.error)
|
|> Result.error)
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,16 @@
|
||||||
type lox_function = {
|
type lox_function = {
|
||||||
name : string;
|
name : string;
|
||||||
arity : int;
|
arity : int;
|
||||||
(* env : Environment.environment; *)
|
(* env : Environment.environment; [@printer fun fmt _ -> fprintf fmt "<env>"] *)
|
||||||
arg_names : string list;
|
arg_names : string list;
|
||||||
body : Stmt.stmt_node; [@printer fun fmt _ -> fprintf fmt "<body>"]
|
body : Stmt.stmt_node; [@printer fun fmt _ -> fprintf fmt "<body>"]
|
||||||
}
|
}
|
||||||
[@@deriving show { with_path = false }]
|
|
||||||
|
|
||||||
type native_function = {
|
type native_function = {
|
||||||
name : string;
|
name : string;
|
||||||
arity : int;
|
arity : int;
|
||||||
fn : lox_value list -> (lox_value, string) result;
|
fn : lox_value list -> (lox_value, string) result;
|
||||||
}
|
}
|
||||||
[@@deriving show { with_path = false }]
|
|
||||||
|
|
||||||
and lox_value =
|
and lox_value =
|
||||||
| Function of lox_function
|
| Function of lox_function
|
||||||
|
|
@ -21,7 +19,6 @@ and lox_value =
|
||||||
| Number of float
|
| Number of float
|
||||||
| Bool of bool
|
| Bool of bool
|
||||||
| Nil
|
| Nil
|
||||||
[@@deriving show { with_path = false }]
|
|
||||||
|
|
||||||
let string_of_lox_value lox_value =
|
let string_of_lox_value lox_value =
|
||||||
match lox_value with
|
match lox_value with
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue