initial commit

This commit is contained in:
cqc
2023-03-27 15:11:24 -05:00
commit 71af0f0750
10 changed files with 981 additions and 0 deletions

26
lib/dot_of_tast.ml Normal file
View 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))

1
lib/dot_of_tast.mli Normal file
View File

@ -0,0 +1 @@
val merlin_parse : string -> unit

14
lib/dune Normal file
View File

@ -0,0 +1,14 @@
(library
(name dot_of_tast)
(libraries
logs.fmt
fmt
merlin-lib.kernel
merlin-lib.analysis
merlin-lib.ocaml_merlin_specific
merlin-lib.ocaml_utils
merlin-lib.ocaml_preprocess
merlin-lib.ocaml_parsing
merlin-lib.ocaml_typing))