ocaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Formatting, docs, comments

authored by

Kento Okura and committed by
Jon Sterling
4b375278 ff539404

+87 -67
+15 -12
lib/compiler/Code.mli
··· 5 5 *) 6 6 7 7 type node = 8 - Text of string 8 + | Text of string 9 9 | Verbatim of string 10 10 | Group of Forester_core.delim * t 11 11 | Math of Forester_core.math_mode * t ··· 13 13 | Hash_ident of string 14 14 | Xml_ident of string option * string 15 15 | Subtree of string option * t 16 - | Let of Forester_core.Trie.path * 17 - Forester_core.Trie.path Forester_core.binding list * t 16 + | Let of 17 + Forester_core.Trie.path 18 + * Forester_core.Trie.path Forester_core.binding list 19 + * t 18 20 | Open of Forester_core.Trie.path 19 21 | Scope of t 20 22 | Put of Forester_core.Trie.path * t ··· 25 27 | Patch of t patch 26 28 | Call of t * string 27 29 | Import of Forester_core.visibility * string 28 - | Def of Forester_core.Trie.path * 29 - Forester_core.Trie.path Forester_core.binding list * t 30 + | Def of 31 + Forester_core.Trie.path 32 + * Forester_core.Trie.path Forester_core.binding list 33 + * t 30 34 | Decl_xmlns of string * string 31 35 | Alloc of Forester_core.Trie.path 32 36 | Namespace of Forester_core.Trie.path * t ··· 42 46 and t = node Forester_core.Range.located list 43 47 44 48 and 'a _object = { 45 - self : Forester_core.Trie.path option; 46 - methods : (string * 'a) list; 49 + self: Forester_core.Trie.path option; 50 + methods: (string * 'a) list; 47 51 } 48 52 49 53 and 'a patch = { 50 - obj : 'a; 51 - self : Forester_core.Trie.path option; 52 - methods : (string * 'a) list; 54 + obj: 'a; 55 + self: Forester_core.Trie.path option; 56 + methods: (string * 'a) list; 53 57 } 54 58 55 59 val t : t Repr.t 56 60 val pp : Format.formatter -> t -> unit 57 61 58 - type tree = { source_path : string option; addr : string option; code : t; } 62 + type tree = {source_path: string option; addr: string option; code: t;} 59 63 60 64 val parens : t -> node 61 65 val squares : t -> node ··· 65 69 val import_public : string -> node 66 70 val inline_math : t -> node 67 71 val display_math : t -> node 68 -
+4 -4
lib/compiler/Expand.mli
··· 6 6 7 7 open Forester_core 8 8 9 - module Unit_map: Map.S with type key = string 9 + module Unit_map : Map.S with type key = string 10 10 11 11 type exports = (Resolver.P.data, Asai.Range.t option) Trie.t 12 12 13 - module Env: sig 13 + module Env : sig 14 14 type t = exports Unit_map.t 15 15 val empty : t 16 16 end 17 17 18 18 val builtins : (string list * Syn.node) list 19 19 20 - module Builtins: 20 + module Builtins : 21 21 sig 22 - module Transclude: 22 + module Transclude : 23 23 sig 24 24 val expanded_sym : Symbol.t 25 25 val show_heading_sym : Symbol.t
+1 -1
lib/compiler/Forester_compiler.ml
··· 4 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 5 *) 6 6 7 - (** This library implements the compiler for Forester. *) 7 + (** The forester compiler*) 8 8 9 9 (** {1 Base types }*) 10 10
+1 -1
lib/compiler/Legacy_query_engine.mli
··· 10 10 val run_query : Types.query -> Vertex_set.t 11 11 end 12 12 13 - module Make (_: Forest_graphs.S) : S 13 + module Make (_ : Forest_graphs.S) : S
+1 -2
lib/compiler/Parse.ml
··· 101 101 let end_position = lexbuf.lex_curr_p in 102 102 if is_opening_delim token then 103 103 let range = Range.of_lex_range (start_position, end_position) in 104 - Stack.push (token, range) delim_stack; 105 - ; 104 + Stack.push (token, range) delim_stack; ; 106 105 if is_closing_delim token then 107 106 begin 108 107 match Stack.top_opt delim_stack with
+3 -3
lib/core/Query.mli
··· 54 54 ('vertex, 'var) vertex_expr Repr.t 55 55 56 56 (** Don't use the constructor/destructor unless you know what you are doing! *) 57 - type 'a binder = { body: 'a } 57 + type 'a binder = {body: 'a} 58 58 val binder_t : 'a Repr.t -> 'a binder Repr.t 59 59 60 60 type ('vertex, 'var) expr = ··· 91 91 val fresh : unit -> t 92 92 end 93 93 94 - module Global_name: Name 94 + module Global_name : Name 95 95 96 - module Locally_nameless (N: Name) : sig 96 + module Locally_nameless (N : Name) : sig 97 97 type 'vertex lnexpr = ('vertex, N.t lnvar) expr 98 98 99 99 val distill : 'vertex lnexpr -> ('vertex, dbix) expr
-1
lib/frontend/Export_for_test.ml
··· 1 - (* module LaTeX_pipeline = LaTeX_pipeline *)
+1 -1
lib/frontend/Legacy_import_graph.mli
··· 8 8 9 9 type t 10 10 11 - module V: 11 + module V : 12 12 sig 13 13 type t = string 14 14 val compare : t -> t -> int
+1 -1
lib/frontend/Map_reduce.mli
··· 33 33 end 34 34 35 35 module Make 36 - (I: Input) : S with 36 + (I : Input) : S with 37 37 type env := I.env 38 38 and type input := I.input 39 39 and type output := I.output
+19 -18
lib/language_server/Lsp_server.mli
··· 9 9 10 10 (** The portion of the protocol that is currently supported by the forester language server. 11 11 *) 12 - module Handlers: sig 12 + module Handlers : sig 13 + 13 14 14 15 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_prepareCallHierarchy}[textDocument/prepareCallHierarchy].} 15 16 *) 16 - module Call_hierarchy: sig 17 + module Call_hierarchy : sig 17 18 val incoming : Lsp.Types.CallHierarchyIncomingCallsParams.t -> Lsp.Types.CallHierarchyIncomingCall.t list option 18 19 val outgoing : Lsp.Types.CallHierarchyOutgoingCallsParams.t -> Lsp.Types.CallHierarchyOutgoingCall.t list option 19 20 val compute : Lsp.Types.CallHierarchyPrepareParams.t -> 'a list option ··· 21 22 22 23 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeConfiguration}[workspace/didChangeConfigurationNotification]} 23 24 *) 24 - module Change_configuration: sig 25 + module Change_configuration : sig 25 26 val compute : Lsp.Types.DidChangeConfigurationParams.t -> unit 26 27 end 27 28 28 29 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeLens}[textDocument/codeLens]} 29 30 *) 30 - module Code_lens: sig 31 + module Code_lens : sig 31 32 val compute : Lsp.Types.CodeLensParams.t -> 'a list 32 33 end 33 34 34 35 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction}[textDocument/codeAction]} 35 36 *) 36 - module Code_action: sig 37 + module Code_action : sig 37 38 val execute : Lsp.Types.ExecuteCommandParams.t -> Yojson.Safe.t 38 39 val compute : Lsp.Types.CodeActionParams.t -> Lsp.Types.CodeActionResult.t 39 40 end ··· 41 42 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/# 42 43 textDocument_completion}[textDocument/completion]} 43 44 *) 44 - module Completion: sig 45 + module Completion : sig 45 46 val compute : Lsp.Types.CompletionParams.t -> [> `CompletionList of Lsp.Types.CompletionList.t] option 46 47 end 47 48 48 49 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition}[textDocument/definition]} 49 50 *) 50 - module Definitions: sig 51 + module Definitions : sig 51 52 val compute : Lsp.Types.DefinitionParams.t -> Lsp.Types.Locations.t option 52 53 end 53 54 54 55 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didChange}[textDocument/didChange]} 55 56 *) 56 - module Did_change: sig 57 + module Did_change : sig 57 58 val compute : Lsp.Types.DidChangeTextDocumentParams.t -> unit 58 59 end 59 60 60 61 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didOpen}[textDocument/didOpen]} 61 62 *) 62 - module Did_open: sig 63 + module Did_open : sig 63 64 val compute : Lsp.Types.DidOpenTextDocumentParams.t -> unit 64 65 end 65 66 66 67 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentLink}[textDocument/documentLink]} 67 68 *) 68 - module Document_link: sig 69 + module Document_link : sig 69 70 val compute : Lsp.Types.DocumentLinkParams.t -> Lsp.Types.DocumentLink.t list option 70 71 end 71 72 72 73 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol}[textDocument/documentSymbol]} 73 74 *) 74 - module Document_symbols: sig 75 + module Document_symbols : sig 75 76 val compute : Lsp.Types.DocumentSymbolParams.t -> [> `DocumentSymbol of Lsp.Types.DocumentSymbol.t list] option 76 77 end 77 78 78 79 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_highlight}[textDocument/highlight]} 79 80 *) 80 - module Highlight: sig 81 + module Highlight : sig 81 82 val compute : Lsp.Types.DocumentHighlightParams.t -> Lsp.Types.DocumentHighlight.t list option 82 83 end 83 84 84 85 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_hover}[textDocument/hover]} 85 86 *) 86 - module Hover: sig 87 + module Hover : sig 87 88 val compute : Lsp.Types.HoverParams.t -> Lsp.Types.Hover.t option 88 89 end 89 90 90 91 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint}[textDocument/inlayHint]} 91 92 *) 92 - module Inlay_hint: sig 93 + module Inlay_hint : sig 93 94 val compute : Lsp.Types.InlayHintParams.t -> Lsp.Types.InlayHint.t list option 94 95 end 95 96 96 97 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens}[textDocument/semanticTokens]} 97 98 *) 98 - module Semantic_tokens: sig 99 + module Semantic_tokens : sig 99 100 val on_full_request : Lsp.Types.SemanticTokensParams.t -> Lsp.Types.SemanticTokens.t option 100 101 val on_delta_request : Lsp.Types.SemanticTokensDeltaParams.t -> [`SemanticTokens of Lsp.Types.SemanticTokens.t | `SemanticTokensDelta of Lsp.Types.SemanticTokensDelta.t] option 101 102 end 102 103 103 104 (** Reference: {{:https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_symbol}[workspace/symbol]} 104 105 *) 105 - module Workspace_symbols: sig 106 + module Workspace_symbols : sig 106 107 val compute : Lsp.Types.WorkspaceSymbolParams.t -> Lsp.Types.SymbolInformation.t list option 107 108 end 108 109 end ··· 115 116 116 117 val run : init: Lsp_state.state -> (unit -> 'a) -> 'a 117 118 118 - module Request: sig 119 + module Request : sig 119 120 type packed = Lsp.Client_request.packed 120 121 type 'resp t = 'resp Lsp.Client_request.t 121 122 ··· 124 125 val respond : Jsonrpc.Id.t -> 'resp t -> 'resp -> unit 125 126 end 126 127 127 - module Notification: sig 128 + module Notification : sig 128 129 type t = Lsp.Client_notification.t 129 130 130 131 val handle : Jsonrpc.Notification.t -> unit
+2 -2
lib/prelude/BaseN.mli
··· 14 14 val string_of_int : int -> string 15 15 end 16 16 17 - module Make (_: I) : S 18 - module Base36: S 17 + module Make (_ : I) : S 18 + module Base36 : S
+2
lib/prelude/Forester_prelude.ml
··· 4 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 5 *) 6 6 7 + (** Various utility functions.*) 8 + 7 9 include Fun_util 8 10 include Bwd 9 11
+1
lib/prelude/dune
··· 4 4 5 5 (library 6 6 (name Forester_prelude) 7 + (instrumentation (backend bisect_ppx)) 7 8 (libraries 8 9 eio 9 10 eio.unix
+1 -1
lib/xml_names/Xmlns_effect.mli
··· 7 7 open Types 8 8 9 9 module Make () : sig 10 - type xmlns_attr = { prefix: string; xmlns: string } 10 + type xmlns_attr = {prefix: string; xmlns: string} 11 11 val normalise_qname : xml_qname -> xml_qname 12 12 val within_scope : (unit -> 'a) -> xmlns_attr list * 'a 13 13 val find_xmlns_for_prefix : string -> string option
+6
test/Test_LaTeX_pipeline.ml
··· 8 8 open Forester_prelude 9 9 open Forester_compiler 10 10 11 + (* This test runs LaTeX_pipeline.latex_to_svg. This requires a LaTeX 12 + environment. Since the output is (apparently) non-deterministic, we can't 13 + equality check the output, so we just use a try-with to verify that the 14 + function runs with no exceptions. 15 + *) 16 + 11 17 let () = 12 18 let test_pipeline () = 13 19 let@ env = Eio_main.run in
+10 -2
test/Test_compiler.ml
··· 16 16 let@ env = Eio_main.run in 17 17 let config = Config.default in 18 18 let tree_dirs = Eio_util.paths_of_dirs ~env config.trees in 19 + 20 + (* This test verifies that the `reparse` function works correctly.*) 19 21 let test_reparsing () = 20 22 let@ () = Reporter.test_run in 23 + (*First, perform a regular batch compilation run.*) 21 24 let before_forest = 22 25 State_machine.batch_run 23 26 ~env 24 27 ~config 25 28 ~dev: false 26 29 in 30 + (* Get the URI of "reparse.tree". In order to make the test reproducible, 31 + we can't use hardcoded paths, as those may be different in CI and on 32 + different hosts.*) 27 33 let uri = 28 34 before_forest.documents |> Hashtbl.to_seq_keys 29 35 |> Seq.find_map ··· 41 47 before_forest 42 48 |> reparse 43 49 ( 50 + (* Create a Text_document.t with new content.*) 44 51 Lsp.Text_document.make 45 52 ~position_encoding: `UTF16 @@ 46 53 Lsp.Types.DidOpenTextDocumentParams.create ··· 56 63 in 57 64 let module Graphs = (val reparsed_forest.graphs) in 58 65 let import_graph = Graphs.get_rel Query.Edges "imports" in 66 + (* FIXME: *) 59 67 Alcotest.(check string) 60 68 "" 61 69 "" ··· 65 73 (* true *) 66 74 (* (Forest_graph.out_degree import_graph vtx > 0) *) 67 75 in 68 - let test () = 76 + let test_batch_run () = 69 77 let forest = 70 78 let@ () = Reporter.easy_run in 71 79 State_machine.batch_run ~env ~config ~dev: false ··· 81 89 [ 82 90 "pipeline", 83 91 [ 84 - test_case "basic batch run" `Quick test; 92 + test_case "basic batch run" `Quick test_batch_run; 85 93 test_case "reparsing" `Quick test_reparsing 86 94 ] 87 95 ]
+2 -4
test/Test_expansion.ml
··· 5 5 *) 6 6 7 7 open Forester_compiler 8 + open Forester_frontend 8 9 open Testables 9 10 10 11 let () = ··· 18 19 source_path = None; 19 20 (* If tree has no address, exports are not added *) 20 21 addr = Some "test-tree"; 21 - (* Use fully qualified open here, see 22 - https://github.com/mirage/alcotest/issues/414 23 - *) 24 - code = let open Forester_frontend.DSL.Code in 22 + code = let open DSL.Code in 25 23 [ 26 24 def 27 25 ["foo"]
-2
test/Test_parser.ml
··· 11 11 open Prelude 12 12 open Forester_frontend.DSL.Code 13 13 14 - (* Using local open breaks tests, see https://github.com/mirage/alcotest/issues/414*) 15 - 16 14 let test_prim () = 17 15 Alcotest.(check @@ result code diagnostic) 18 16 "same nodes"
+2
test/Testables.ml
··· 37 37 } 38 38 [@@deriving show] 39 39 40 + let message = testable Reporter.Message.pp ( = ) 41 + 40 42 let code = testable Code.pp ( = ) 41 43 let syn = testable Syn.pp ( = ) 42 44 let path = testable Trie.pp_path ( = )
+13 -9
test/dune
··· 12 12 (cram 13 13 (deps 14 14 %{bin:forester} 15 - (glob_files_rec ./forest/*))) 15 + (glob_files_rec ./forest/*) 16 + (glob_files_rec ./cram-forest/*))) 16 17 17 18 (executable 18 19 (name Test_http_server) ··· 35 36 36 37 (tests 37 38 (names 38 - Test_parser 39 + Test_LaTeX_pipeline 39 40 Test_DSL 41 + Test_compiler 42 + Test_config 43 + Test_e2e 44 + Test_errors 40 45 Test_expansion 46 + Test_graph_database 41 47 Test_import_graph 42 - Test_transclusion 43 - Test_errors 44 - Test_e2e 45 - Test_compiler 46 - Test_LaTeX_pipeline 48 + Test_implanting 49 + Test_iri_util 47 50 Test_json_manifest_client 48 51 Test_legacy_xml_client 49 - Test_config 52 + Test_parser 53 + ; Test_transclusion 50 54 ; Test_machine 51 - Test_iri_util) 55 + ) 52 56 (preprocess 53 57 (pps ppx_deriving.show ppx_yojson_conv)) 54 58 (deps
+2 -3
test/forest/forest.toml
··· 1 1 [forest] 2 2 host = "lsp-test" 3 - trees = ["trees" ] # The directories in which your trees are stored 4 - assets = ["assets"] # The directories in which your assets are stored 5 - theme = "theme" # The directory in which your theme is stored 3 + trees = ["trees" ] 4 + theme = "theme" 6 5 home = "index" 7 6 prefixes = ["test"] 8 7 foreign = ["export/foreign.json"]