···55 *)
6677type node =
88- Text of string
88+ | Text of string
99 | Verbatim of string
1010 | Group of Forester_core.delim * t
1111 | Math of Forester_core.math_mode * t
···1313 | Hash_ident of string
1414 | Xml_ident of string option * string
1515 | Subtree of string option * t
1616- | Let of Forester_core.Trie.path *
1717- Forester_core.Trie.path Forester_core.binding list * t
1616+ | Let of
1717+ Forester_core.Trie.path
1818+ * Forester_core.Trie.path Forester_core.binding list
1919+ * t
1820 | Open of Forester_core.Trie.path
1921 | Scope of t
2022 | Put of Forester_core.Trie.path * t
···2527 | Patch of t patch
2628 | Call of t * string
2729 | Import of Forester_core.visibility * string
2828- | Def of Forester_core.Trie.path *
2929- Forester_core.Trie.path Forester_core.binding list * t
3030+ | Def of
3131+ Forester_core.Trie.path
3232+ * Forester_core.Trie.path Forester_core.binding list
3333+ * t
3034 | Decl_xmlns of string * string
3135 | Alloc of Forester_core.Trie.path
3236 | Namespace of Forester_core.Trie.path * t
···4246and t = node Forester_core.Range.located list
43474448and 'a _object = {
4545- self : Forester_core.Trie.path option;
4646- methods : (string * 'a) list;
4949+ self: Forester_core.Trie.path option;
5050+ methods: (string * 'a) list;
4751}
48524953and 'a patch = {
5050- obj : 'a;
5151- self : Forester_core.Trie.path option;
5252- methods : (string * 'a) list;
5454+ obj: 'a;
5555+ self: Forester_core.Trie.path option;
5656+ methods: (string * 'a) list;
5357}
54585559val t : t Repr.t
5660val pp : Format.formatter -> t -> unit
57615858-type tree = { source_path : string option; addr : string option; code : t; }
6262+type tree = {source_path: string option; addr: string option; code: t;}
59636064val parens : t -> node
6165val squares : t -> node
···6569val import_public : string -> node
6670val inline_math : t -> node
6771val display_math : t -> node
6868-
+4-4
lib/compiler/Expand.mli
···6677open Forester_core
8899-module Unit_map: Map.S with type key = string
99+module Unit_map : Map.S with type key = string
10101111type exports = (Resolver.P.data, Asai.Range.t option) Trie.t
12121313-module Env: sig
1313+module Env : sig
1414 type t = exports Unit_map.t
1515 val empty : t
1616end
17171818val builtins : (string list * Syn.node) list
19192020-module Builtins:
2020+module Builtins :
2121sig
2222- module Transclude:
2222+ module Transclude :
2323 sig
2424 val expanded_sym : Symbol.t
2525 val show_heading_sym : Symbol.t
+1-1
lib/compiler/Forester_compiler.ml
···44 * SPDX-License-Identifier: GPL-3.0-or-later
55 *)
6677-(** This library implements the compiler for Forester. *)
77+(** The forester compiler*)
8899(** {1 Base types }*)
1010
+1-1
lib/compiler/Legacy_query_engine.mli
···1010 val run_query : Types.query -> Vertex_set.t
1111end
12121313-module Make (_: Forest_graphs.S) : S
1313+module Make (_ : Forest_graphs.S) : S
+1-2
lib/compiler/Parse.ml
···101101 let end_position = lexbuf.lex_curr_p in
102102 if is_opening_delim token then
103103 let range = Range.of_lex_range (start_position, end_position) in
104104- Stack.push (token, range) delim_stack;
105105- ;
104104+ Stack.push (token, range) delim_stack; ;
106105 if is_closing_delim token then
107106 begin
108107 match Stack.top_opt delim_stack with
+3-3
lib/core/Query.mli
···5454 ('vertex, 'var) vertex_expr Repr.t
55555656(** Don't use the constructor/destructor unless you know what you are doing! *)
5757-type 'a binder = { body: 'a }
5757+type 'a binder = {body: 'a}
5858val binder_t : 'a Repr.t -> 'a binder Repr.t
59596060type ('vertex, 'var) expr =
···9191 val fresh : unit -> t
9292end
93939494-module Global_name: Name
9494+module Global_name : Name
95959696-module Locally_nameless (N: Name) : sig
9696+module Locally_nameless (N : Name) : sig
9797 type 'vertex lnexpr = ('vertex, N.t lnvar) expr
98989999 val distill : 'vertex lnexpr -> ('vertex, dbix) expr
···8899type t
10101111-module V:
1111+module V :
1212sig
1313 type t = string
1414 val compare : t -> t -> int
+1-1
lib/frontend/Map_reduce.mli
···3333end
34343535module Make
3636- (I: Input) : S with
3636+ (I : Input) : S with
3737 type env := I.env
3838 and type input := I.input
3939 and type output := I.output
+19-18
lib/language_server/Lsp_server.mli
···991010(** The portion of the protocol that is currently supported by the forester language server.
1111*)
1212-module Handlers: sig
1212+module Handlers : sig
1313+13141415 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_prepareCallHierarchy}[textDocument/prepareCallHierarchy].}
1516 *)
1616- module Call_hierarchy: sig
1717+ module Call_hierarchy : sig
1718 val incoming : Lsp.Types.CallHierarchyIncomingCallsParams.t -> Lsp.Types.CallHierarchyIncomingCall.t list option
1819 val outgoing : Lsp.Types.CallHierarchyOutgoingCallsParams.t -> Lsp.Types.CallHierarchyOutgoingCall.t list option
1920 val compute : Lsp.Types.CallHierarchyPrepareParams.t -> 'a list option
···21222223 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeConfiguration}[workspace/didChangeConfigurationNotification]}
2324 *)
2424- module Change_configuration: sig
2525+ module Change_configuration : sig
2526 val compute : Lsp.Types.DidChangeConfigurationParams.t -> unit
2627 end
27282829 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeLens}[textDocument/codeLens]}
2930 *)
3030- module Code_lens: sig
3131+ module Code_lens : sig
3132 val compute : Lsp.Types.CodeLensParams.t -> 'a list
3233 end
33343435 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction}[textDocument/codeAction]}
3536 *)
3636- module Code_action: sig
3737+ module Code_action : sig
3738 val execute : Lsp.Types.ExecuteCommandParams.t -> Yojson.Safe.t
3839 val compute : Lsp.Types.CodeActionParams.t -> Lsp.Types.CodeActionResult.t
3940 end
···4142 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#
4243 textDocument_completion}[textDocument/completion]}
4344 *)
4444- module Completion: sig
4545+ module Completion : sig
4546 val compute : Lsp.Types.CompletionParams.t -> [> `CompletionList of Lsp.Types.CompletionList.t] option
4647 end
47484849 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition}[textDocument/definition]}
4950 *)
5050- module Definitions: sig
5151+ module Definitions : sig
5152 val compute : Lsp.Types.DefinitionParams.t -> Lsp.Types.Locations.t option
5253 end
53545455 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didChange}[textDocument/didChange]}
5556 *)
5656- module Did_change: sig
5757+ module Did_change : sig
5758 val compute : Lsp.Types.DidChangeTextDocumentParams.t -> unit
5859 end
59606061 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didOpen}[textDocument/didOpen]}
6162 *)
6262- module Did_open: sig
6363+ module Did_open : sig
6364 val compute : Lsp.Types.DidOpenTextDocumentParams.t -> unit
6465 end
65666667 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentLink}[textDocument/documentLink]}
6768 *)
6868- module Document_link: sig
6969+ module Document_link : sig
6970 val compute : Lsp.Types.DocumentLinkParams.t -> Lsp.Types.DocumentLink.t list option
7071 end
71727273 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol}[textDocument/documentSymbol]}
7374 *)
7474- module Document_symbols: sig
7575+ module Document_symbols : sig
7576 val compute : Lsp.Types.DocumentSymbolParams.t -> [> `DocumentSymbol of Lsp.Types.DocumentSymbol.t list] option
7677 end
77787879 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_highlight}[textDocument/highlight]}
7980 *)
8080- module Highlight: sig
8181+ module Highlight : sig
8182 val compute : Lsp.Types.DocumentHighlightParams.t -> Lsp.Types.DocumentHighlight.t list option
8283 end
83848485 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_hover}[textDocument/hover]}
8586 *)
8686- module Hover: sig
8787+ module Hover : sig
8788 val compute : Lsp.Types.HoverParams.t -> Lsp.Types.Hover.t option
8889 end
89909091 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint}[textDocument/inlayHint]}
9192 *)
9292- module Inlay_hint: sig
9393+ module Inlay_hint : sig
9394 val compute : Lsp.Types.InlayHintParams.t -> Lsp.Types.InlayHint.t list option
9495 end
95969697 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens}[textDocument/semanticTokens]}
9798 *)
9898- module Semantic_tokens: sig
9999+ module Semantic_tokens : sig
99100 val on_full_request : Lsp.Types.SemanticTokensParams.t -> Lsp.Types.SemanticTokens.t option
100101 val on_delta_request : Lsp.Types.SemanticTokensDeltaParams.t -> [`SemanticTokens of Lsp.Types.SemanticTokens.t | `SemanticTokensDelta of Lsp.Types.SemanticTokensDelta.t] option
101102 end
102103103104 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_symbol}[workspace/symbol]}
104105 *)
105105- module Workspace_symbols: sig
106106+ module Workspace_symbols : sig
106107 val compute : Lsp.Types.WorkspaceSymbolParams.t -> Lsp.Types.SymbolInformation.t list option
107108 end
108109end
···115116116117val run : init: Lsp_state.state -> (unit -> 'a) -> 'a
117118118118-module Request: sig
119119+module Request : sig
119120 type packed = Lsp.Client_request.packed
120121 type 'resp t = 'resp Lsp.Client_request.t
121122···124125 val respond : Jsonrpc.Id.t -> 'resp t -> 'resp -> unit
125126end
126127127127-module Notification: sig
128128+module Notification : sig
128129 type t = Lsp.Client_notification.t
129130130131 val handle : Jsonrpc.Notification.t -> unit
+2-2
lib/prelude/BaseN.mli
···1414 val string_of_int : int -> string
1515end
16161717-module Make (_: I) : S
1818-module Base36: S
1717+module Make (_ : I) : S
1818+module Base36 : S
···77open Types
8899module Make () : sig
1010- type xmlns_attr = { prefix: string; xmlns: string }
1010+ type xmlns_attr = {prefix: string; xmlns: string}
1111 val normalise_qname : xml_qname -> xml_qname
1212 val within_scope : (unit -> 'a) -> xmlns_attr list * 'a
1313 val find_xmlns_for_prefix : string -> string option
+6
test/Test_LaTeX_pipeline.ml
···88open Forester_prelude
99open Forester_compiler
10101111+(* This test runs LaTeX_pipeline.latex_to_svg. This requires a LaTeX
1212+ environment. Since the output is (apparently) non-deterministic, we can't
1313+ equality check the output, so we just use a try-with to verify that the
1414+ function runs with no exceptions.
1515+ *)
1616+1117let () =
1218 let test_pipeline () =
1319 let@ env = Eio_main.run in
+10-2
test/Test_compiler.ml
···1616 let@ env = Eio_main.run in
1717 let config = Config.default in
1818 let tree_dirs = Eio_util.paths_of_dirs ~env config.trees in
1919+2020+ (* This test verifies that the `reparse` function works correctly.*)
1921 let test_reparsing () =
2022 let@ () = Reporter.test_run in
2323+ (*First, perform a regular batch compilation run.*)
2124 let before_forest =
2225 State_machine.batch_run
2326 ~env
2427 ~config
2528 ~dev: false
2629 in
3030+ (* Get the URI of "reparse.tree". In order to make the test reproducible,
3131+ we can't use hardcoded paths, as those may be different in CI and on
3232+ different hosts.*)
2733 let uri =
2834 before_forest.documents |> Hashtbl.to_seq_keys
2935 |> Seq.find_map
···4147 before_forest
4248 |> reparse
4349 (
5050+ (* Create a Text_document.t with new content.*)
4451 Lsp.Text_document.make
4552 ~position_encoding: `UTF16 @@
4653 Lsp.Types.DidOpenTextDocumentParams.create
···5663 in
5764 let module Graphs = (val reparsed_forest.graphs) in
5865 let import_graph = Graphs.get_rel Query.Edges "imports" in
6666+ (* FIXME: *)
5967 Alcotest.(check string)
6068 ""
6169 ""
···6573 (* true *)
6674 (* (Forest_graph.out_degree import_graph vtx > 0) *)
6775 in
6868- let test () =
7676+ let test_batch_run () =
6977 let forest =
7078 let@ () = Reporter.easy_run in
7179 State_machine.batch_run ~env ~config ~dev: false
···8189 [
8290 "pipeline",
8391 [
8484- test_case "basic batch run" `Quick test;
9292+ test_case "basic batch run" `Quick test_batch_run;
8593 test_case "reparsing" `Quick test_reparsing
8694 ]
8795 ]
+2-4
test/Test_expansion.ml
···55 *)
6677open Forester_compiler
88+open Forester_frontend
89open Testables
9101011let () =
···1819 source_path = None;
1920 (* If tree has no address, exports are not added *)
2021 addr = Some "test-tree";
2121- (* Use fully qualified open here, see
2222- https://github.com/mirage/alcotest/issues/414
2323- *)
2424- code = let open Forester_frontend.DSL.Code in
2222+ code = let open DSL.Code in
2523 [
2624 def
2725 ["foo"]
-2
test/Test_parser.ml
···1111open Prelude
1212open Forester_frontend.DSL.Code
13131414-(* Using local open breaks tests, see https://github.com/mirage/alcotest/issues/414*)
1515-1614let test_prim () =
1715 Alcotest.(check @@ result code diagnostic)
1816 "same nodes"
···11[forest]
22host = "lsp-test"
33-trees = ["trees" ] # The directories in which your trees are stored
44-assets = ["assets"] # The directories in which your assets are stored
55-theme = "theme" # The directory in which your theme is stored
33+trees = ["trees" ]
44+theme = "theme"
65home = "index"
76prefixes = ["test"]
87foreign = ["export/foreign.json"]