initial commit
This commit is contained in:
26
lib/dot_of_tast.ml
Normal file
26
lib/dot_of_tast.ml
Normal file
@ -0,0 +1,26 @@
|
||||
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))
|
||||
Reference in New Issue
Block a user