mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
implemented break
This commit is contained in:
parent
3bc871d434
commit
e288a626fd
6 changed files with 84 additions and 72 deletions
|
|
@ -21,12 +21,17 @@ module ParserError = struct
|
|||
Printf.printf "ParserError at line %d, column %d: %s\n" e.pos.line e.pos.col e.msg
|
||||
end
|
||||
|
||||
type runtime_error = { pos : code_pos; msg : string }
|
||||
type runtime_error = { pos : code_pos; msg : string; is_break : bool }
|
||||
|
||||
module RuntimeError = struct
|
||||
type t = parser_error
|
||||
|
||||
let make (pos : code_pos) (msg : string) : runtime_error = { pos; msg }
|
||||
let make (pos : code_pos) (msg : string) : runtime_error = { pos; msg; is_break = false }
|
||||
|
||||
let break () : runtime_error =
|
||||
let pos = { line = -1; col = -1 } in
|
||||
let msg = "" in
|
||||
{ pos; msg; is_break = true }
|
||||
|
||||
let print (e : runtime_error) =
|
||||
Printf.printf "RuntimeError at line %d, column %d: %s\n" e.pos.line e.pos.col e.msg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue