Soilihi BEN SOILIHI BOINA pushed to branch soilih at Stefan / Typer
Commits: 4bd05656 by Soilih BEN SOILIH at 2021-04-14T21:19:06-06:00 return the AST with the logs
- - - - - 620fabd9 by Soilih BEN SOILIH at 2021-04-15T14:09:36-06:00 resolving the exception
- - - - -
5 changed files:
- btl/pervasive.typer - + src/configuration.json - src/dune - src/elab.ml - src/typer_lsp_server.ml
Changes:
===================================== btl/pervasive.typer ===================================== @@ -570,7 +570,7 @@ define-operator "<-" 80 96; %% %% `List` is the type and `list` is the module %% -list = load "btl/list.typer"; +list = load "/home/soilih/Projet Maitrise/typer/btl/list.typer";
%% %% Macro `do` for easier series of IO operation @@ -578,13 +578,13 @@ list = load "btl/list.typer"; %% e.g.: %% do { IO_return true; }; %% -do = let lib = load "btl/do.typer" in lib.do; +do = let lib = load "/home/soilih/Projet Maitrise/typer/btl/do.typer" in lib.do;
%% %% Module containing various macros for tuple %% Used by `case_` %% -tuple-lib = load "btl/tuple.typer"; +tuple-lib = load "/home/soilih/Projet Maitrise/typer/btl/tuple.typer";
%% %% Get the nth element of a tuple @@ -615,7 +615,7 @@ Tuple = tuple-lib.tuple-type; %% %% Macro `case` for a some more complex pattern matching %% -case_ = let lib = load "btl/case.typer" in lib.case-macro; +case_ = let lib = load "/home/soilih/Projet Maitrise/typer/btl/case.typer" in lib.case-macro;
%% %% plain-let @@ -632,7 +632,7 @@ define-operator "plain-let" () 3; %% define-operator "in" 3 67; %%
-plain-let_in_ = let lib = load "btl/plain-let.typer" in lib.plain-let-macro; +plain-let_in_ = let lib = load "/home/soilih/Projet Maitrise/typer/btl/plain-let.typer" in lib.plain-let-macro;
%% %% `case` at function level @@ -642,7 +642,7 @@ plain-let_in_ = let lib = load "btl/plain-let.typer" in lib.plain-let-macro; %% | true => false %% | false => true; %% -_|_ = let lib = load "btl/polyfun.typer" in lib._|_; +_|_ = let lib = load "/home/soilih/Projet Maitrise/typer/btl/polyfun.typer" in lib._|_;
%% %% case_as_return_, case_return_ @@ -651,7 +651,7 @@ _|_ = let lib = load "btl/polyfun.typer" in lib._|_;
define-operator "as" 42 42; define-operator "return" 42 42; -depelim = load "btl/depelim.typer"; +depelim = load "/home/soilih/Projet Maitrise/typer/btl/depelim.typer"; case_as_return_ = depelim.case_as_return_; case_return_ = depelim.case_return_;
===================================== src/configuration.json ===================================== @@ -0,0 +1,4 @@ +{ + "path": "/home/soilih/Projet Maitrise/typer", + "description" : "this path is the path from where we run Typer to the typer folder. We must change it to make it work !!!" +} \ No newline at end of file
===================================== src/dune ===================================== @@ -3,6 +3,6 @@ (name typerlib) (libraries zarith str linol linol-lwt - lsp jsonrpc + lsp jsonrpc yojson ))
===================================== src/elab.ml ===================================== @@ -64,9 +64,19 @@ module EL = Elexp let dloc = dummy_location
let parsing_internals = ref false + +(* +(* Read the JSON file *) +let json = Yojson.Basic.from_file "../../configuration.json" + +(* take the path + it's make an exception now !! +*) +let exec_path = json |> Yojson.Basic.Util.member "path" |> Yojson.Basic.Util.to_string;; +*) let btl_folder = try Sys.getenv "TYPER_BUILTINS" - with Not_found -> "./btl" + with Not_found -> (*exec_path*) "/home/soilih/Projet Maitrise/typer" ^ "/btl"
let fatal = Log.log_fatal ~section:"ELAB" let error = Log.log_error ~section:"ELAB"
===================================== src/typer_lsp_server.ml ===================================== @@ -39,8 +39,9 @@ open Log open Util
-type state_after_processing = log_entry list - +type state_after_processing = (log_entry list * + ((vname * Lexp.lexp * Lexp.ltype) list list * Debruijn.elab_context) + ) let log_entry_to_list (tab:log_entry list) : ((string * int * int * string) * log_level * string) list = List.map (fun x -> let location = Option.get x.loc in ((location.file,location.line,location.column,location.docstr) @@ -57,14 +58,15 @@ let log_level_to_severity (level:log_level) : Lsp.Types.DiagnosticSeverity.t = let readstring (str:string) = let ectx = Elab.default_ectx in (*let rctx = Elab.default_rctx in*) - ignore (Elab.lexp_decl_str str ectx); - !Log.typer_log + let ast = Elab.lexp_decl_str str ectx in + (!Log.typer_log, ast)
let process_some_input_file (_file_contents : string) : state_after_processing = readstring _file_contents
let diagnostics (_state : state_after_processing) : Lsp.Types.Diagnostic.t list = - let log_tab = log_entry_to_list _state in + let (log, _) = _state in + let log_tab = log_entry_to_list log in List.map (fun x -> let (loc, lev, msg) = x in let (_ (* file *), line, column, _ (* docstr *) ) = loc in
View it on GitLab: https://gitlab.com/monnier/typer/-/compare/fad7704ffe489fc4c984b96e5bd6253e5...
Afficher les réponses par date