package lambdapi
All checked builds pass sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Proof assistant for the λΠ-calculus modulo rewriting
Install
dune-project
Dependency
Authors
Maintainers
Sources
lambdapi-4.0.0.tbz
sha256=0e2e73e0ea0c674f1263bf85ed3453ed3d6084d38eea29974a03ba9e382d29d7
sha512=2831db57fcd09206687a92fc9ee7d363e87bcec5167949e9c8161d41c63d5887b9f3556bfd63a7a9a0c12e5a5dc61a397baf4f496ebdb2a2fce122142c05e7a1
doc/src/lambdapi.lsp/lsp_base.ml.html
Source file lsp_base.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109(************************************************************************) (* The λΠ-modulo Interactive Proof Assistant *) (************************************************************************) (************************************************************************) (* λΠ-modulo serialization Toplevel *) (* Copyright 2018 MINES ParisTech -- Dual License LGPL 2.1 / GPL3+ *) (* Written by: Emilio J. Gallego Arias *) (************************************************************************) (* Status: Very Experimental *) (************************************************************************) open Lplib open Common open Handle (* Whether to send extended lsp messages *) let std_protocol = ref true module J = Yojson.Basic let mk_extra l = if !std_protocol then [] else l (* Ad-hoc parsing for file:///foo... *) let _parse_uri str = let l = String.length str - 7 in String.(sub str 7 l) let mk_reply ~id ~result = `Assoc [ "jsonrpc", `String "2.0"; "id", `Int id; "result", result ] let mk_event m p = `Assoc [ "jsonrpc", `String "2.0"; "method", `String m; "params", `Assoc p ] let mk_showMessage ?(t=1) m = `Assoc [ "jsonrpc", `String "2.0"; "method", `String "window/showMessage"; "params", `Assoc [ "type", `Int t; "message", `String m ] ] (* LSP positions are 0-based, non-negative, and require start <= end. Lambdapi lines are 1-based, and generated symbols carry virtual positions violating the other two constraints (see the NOTE on generated symbols in [Core.Term]): hence shift lines, floor at 0, and collapse inverted ranges to their start. *) let json_of_range l1 c1 l2 c2 : J.t = let max0 n = if n < 0 then 0 else n in let l1 = max0 (l1 - 1) and c1 = max0 c1 in let l2 = max0 (l2 - 1) and c2 = max0 c2 in let l2, c2 = if (l2, c2) < (l1, c1) then l1, c1 else l2, c2 in `Assoc ["start", `Assoc ["line", `Int l1; "character", `Int c1]; "end", `Assoc ["line", `Int l2; "character", `Int c2]] let mk_range (p : Pos.pos) : J.t = Pos.(json_of_range p.start_line p.start_col p.end_line p.end_col) let mk_range_of_interval (r : Range.t) : J.t = let s = Range.interval_start r and e = Range.interval_end r in json_of_range (Range.line s) (Range.column s) (Range.line e) (Range.column e) let json_of_goal (hyps, concl) = let json_of_hyp (s,t) = `Assoc ["hname", `String s; "htype", `String t] in match concl with | Goal.Typ(meta,typ) -> `Assoc [ "typeofgoal", `String "Typ" ; "gid", `String meta ; "hyps", `List (List.map json_of_hyp hyps) ; "type", `String typ] | Goal.Unif c -> `Assoc [ "typeofgoal", `String "Unif" ; "hyps", `List (List.map json_of_hyp hyps) ; "constr", `String c] let json_of_goals ?logs goals = let logs = match logs with None -> "" | Some s -> s in match goals with | None -> `Assoc [ "logs", `String logs ] | Some goals -> `Assoc [ "goals", `List List.(map json_of_goal goals); "logs" , `String logs ] let mk_diagnostic ((p : Pos.pos), (lvl : int), (msg : string), (goals : _ option)) : J.t = let goals = json_of_goals goals in let range = mk_range p in `Assoc (mk_extra ["goal_info", goals] @ ["range", range; "severity", `Int lvl; "message", `String msg; ]) let mk_diagnostics ~uri ~version ld : J.t = let extra = mk_extra ["version", `Int version] in mk_event "textDocument/publishDiagnostics" @@ extra @ ["uri", `String uri; "diagnostics", `List List.(map mk_diagnostic ld)]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>