WIP: Refactoring of the front-end.
This commit is contained in:
parent
fc3385389b
commit
8047e98124
@ -55,13 +55,12 @@ module Errors =
|
|||||||
in Trace.error ~data:[] title message
|
in Trace.error ~data:[] title message
|
||||||
end
|
end
|
||||||
|
|
||||||
let parse (module IO : IO) parser =
|
let parse (module Unit : ParserUnit.S) parser =
|
||||||
let module Unit = PreUnit (IO) in
|
|
||||||
let local_fail error =
|
let local_fail error =
|
||||||
Trace.fail
|
Trace.fail
|
||||||
@@ Errors.generic
|
@@ Errors.generic
|
||||||
@@ Unit.format_error ~offsets:IO.options#offsets
|
@@ Unit.format_error ~offsets:Unit.IO.options#offsets
|
||||||
IO.options#mode error in
|
Unit.IO.options#mode error in
|
||||||
match parser () with
|
match parser () with
|
||||||
Stdlib.Ok semantic_value -> Trace.ok semantic_value
|
Stdlib.Ok semantic_value -> Trace.ok semantic_value
|
||||||
|
|
||||||
@ -121,7 +120,9 @@ let parse (module IO : IO) parser =
|
|||||||
Hint: Change the name.\n",
|
Hint: Change the name.\n",
|
||||||
None, invalid))
|
None, invalid))
|
||||||
|
|
||||||
let parse_file source =
|
let parse_file :
|
||||||
|
string -> (Unit.Parser.ast, string Region.reg) Stdlib.result =
|
||||||
|
fun source ->
|
||||||
let module IO =
|
let module IO =
|
||||||
struct
|
struct
|
||||||
let ext = PreIO.ext
|
let ext = PreIO.ext
|
||||||
|
@ -6,7 +6,10 @@ module type IO =
|
|||||||
val options : EvalOpt.options
|
val options : EvalOpt.options
|
||||||
end
|
end
|
||||||
|
|
||||||
let parse_file generic_error (module Unit : ParserUnit.S) parse =
|
let parse_file generic_error
|
||||||
|
(module Unit : ParserUnit.S)
|
||||||
|
(parse: unit -> (Unit.Parser.ast, string Region.reg) Stdlib.result)
|
||||||
|
: (Unit.Parser.ast, string Region.reg) Stdlib.result =
|
||||||
let lib_path =
|
let lib_path =
|
||||||
match Unit.IO.options#libs with
|
match Unit.IO.options#libs with
|
||||||
[] -> ""
|
[] -> ""
|
||||||
|
Loading…
Reference in New Issue
Block a user