Files
tastsch/lib/dot_of_tast.ml
2023-03-27 15:11:24 -05:00

27 lines
865 B
OCaml

open Merlin_kernel
open Merlin_utils
let _ =
Logs.set_reporter (Logs_fmt.reporter ());
Logs.set_level (Some Debug)
module Log = (val Logs.src_log
(Logs.Src.create "dot_of_tast"
~doc:"dot_of_tast.ml logger") : Logs.LOG)
let merlin_parse str : unit =
let config, _command_args =
Mconfig.parse_arguments ~wd:(Sys.getcwd ())
~warning:(fun _ -> ())
(List.map snd []) [] Mconfig.initial []
in
File_id.with_cache @@ fun () ->
let source = Msource.make str in
let pipeline = Mpipeline.make config source in
Mpipeline.with_pipeline pipeline @@ fun () ->
Log.info (fun m -> m "merlin_parse...");
let typer = Mpipeline.typer_result pipeline in
let structure = Mbrowse.of_typedtree (Mtyper.get_typedtree typer) in
Log.info (fun m ->
m "Mbrowse.print: %s" (Mbrowse.print () structure))