├── src ├── ocaml │ ├── typer_403 │ │ ├── printf_compat.ml │ │ ├── printf_compat.mli │ │ ├── saved_parts.mli │ │ ├── parser_printer.mli │ │ ├── parser_recover.mli │ │ ├── saved_parts.ml │ │ ├── typing │ │ │ ├── short_paths.mli │ │ │ ├── annot.mli │ │ │ ├── printtyped.mli │ │ │ ├── includeclass.mli │ │ │ └── oprint.mli │ │ ├── parser_explain.ml │ │ ├── parsing │ │ │ ├── printast.mli │ │ │ └── longident.mli │ │ └── tast_helper.ml │ ├── typer_404 │ │ ├── printf_compat.ml │ │ ├── printf_compat.mli │ │ ├── saved_parts.mli │ │ ├── parser_printer.mli │ │ ├── parser_recover.mli │ │ ├── saved_parts.ml │ │ ├── typing │ │ │ ├── short_paths.mli │ │ │ ├── annot.mli │ │ │ ├── printtyped.mli │ │ │ ├── includeclass.mli │ │ │ └── oprint.mli │ │ ├── parser_explain.ml │ │ ├── parsing │ │ │ ├── printast.mli │ │ │ └── longident.mli │ │ └── tast_helper.ml │ ├── typer_405 │ │ ├── printf_compat.ml │ │ ├── printf_compat.mli │ │ ├── typing │ │ │ ├── short_paths.ml │ │ │ ├── short_paths.mli │ │ │ ├── short_paths_graph.ml │ │ │ ├── short_paths_graph.mli │ │ │ ├── annot.mli │ │ │ ├── printtyped.mli │ │ │ └── includeclass.mli │ │ ├── saved_parts.mli │ │ ├── parser_printer.mli │ │ ├── parser_recover.mli │ │ ├── saved_parts.ml │ │ ├── parser_explain.ml │ │ ├── parsing │ │ │ ├── printast.mli │ │ │ └── longident.mli │ │ └── tast_helper.ml │ ├── typer_402 │ │ ├── parsing │ │ │ ├── ast_iterator.ml │ │ │ ├── attr_helper.ml │ │ │ ├── attr_helper.mli │ │ │ ├── ast_iterator.mli │ │ │ ├── builtin_attributes.mli │ │ │ ├── printast.mli │ │ │ ├── longident.mli │ │ │ └── syntaxerr.mli │ │ ├── typing │ │ │ ├── short_paths.ml │ │ │ ├── short_paths.mli │ │ │ ├── tast_mapper.ml │ │ │ ├── tast_mapper.mli │ │ │ ├── short_paths_graph.ml │ │ │ ├── short_paths_graph.mli │ │ │ ├── annot.mli │ │ │ ├── printtyped.mli │ │ │ ├── path.mli │ │ │ ├── includeclass.mli │ │ │ ├── untypeast.mli │ │ │ ├── oprint.mli │ │ │ ├── stypes.mli │ │ │ ├── primitive.mli │ │ │ ├── datarepr.mli │ │ │ └── cmi_format.mli │ │ ├── printf_compat.mli │ │ ├── printf_compat.ml │ │ ├── saved_parts.mli │ │ ├── parser_printer.mli │ │ ├── parser_recover.mli │ │ ├── saved_parts.ml │ │ └── tast_helper.ml │ └── support │ │ ├── clflags.ml │ │ ├── path_aux.ml │ │ ├── clflags.mli │ │ ├── lexer_ident.mli │ │ ├── tbl.mli │ │ └── pparse.mli ├── frontend │ ├── old │ │ ├── old_merlin.mli │ │ └── old_command.mli │ ├── new │ │ └── new_commands.mli │ └── query_commands.mli ├── kernel │ ├── mppx.mli │ ├── mocaml.mli │ ├── mreader_extend.mli │ ├── mpipeline.mli │ ├── msource.mli │ ├── mreader.mli │ ├── mtyper.mli │ └── mppx.ml ├── utils │ ├── bitfield.mli │ ├── local_store.mli │ ├── bitfield.ml │ ├── trace.mli │ ├── sexp.mli │ ├── stat_cache.mli │ ├── local_store.ml │ ├── stat_cache.ml │ └── ppxsetup.mli ├── extend │ ├── .gitignore │ ├── extend_driver.mli │ └── extend_main.mli ├── sturgeon_stub │ └── sturgeon_stub.ml ├── platform │ ├── platform_misc.c │ └── os_ipc.ml ├── sturgeon_null │ └── sturgeon_stub.ml └── analysis │ └── outline.mli ├── orig ├── ocaml_402 │ ├── utils │ │ ├── .ignore │ │ └── tbl.mli │ ├── README.txt │ ├── parsing │ │ ├── longident.mli │ │ ├── printast.mli │ │ ├── parse.mli │ │ ├── syntaxerr.mli │ │ └── asttypes.mli │ └── typing │ │ ├── annot.mli │ │ ├── printtyped.mli │ │ ├── path.mli │ │ ├── includeclass.mli │ │ ├── envaux.mli │ │ ├── oprint.mli │ │ ├── stypes.mli │ │ ├── primitive.mli │ │ ├── datarepr.mli │ │ └── cmi_format.mli ├── ocaml_405 │ ├── parsing │ │ ├── HACKING.adoc │ │ ├── ast_invariants.mli │ │ ├── longident.mli │ │ ├── printast.mli │ │ └── parse.mli │ ├── typing │ │ ├── annot.mli │ │ ├── printtyped.mli │ │ ├── includeclass.mli │ │ ├── envaux.mli │ │ └── oprint.mli │ └── utils │ │ ├── numbers.mli │ │ ├── terminfo.ml │ │ ├── terminfo.mli │ │ └── ccomp.mli ├── ocaml_403 │ ├── parsing │ │ ├── ast_invariants.mli │ │ ├── longident.mli │ │ ├── printast.mli │ │ └── parse.mli │ ├── typing │ │ ├── annot.mli │ │ ├── printtyped.mli │ │ ├── includeclass.mli │ │ ├── envaux.mli │ │ └── oprint.mli │ └── utils │ │ ├── terminfo.ml │ │ ├── terminfo.mli │ │ └── ccomp.mli └── ocaml_404 │ ├── parsing │ ├── ast_invariants.mli │ ├── longident.mli │ ├── printast.mli │ └── parse.mli │ ├── typing │ ├── annot.mli │ ├── printtyped.mli │ ├── includeclass.mli │ ├── envaux.mli │ └── oprint.mli │ └── utils │ ├── numbers.mli │ ├── terminfo.ml │ ├── terminfo.mli │ └── ccomp.mli ├── .gitattributes ├── vim └── merlin │ ├── ftdetect │ └── merlin.vim │ ├── ftplugin │ ├── merlin.vim │ ├── ocaml.vim │ └── omlet.vim │ ├── autoload │ └── neomake │ │ └── ocaml.vim │ ├── syntax │ └── merlin.vim │ ├── plugin │ └── merlin.vim │ └── syntax_checkers │ ├── ocaml │ └── merlin.vim │ └── omlet │ └── merlin.vim ├── preprocessors ├── explain │ ├── Makefile │ └── gen_explain.ml ├── printer │ └── Makefile └── recover │ ├── emitter.mli │ ├── recovery.mli │ ├── recover_attrib.mli │ ├── Makefile │ ├── synthesis.mli │ ├── compressedBitSet.mli │ └── utils.ml ├── .travis.yml ├── .gitignore ├── merlin.install.sh ├── doc ├── next │ ├── merlin.wiki │ └── Protocol.wiki └── dev │ └── SERVER.md ├── appveyor ├── findlib-1.7.3.patch └── easy-format-1.2.0.patch ├── appveyor.yml ├── .merlin ├── LICENSE_MIT.txt └── appveyor.cmd /src/ocaml/typer_403/printf_compat.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/printf_compat.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/printf_compat.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/printf_compat.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/printf_compat.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/printf_compat.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /orig/ocaml_402/utils/.ignore: -------------------------------------------------------------------------------- 1 | config.ml 2 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/ast_iterator.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/attr_helper.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/attr_helper.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/short_paths.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/short_paths.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/tast_mapper.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/tast_mapper.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/typing/short_paths.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/typing/short_paths.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/ast_iterator.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/short_paths_graph.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/short_paths_graph.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/typing/short_paths_graph.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/typing/short_paths_graph.mli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/frontend/old/old_merlin.mli: -------------------------------------------------------------------------------- 1 | val run : string list -> 'a 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | configure eol=lf 2 | *.sh eol=lf 3 | *.patch eol=lf 4 | -------------------------------------------------------------------------------- /vim/merlin/ftdetect/merlin.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead .merlin set ft=merlin 2 | -------------------------------------------------------------------------------- /vim/merlin/ftplugin/merlin.vim: -------------------------------------------------------------------------------- 1 | setlocal commentstring=#\ %s 2 | setlocal comments=:# 3 | -------------------------------------------------------------------------------- /vim/merlin/ftplugin/ocaml.vim: -------------------------------------------------------------------------------- 1 | " Activate merlin on current buffer 2 | call merlin#Register() 3 | -------------------------------------------------------------------------------- /vim/merlin/ftplugin/omlet.vim: -------------------------------------------------------------------------------- 1 | " Activate merlin on current buffer 2 | call merlin#Register() 3 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/printf_compat.mli: -------------------------------------------------------------------------------- 1 | val ikfprintf : ('b -> 'd) -> 'b -> ('a, 'b, 'c, 'd) format4 -> 'a 2 | -------------------------------------------------------------------------------- /src/kernel/mppx.mli: -------------------------------------------------------------------------------- 1 | 2 | val rewrite : Trace.t -> Mconfig.t -> Mreader.parsetree -> 3 | Mconfig.t * Mreader.parsetree 4 | -------------------------------------------------------------------------------- /preprocessors/explain/Makefile: -------------------------------------------------------------------------------- 1 | gen_explain: gen_explain.ml 2 | ocamlfind opt -o $@ -package unix,menhirSdk -linkpkg $^ 3 | 4 | clean: 5 | rm -f gen_explain *.cm* 6 | -------------------------------------------------------------------------------- /preprocessors/printer/Makefile: -------------------------------------------------------------------------------- 1 | gen_printer: gen_printer.ml 2 | ocamlfind opt -o $@ -package unix,menhirSdk -linkpkg $^ 3 | 4 | clean: 5 | rm -f gen_printer *.cm* 6 | -------------------------------------------------------------------------------- /src/utils/bitfield.mli: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | val max_idx: int 4 | val empty: t 5 | val full: t 6 | val set: int -> t -> t 7 | val unset: int -> t -> t 8 | val is_set: t -> int -> bool 9 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/printf_compat.ml: -------------------------------------------------------------------------------- 1 | open CamlinternalFormatBasics 2 | open CamlinternalFormat 3 | 4 | let ikfprintf k oc (Format (fmt, _)) = 5 | make_printf (fun oc _ -> k oc) oc End_of_acc fmt 6 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/saved_parts.mli: -------------------------------------------------------------------------------- 1 | val attribute : string Location.loc 2 | val store : Cmt_format.binary_part list -> Asttypes.constant 3 | val find : Asttypes.constant -> Cmt_format.binary_part list 4 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/saved_parts.mli: -------------------------------------------------------------------------------- 1 | val attribute : string Location.loc 2 | val store : Cmt_format.binary_part list -> Parsetree.constant 3 | val find : Parsetree.constant -> Cmt_format.binary_part list 4 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/saved_parts.mli: -------------------------------------------------------------------------------- 1 | val attribute : string Location.loc 2 | val store : Cmt_format.binary_part list -> Parsetree.constant 3 | val find : Parsetree.constant -> Cmt_format.binary_part list 4 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/saved_parts.mli: -------------------------------------------------------------------------------- 1 | val attribute : string Location.loc 2 | val store : Cmt_format.binary_part list -> Parsetree.constant 3 | val find : Parsetree.constant -> Cmt_format.binary_part list 4 | -------------------------------------------------------------------------------- /vim/merlin/autoload/neomake/ocaml.vim: -------------------------------------------------------------------------------- 1 | function! neomake#makers#ft#ocaml#merlin() 2 | let maker = {} 3 | function! maker.get_list_entries(jobinfo) 4 | return merlin#ErrorLocList() 5 | endfunction 6 | return maker 7 | endfunction 8 | -------------------------------------------------------------------------------- /src/utils/local_store.mli: -------------------------------------------------------------------------------- 1 | type bindings 2 | val new_bindings : unit -> bindings 3 | 4 | val ref : bindings -> (unit -> 'a) -> 'a ref 5 | 6 | type scope 7 | val fresh : bindings -> scope 8 | val merge : scope -> scope -> scope 9 | val with_scope : scope -> (unit -> 'a) -> 'a 10 | -------------------------------------------------------------------------------- /src/extend/.gitignore: -------------------------------------------------------------------------------- 1 | *.annot 2 | *.cmo 3 | *.cma 4 | *.cmi 5 | *.a 6 | *.o 7 | *.cmx 8 | *.cmxs 9 | *.cmxa 10 | 11 | # ocamlbuild working directory 12 | _build/ 13 | 14 | # ocamlbuild targets 15 | *.byte 16 | *.native 17 | 18 | # oasis generated files 19 | setup.data 20 | setup.log 21 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parser_printer.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | val print_symbol : MenhirInterpreter.xsymbol -> string 4 | val print_value : 'a MenhirInterpreter.symbol -> 'a -> string 5 | val print_token : token -> string 6 | val token_of_terminal : 'a MenhirInterpreter.terminal -> 'a -> token 7 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/parser_printer.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | val print_symbol : MenhirInterpreter.xsymbol -> string 4 | val print_value : 'a MenhirInterpreter.symbol -> 'a -> string 5 | val print_token : token -> string 6 | val token_of_terminal : 'a MenhirInterpreter.terminal -> 'a -> token 7 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/parser_printer.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | val print_symbol : MenhirInterpreter.xsymbol -> string 4 | val print_value : 'a MenhirInterpreter.symbol -> 'a -> string 5 | val print_token : token -> string 6 | val token_of_terminal : 'a MenhirInterpreter.terminal -> 'a -> token 7 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/parser_printer.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | val print_symbol : MenhirInterpreter.xsymbol -> string 4 | val print_value : 'a MenhirInterpreter.symbol -> 'a -> string 5 | val print_token : token -> string 6 | val token_of_terminal : 'a MenhirInterpreter.terminal -> 'a -> token 7 | -------------------------------------------------------------------------------- /preprocessors/recover/emitter.mli: -------------------------------------------------------------------------------- 1 | open MenhirSdk.Cmly_api 2 | 3 | module Make 4 | (G : GRAMMAR) 5 | (A : Recover_attrib.S with module G = G) 6 | (S : Synthesis.S with module G = G) 7 | (R : Recovery.S with module G = G) : 8 | sig 9 | val emit : Format.formatter -> unit 10 | end 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: true 3 | install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-opam.sh 4 | script: bash -ex .travis-opam.sh 5 | env: 6 | - OCAML_VERSION=4.02 7 | - OCAML_VERSION=4.03 8 | - OCAML_VERSION=4.04 9 | - OCAML_VERSION=4.05 10 | os: 11 | - linux 12 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/builtin_attributes.mli: -------------------------------------------------------------------------------- 1 | val string_of_payload: Parsetree.payload -> string option 2 | val warning_enter_scope: unit -> unit 3 | val warning_leave_scope: unit -> unit 4 | val warning_attribute: Parsetree.attributes -> unit 5 | val with_warning_attribute: Parsetree.attributes -> (unit -> 'a) -> 'a 6 | -------------------------------------------------------------------------------- /src/frontend/new/new_commands.mli: -------------------------------------------------------------------------------- 1 | open Std 2 | 3 | type command = 4 | Command : string * Marg.docstring * ([`Mandatory|`Optional|`Many] * 'args Marg.spec) list * 'args * 5 | (Mpipeline.t -> 'args -> json) -> command 6 | 7 | val all_commands : command list 8 | 9 | val find_command : string -> command list -> command 10 | -------------------------------------------------------------------------------- /src/utils/bitfield.ml: -------------------------------------------------------------------------------- 1 | type t = int64 2 | 3 | let max_idx = 63 4 | let empty = 0L 5 | let full = -1L 6 | let bit idx = 7 | if idx >= 64 then assert false; 8 | Int64.shift_left 1L idx 9 | let set idx t = Int64.logor t (bit idx) 10 | let unset idx t = Int64.logand t (Int64.lognot (bit idx)) 11 | let is_set t idx = Int64.logand t (bit idx) <> 0L 12 | -------------------------------------------------------------------------------- /vim/merlin/syntax/merlin.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file for editing merlin project files 2 | if exists("b:current_syntax") 3 | finish 4 | endif 5 | 6 | syn keyword merlinKeyword S B SUFFIX PKG REC EXT PRJ FLG CMI CMT 7 | syn match merlinComment "\v#.*$" 8 | 9 | hi link merlinKeyword Keyword 10 | hi link merlinComment Comment 11 | 12 | let b:current_syntax = "merlin" 13 | 14 | -------------------------------------------------------------------------------- /preprocessors/recover/recovery.mli: -------------------------------------------------------------------------------- 1 | open MenhirSdk.Cmly_api 2 | module type S = sig 3 | module G : GRAMMAR 4 | 5 | type item = G.lr1 * G.production * int 6 | type recovery = G.lr1 -> int * (G.lr1 option * item list) list 7 | 8 | val recover : recovery 9 | val report : Format.formatter -> unit 10 | end 11 | 12 | module Make (G : GRAMMAR) (S : Synthesis.S with module G = G) : S with module G = G 13 | -------------------------------------------------------------------------------- /src/extend/extend_driver.mli: -------------------------------------------------------------------------------- 1 | (** Helper for the driver (Merlin) *) 2 | open Extend_protocol 3 | 4 | type t 5 | 6 | exception Extension of string * string * string 7 | 8 | val run : ?notify:(string -> unit) -> ?debug:(string -> unit) -> string -> t 9 | 10 | val stop : t -> unit 11 | 12 | val capabilities : t -> capabilities 13 | 14 | val reader : t -> 15 | Reader.request -> 16 | Reader.response 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile.config 2 | src/config/my_config.ml 3 | src/ocaml/typer 4 | src/sturgeon 5 | emacs/merlin.elc 6 | *.tar.gz 7 | *.pyc 8 | *.o 9 | *.obj 10 | *.cmo 11 | *.cmi 12 | *.cmx 13 | *.cmt 14 | *.cma 15 | *.cm?? 16 | ocamlmerlin 17 | ocamlmerlin.exe 18 | ocamlmerlin-server 19 | ocamlmerlin-server.exe 20 | ocamlmerlin-test 21 | ocamlmerlin-test.exe 22 | config.iss 23 | ._d 24 | ._ncdi 25 | 26 | # Ignore garbage files from editors 27 | *.un~ 28 | *.swp 29 | *.swo 30 | -------------------------------------------------------------------------------- /src/utils/trace.mli: -------------------------------------------------------------------------------- 1 | 2 | (*val set_destination : Sturgeon_stub.cursor -> unit*) 3 | (*val cursor : t -> Sturgeon_stub.cursor*) 4 | 5 | type t 6 | 7 | val null : t 8 | 9 | val is_open : t -> bool 10 | val is_closed : t -> bool 11 | 12 | val start : ?limit:int -> unit -> t 13 | 14 | val enter 15 | : t -> ('a, unit, string, (t -> 'b) -> 'b) format4 -> 16 | return:(unit -> 'b -> string) -> 'a 17 | 18 | val message 19 | : t -> ('a, unit, string, unit) format4 -> 'a 20 | -------------------------------------------------------------------------------- /orig/ocaml_405/parsing/HACKING.adoc: -------------------------------------------------------------------------------- 1 | link:parsetree.mli[Parsetree] and link:asttypes.mli[Asttypes]:: 2 | Parsetree is an Abstract Syntax Tree (AST) representation of OCaml 3 | source code. It is well annotated with examples and is a recommended 4 | read before any further exploration of the compiler. 5 | 6 | link:location.mli[Location]:: This module contains utilities 7 | related to locations and error handling. In particular, it contains 8 | handlers that are used for all the error reporting in the compiler. 9 | 10 | -------------------------------------------------------------------------------- /preprocessors/recover/recover_attrib.mli: -------------------------------------------------------------------------------- 1 | open MenhirSdk 2 | 3 | module type S = sig 4 | module G : Cmly_api.GRAMMAR 5 | 6 | val cost_of_prod : G.production -> float 7 | val penalty_of_item : G.production * int -> float 8 | val cost_of_symbol : G.symbol -> float 9 | 10 | val default_prelude : Format.formatter -> unit 11 | val default_terminal : G.terminal -> string option 12 | val default_nonterminal : G.nonterminal -> string option 13 | end 14 | 15 | module Make (G : Cmly_api.GRAMMAR) : S with module G = G 16 | -------------------------------------------------------------------------------- /preprocessors/recover/Makefile: -------------------------------------------------------------------------------- 1 | OCAMLMAKEFILE = ../../OCamlMakefile 2 | 3 | all: native-code 4 | 5 | OCamlMakefile: 6 | ln -sf ../../$@ $@ 7 | 8 | SOURCES = \ 9 | utils.ml fix.mli fix.ml \ 10 | gSet.ml compressedBitSet.mli compressedBitSet.ml \ 11 | recover_attrib.mli recover_attrib.ml \ 12 | synthesis.mli synthesis.ml \ 13 | emitter.mli emitter.ml \ 14 | recovery.mli recovery.ml \ 15 | main.ml 16 | 17 | RESULT = gen_recover 18 | PACKS = unix,menhirSdk 19 | 20 | -include $(OCAMLMAKEFILE) 21 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parser_recover.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | module Default : sig 4 | val default_loc : Location.t ref 5 | end 6 | 7 | val default_value : 'a MenhirInterpreter.symbol -> 'a 8 | 9 | type action = 10 | | Abort 11 | | R of int 12 | | S : 'a MenhirInterpreter.symbol -> action 13 | | Sub of action list 14 | 15 | type decision = 16 | | Nothing 17 | | One of action list 18 | | Select of (int -> action list) 19 | 20 | val depth : int array 21 | 22 | val can_pop : 'a MenhirInterpreter.terminal -> bool 23 | 24 | val recover : int -> decision 25 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/parser_recover.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | module Default : sig 4 | val default_loc : Location.t ref 5 | end 6 | 7 | val default_value : 'a MenhirInterpreter.symbol -> 'a 8 | 9 | type action = 10 | | Abort 11 | | R of int 12 | | S : 'a MenhirInterpreter.symbol -> action 13 | | Sub of action list 14 | 15 | type decision = 16 | | Nothing 17 | | One of action list 18 | | Select of (int -> action list) 19 | 20 | val depth : int array 21 | 22 | val can_pop : 'a MenhirInterpreter.terminal -> bool 23 | 24 | val recover : int -> decision 25 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/parser_recover.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | module Default : sig 4 | val default_loc : Location.t ref 5 | end 6 | 7 | val default_value : 'a MenhirInterpreter.symbol -> 'a 8 | 9 | type action = 10 | | Abort 11 | | R of int 12 | | S : 'a MenhirInterpreter.symbol -> action 13 | | Sub of action list 14 | 15 | type decision = 16 | | Nothing 17 | | One of action list 18 | | Select of (int -> action list) 19 | 20 | val depth : int array 21 | 22 | val can_pop : 'a MenhirInterpreter.terminal -> bool 23 | 24 | val recover : int -> decision 25 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/parser_recover.mli: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | 3 | module Default : sig 4 | val default_loc : Location.t ref 5 | end 6 | 7 | val default_value : 'a MenhirInterpreter.symbol -> 'a 8 | 9 | type action = 10 | | Abort 11 | | R of int 12 | | S : 'a MenhirInterpreter.symbol -> action 13 | | Sub of action list 14 | 15 | type decision = 16 | | Nothing 17 | | One of action list 18 | | Select of (int -> action list) 19 | 20 | val depth : int array 21 | 22 | val can_pop : 'a MenhirInterpreter.terminal -> bool 23 | 24 | val recover : int -> decision 25 | -------------------------------------------------------------------------------- /orig/ocaml_402/README.txt: -------------------------------------------------------------------------------- 1 | Merlin uses code from OCaml, see [http://caml.inria.fr/](The Caml language: Home). 2 | Files derived from the original OCaml compiler source includes: 3 | - the parsing, typing and utils subdirectories 4 | - chunk_parser.mly, outline_parser.mly, lexer.mll, lexer.mli 5 | - main_args.ml, main_args.mli 6 | 7 | There you can find the original distribution: 8 | http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-4.00.1.tar.gz 9 | 10 | The OCaml compiler is distributed under the QPL licence and is copyright INRIA. 11 | See LICENSE in the current directory. 12 | -------------------------------------------------------------------------------- /merlin.install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ( 3 | printf 'bin: [\n' 4 | printf ' "ocamlmerlin"\n' 5 | printf ' "ocamlmerlin-server"\n' 6 | printf ']\n' 7 | printf '\n' 8 | printf 'share: [\n' 9 | find vim/merlin -type f -a \ 10 | \! \( -name '.*' -o -name '*.pyc' -o -name 'README.md' \) | 11 | sed -e 's%^[^/]*/[^/]*/\(.*\)% "&" { "vim/\1" }%' | sort -u 12 | printf ']\n' 13 | printf 'share_root: [\n' 14 | for i in $(cd emacs/ && echo *.el); do 15 | printf ' "emacs/%s" {"emacs/site-lisp/%s"}\n' "$i" "$i" 16 | printf ' "?emacs/%sc" {"emacs/site-lisp/%sc"}\n' "$i" "$i" 17 | done 18 | printf ']\n' 19 | ) > merlin.install 20 | -------------------------------------------------------------------------------- /vim/merlin/plugin/merlin.vim: -------------------------------------------------------------------------------- 1 | " If the mode didn't work for you, ensure that ocamlmerlin binary can be found 2 | " in PATH. 3 | " Most commands are accessible only from omlet/ocaml buffers, check from an 4 | " appropriate buffer if merlin.vim is effectively loaded. 5 | 6 | " If you are using syntastic and don't want warnings notified, set the following 7 | " variable to "true" 8 | 9 | if !exists('g:merlin') | let g:merlin = {} | endif | let s:c = g:merlin 10 | let g:merlin_ignore_warnings = "false" 11 | 12 | let s:c.merlin_home = expand(':h:h:h:h') 13 | 14 | " Highlight the expression which type is given 15 | hi def link EnclosingExpr IncSearch 16 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/saved_parts.ml: -------------------------------------------------------------------------------- 1 | let attribute = Location.mknoloc "merlin.saved-parts" 2 | 3 | let table = Hashtbl.create 7 4 | 5 | let gensym = 6 | let counter = ref 0 in 7 | fun () -> incr counter; !counter 8 | 9 | let finalize = function 10 | | Asttypes.Const_int id -> 11 | Hashtbl.remove table id; 12 | | _ -> assert false 13 | 14 | let store parts = 15 | let id = gensym () in 16 | let key = Asttypes.Const_int id in 17 | Gc.finalise finalize key; 18 | Hashtbl.add table id parts; 19 | key 20 | 21 | let find = function 22 | | Asttypes.Const_int id -> 23 | begin 24 | try Hashtbl.find table id 25 | with Not_found -> [] 26 | end 27 | | _ -> assert false 28 | -------------------------------------------------------------------------------- /vim/merlin/syntax_checkers/ocaml/merlin.vim: -------------------------------------------------------------------------------- 1 | " Enable Syntastic support 2 | " Make sure syntax_checkers directory is on runtime path, then set 3 | " :let g:syntastic_ocaml_checkers=['merlin'] 4 | 5 | function! SyntaxCheckers_ocaml_merlin_IsAvailable() 6 | if !exists("*merlin#SelectBinary") 7 | return 0 8 | endif 9 | try 10 | let l:path = merlin#SelectBinary() 11 | return executable(l:path) 12 | catch 13 | return 0 14 | endtry 15 | endfunction 16 | 17 | function! SyntaxCheckers_ocaml_merlin_GetLocList() 18 | return merlin#ErrorLocList() 19 | endfunction 20 | 21 | call g:SyntasticRegistry.CreateAndRegisterChecker({ 22 | \ 'filetype': 'ocaml', 23 | \ 'name': 'merlin'}) 24 | -------------------------------------------------------------------------------- /src/utils/sexp.mli: -------------------------------------------------------------------------------- 1 | open Std 2 | 3 | type t = 4 | Cons of t * t 5 | | Sym of string 6 | | String of string 7 | | Int of int 8 | | Float of float 9 | 10 | val nil : t 11 | val of_list : t list -> t 12 | 13 | val tell_sexp : (string -> unit) -> t -> unit 14 | val tell_cons : (string -> unit) -> t -> unit 15 | 16 | val to_buf : t -> Buffer.t -> unit 17 | 18 | val to_string : t -> string 19 | 20 | val of_string : string -> t 21 | 22 | val of_file_descr : 23 | ?on_read:(Unix.file_descr -> unit) -> Unix.file_descr -> unit -> t option 24 | val of_channel : 25 | ?on_read:(Unix.file_descr -> unit) -> in_channel -> unit -> t option 26 | 27 | val of_json : json -> t 28 | val to_json : t -> json 29 | -------------------------------------------------------------------------------- /vim/merlin/syntax_checkers/omlet/merlin.vim: -------------------------------------------------------------------------------- 1 | " Enable Syntastic support for omlet mode 2 | " Make sure syntax_checkers directory is on runtime path, then set 3 | " :let g:syntastic_omlet_checkers=['merlin'] 4 | 5 | function! SyntaxCheckers_omlet_merlin_IsAvailable() 6 | if !exists("*merlin#SelectBinary") 7 | return 0 8 | endif 9 | try 10 | let l:path = merlin#SelectBinary() 11 | return executable(l:path) 12 | catch 13 | return 0 14 | endtry 15 | endfunction 16 | 17 | function! SyntaxCheckers_omlet_merlin_GetLocList() 18 | return merlin#ErrorLocList() 19 | endfunction 20 | 21 | call g:SyntasticRegistry.CreateAndRegisterChecker({ 22 | \ 'filetype': 'omlet', 23 | \ 'name': 'merlin'}) 24 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/saved_parts.ml: -------------------------------------------------------------------------------- 1 | let attribute = Location.mknoloc "merlin.saved-parts" 2 | 3 | module H = Ephemeron.K1.Make(struct 4 | type t = string 5 | let hash = Hashtbl.hash 6 | let equal (a : t) (b : t) = a = b 7 | end) 8 | 9 | let table = H.create 7 10 | 11 | let gensym = 12 | let counter = ref 0 in 13 | fun () -> incr counter; !counter 14 | 15 | let store parts = 16 | let id = string_of_int (gensym ()) in 17 | let key = Parsetree.Pconst_integer (id, None) in 18 | H.add table id parts; 19 | key 20 | 21 | let find = function 22 | | Parsetree.Pconst_integer (id, None) -> 23 | begin 24 | try H.find table id 25 | with Not_found -> [] 26 | end 27 | | _ -> assert false 28 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/saved_parts.ml: -------------------------------------------------------------------------------- 1 | let attribute = Location.mknoloc "merlin.saved-parts" 2 | 3 | module H = Ephemeron.K1.Make(struct 4 | type t = string 5 | let hash = Hashtbl.hash 6 | let equal (a : t) (b : t) = a = b 7 | end) 8 | 9 | let table = H.create 7 10 | 11 | let gensym = 12 | let counter = ref 0 in 13 | fun () -> incr counter; !counter 14 | 15 | let store parts = 16 | let id = string_of_int (gensym ()) in 17 | let key = Parsetree.Pconst_integer (id, None) in 18 | H.add table id parts; 19 | key 20 | 21 | let find = function 22 | | Parsetree.Pconst_integer (id, None) -> 23 | begin 24 | try H.find table id 25 | with Not_found -> [] 26 | end 27 | | _ -> assert false 28 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/saved_parts.ml: -------------------------------------------------------------------------------- 1 | let attribute = Location.mknoloc "merlin.saved-parts" 2 | 3 | module H = Ephemeron.K1.Make(struct 4 | type t = string 5 | let hash = Hashtbl.hash 6 | let equal (a : t) (b : t) = a = b 7 | end) 8 | 9 | let table = H.create 7 10 | 11 | let gensym = 12 | let counter = ref 0 in 13 | fun () -> incr counter; !counter 14 | 15 | let store parts = 16 | let id = string_of_int (gensym ()) in 17 | let key = Parsetree.Pconst_integer (id, None) in 18 | H.add table id parts; 19 | key 20 | 21 | let find = function 22 | | Parsetree.Pconst_integer (id, None) -> 23 | begin 24 | try H.find table id 25 | with Not_found -> [] 26 | end 27 | | _ -> assert false 28 | -------------------------------------------------------------------------------- /src/sturgeon_stub/sturgeon_stub.ml: -------------------------------------------------------------------------------- 1 | open Sturgeon 2 | 3 | type t = Sturgeon_recipes_server.server * Thread.t 4 | 5 | let start f = 6 | (* Run monitor in parallel *) 7 | let server = Sturgeon_recipes_server.text_server "merlin" (fun ~args:_ -> f) in 8 | let monitor = Thread.create Sturgeon_recipes_server.main_loop server in 9 | (server, monitor) 10 | 11 | let stop (server, monitor) = 12 | Sturgeon_recipes_server.stop_server server; 13 | Thread.join monitor 14 | 15 | module Inuit = Inuit 16 | module Cursor = Inuit.Cursor 17 | module Widget = Inuit_widget 18 | 19 | type flag = Stui.flag 20 | type cursor = flag Inuit.cursor 21 | let null = Inuit.Cursor.null 22 | 23 | type shell = Stui.shell 24 | let create_cursor = Stui.create_cursor 25 | -------------------------------------------------------------------------------- /src/kernel/mocaml.mli: -------------------------------------------------------------------------------- 1 | (* Build settings *) 2 | val setup_config : Mconfig.t -> unit 3 | 4 | (* Instance of environment cache & btype unification log *) 5 | type typer_state 6 | 7 | val new_state : unit_name:string -> typer_state 8 | val with_state : typer_state -> (unit -> 'a) -> 'a 9 | val is_current_state : typer_state -> bool 10 | 11 | (* Replace Outcome printer *) 12 | val default_printer : 13 | Format.formatter -> Extend_protocol.Reader.outcometree -> unit 14 | 15 | val with_printer : 16 | (Format.formatter -> Extend_protocol.Reader.outcometree -> unit) -> 17 | (unit -> 'a) -> 'a 18 | 19 | (* Clear caches, remove all items *) 20 | val clear_caches : unit -> unit 21 | 22 | (* Flush caches, remove outdated items *) 23 | val flush_caches : unit -> unit 24 | -------------------------------------------------------------------------------- /src/utils/stat_cache.mli: -------------------------------------------------------------------------------- 1 | type file_id = Unix.stats option 2 | (** An instance of file_id represents the identity of a file contents. 3 | Use this to quickly detect if a file has changed. 4 | (Detection is done by checking some fields from stat syscall, 5 | it an be tricked but should behave well in regular cases. 6 | FIXME: precision of mtime is still the second?! 7 | *) 8 | 9 | val with_cache : (unit -> 'a) -> 'a 10 | 11 | val cached_file_id : string -> file_id 12 | 13 | val file_id_check: file_id -> file_id -> bool 14 | (** Returns true iff the heuristic determines that the file contents has not 15 | changed. *) 16 | 17 | val file_id: string -> file_id 18 | (** [file_id filename] computes an id for the current contents of [filename] *) 19 | 20 | -------------------------------------------------------------------------------- /doc/next/merlin.wiki: -------------------------------------------------------------------------------- 1 | @let-def: this design document gathers requirements and ideas for the next 2 | version of merlin. The purpose is to consolidate features that were added 3 | lately and cleanup legacy crufts. 4 | 5 | == TL;DR == 6 | 7 | * simpler & stateless protocol 8 | * pure implementation for reference 9 | * performance added on top, memoization & asynchronicity 10 | * traceability, log all decisions and print internal structures 11 | * maintenability, minimize change to OCaml codebase 12 | 13 | See [[RATIONALE]]. 14 | 15 | == Implementation == 16 | 17 | Merlin is split in three main components: 18 | 19 | * [[Protocol]], communicates with outside world 20 | * [[Kernel]], wraps the OCaml frontend 21 | * [[Analysis]], answers specific questions on the codebase 22 | -------------------------------------------------------------------------------- /src/platform/platform_misc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* FS case */ 6 | 7 | #ifdef __APPLE__ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | value ml_merlin_fs_exact_case(value path) 14 | { 15 | CAMLparam1(path); 16 | CAMLlocal1(realpath); 17 | char realpath_c[MAXPATHLEN]; 18 | 19 | realpath = path; 20 | 21 | int fd = open(String_val(path), O_EVTONLY | O_SYMLINK); 22 | if (fd != -1) 23 | { 24 | if (fcntl(fd, F_GETPATH, realpath_c) != -1) 25 | { 26 | realpath = caml_copy_string(realpath_c); 27 | } 28 | close(fd); 29 | } 30 | CAMLreturn(realpath); 31 | } 32 | 33 | 34 | #else 35 | 36 | value ml_merlin_fs_exact_case(value path) 37 | { 38 | return path; 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/kernel/mreader_extend.mli: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | val stop : Trace.t -> t -> unit 4 | 5 | val start : Trace.t -> string -> string list -> Msource.t -> t option 6 | 7 | val parse : Trace.t -> ?for_completion:Msource.position -> 8 | t -> 9 | ([`No_labels of bool ] * 10 | [`Implementation of Parsetree.structure | `Interface of Parsetree.signature]) 11 | option 12 | 13 | val reconstruct_identifier : 14 | Trace.t -> Lexing.position -> t -> string Location.loc list option 15 | 16 | val print_pretty : 17 | Trace.t -> Extend_protocol.Reader.pretty_parsetree -> t -> string option 18 | 19 | val print_outcomes : 20 | Trace.t -> Extend_protocol.Reader.outcometree list -> t -> string list option 21 | 22 | val print_outcome : 23 | Trace.t -> Extend_protocol.Reader.outcometree -> t -> string option 24 | 25 | val print : unit -> t -> string 26 | -------------------------------------------------------------------------------- /appveyor/findlib-1.7.3.patch: -------------------------------------------------------------------------------- 1 | diff --git a/configure b/configure 2 | index 34c5115..e801760 100755 3 | --- a/configure 4 | +++ b/configure 5 | @@ -191,7 +191,7 @@ for tool in sed awk ocaml ocamlc uname rm make cat m4 dirname basename; do 6 | fi 7 | done 8 | 9 | -lib_suffix=`ocamlc -config 2>/dev/null|grep '^ext_lib'|sed 's/ext_lib: //'` 10 | +lib_suffix=`ocamlc -config 2>/dev/null|tr -d '\015'|sed -n -e 's/^ext_lib: //p'` 11 | 12 | # Check for Cygwin: 13 | 14 | @@ -225,7 +225,7 @@ use_cygpath=0 15 | # Whether we have to translate Unix paths to/from Windows paths. 16 | 17 | if [ -z "$system" ]; then 18 | - system=`ocamlc -config 2>/dev/null|grep '^system'|sed 's/system: //'` 19 | + system=`ocamlc -config 2>/dev/null|tr -d '\015'|sed -n -e 's/^system: //p'` 20 | # This may be 21 | # - mingw or mingw64 22 | # - win32 23 | -------------------------------------------------------------------------------- /src/extend/extend_main.mli: -------------------------------------------------------------------------------- 1 | open Extend_protocol 2 | 3 | module Description : sig 4 | type t 5 | val make_v0 : name:string -> version:string -> t 6 | end 7 | 8 | module Utils : sig 9 | val notify : string -> unit 10 | val debug : string -> unit 11 | end 12 | 13 | module Reader : sig 14 | type t 15 | val make_v0 : (module Reader.V0) -> t 16 | end 17 | 18 | module Handshake : sig 19 | val magic_number : string 20 | 21 | type versions = { 22 | ast_impl_magic_number : string; 23 | ast_intf_magic_number : string; 24 | cmi_magic_number : string; 25 | cmt_magic_number : string; 26 | } 27 | 28 | val versions : versions 29 | 30 | val negotiate_driver : string -> in_channel -> out_channel -> capabilities 31 | end 32 | 33 | (** The main entry point of an extension. *) 34 | val extension_main : ?reader:Reader.t -> Description.t -> 'a 35 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | platform: 2 | - x64 3 | 4 | clone_depth: 1 5 | 6 | environment: 7 | global: 8 | CYG_ROOT: C:/cygwin 9 | CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/ 10 | CYG_CACHE: C:/cygwin/var/cache/setup 11 | 12 | cache: 13 | # - C:\cygwin\var\cache\setup 14 | - C:\OCaml\4.02 15 | - C:\OCaml\4.03 16 | - C:\OCaml\4.04 17 | - C:\OCaml\4.05 18 | - C:\OCaml\msvs-promote-path 19 | 20 | install: 21 | - '%CYG_ROOT%\bin\bash -lc "date; cygcheck -dc cygwin"' 22 | - '"%CYG_ROOT%\setup-x86.exe" --quiet-mode --no-shortcuts --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages diffutils,patch,make,mingw64-i686-gcc-core,mingw64-x86_64-gcc-core,unzip > NUL' 23 | - '%CYG_ROOT%\bin\bash -lc "date; cygcheck -dc cygwin"' 24 | 25 | build_script: 26 | - call "%APPVEYOR_BUILD_FOLDER%\appveyor.cmd" 27 | -------------------------------------------------------------------------------- /src/kernel/mpipeline.mli: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | val make : Trace.t -> Mconfig.t -> Msource.t -> t 4 | val for_completion : Msource.position -> t -> t 5 | 6 | val get_trace : t -> Trace.t 7 | 8 | val input_config : t -> Mconfig.t 9 | val input_source : t -> Msource.t 10 | 11 | val with_reader : t -> (unit -> 'a) -> 'a 12 | val reader_config : t -> Mconfig.t 13 | val reader_comments : t -> (string * Location.t) list 14 | val reader_parsetree : t -> Mreader.parsetree 15 | val reader_lexer_errors : t -> exn list 16 | val reader_parser_errors : t -> exn list 17 | val reader_no_labels_for_completion : t -> bool 18 | 19 | val ppx_parsetree : t -> Mreader.parsetree 20 | val ppx_errors : t -> exn list 21 | 22 | val final_config : t -> Mconfig.t 23 | 24 | val typer_result : t -> Mtyper.result 25 | val typer_errors : t -> exn list 26 | 27 | val timing_information : t -> (string * float) list 28 | -------------------------------------------------------------------------------- /.merlin: -------------------------------------------------------------------------------- 1 | S src/analysis 2 | S src/config 3 | S src/extend 4 | S src/frontend 5 | S src/frontend/new 6 | S src/frontend/old 7 | S src/frontend/test 8 | S src/kernel 9 | S src/ocaml 10 | S src/ocaml/support 11 | S src/ocaml/typer 12 | S src/ocaml/typer/parsing 13 | S src/ocaml/typer/preprocess 14 | S src/ocaml/typer/typing 15 | S src/ocaml/typer/utils 16 | S src/ocaml_aux 17 | S src/platform 18 | S src/sturgeon 19 | S src/utils 20 | B src/analysis 21 | B src/config 22 | B src/extend 23 | B src/frontend 24 | B src/frontend/new 25 | B src/frontend/old 26 | B src/frontend/test 27 | B src/kernel 28 | B src/ocaml 29 | B src/ocaml/support 30 | B src/ocaml/typer 31 | B src/ocaml/typer/parsing 32 | B src/ocaml/typer/preprocess 33 | B src/ocaml/typer/typing 34 | B src/ocaml/typer/utils 35 | B src/ocaml_aux 36 | B src/platform 37 | B src/sturgeon 38 | B src/utils 39 | B +threads 40 | PKG findlib yojson sturgeon inuit 41 | FLG -short-paths 42 | -------------------------------------------------------------------------------- /src/platform/os_ipc.ml: -------------------------------------------------------------------------------- 1 | type server 2 | type context 3 | 4 | type client = { 5 | context : context; 6 | argv : string array; 7 | } 8 | 9 | (* {1 Server management} 10 | Listen, accept client and close *) 11 | 12 | external server_setup : string -> string -> server option = 13 | "ml_merlin_server_setup" 14 | 15 | external server_accept : server -> timeout:float -> client option = 16 | "ml_merlin_server_accept" 17 | 18 | external server_close : server -> unit = 19 | "ml_merlin_server_close" 20 | 21 | (* {1 Context management (stdin, stdout, stderr)} 22 | Setup and close *) 23 | 24 | external context_setup : context -> unit = 25 | "ml_merlin_context_setup" 26 | 27 | external context_close : context -> return_code:int -> unit = 28 | "ml_merlin_context_close" 29 | 30 | (* {1 Environment management} 31 | Primitive missing from Unix/Sys. *) 32 | 33 | external unsetenv : string -> unit = 34 | "ml_merlin_unsetenv" 35 | -------------------------------------------------------------------------------- /preprocessors/recover/synthesis.mli: -------------------------------------------------------------------------------- 1 | open MenhirSdk.Cmly_api 2 | 3 | module type S = sig 4 | module G : GRAMMAR 5 | 6 | type variable = 7 | | Head of G.lr1 * G.nonterminal 8 | | Tail of G.lr1 * G.production * int 9 | 10 | val variable_to_string : variable -> string 11 | 12 | type 'a paction = 13 | | Abort 14 | | Reduce of G.production 15 | | Shift of G.symbol 16 | | Var of 'a 17 | 18 | val paction_to_string : ('a -> string) -> 'a paction -> string 19 | 20 | type action = variable paction 21 | 22 | val action_to_string : action -> string 23 | 24 | val pred : G.lr1 -> G.lr1 list 25 | 26 | val cost_of : variable -> float 27 | val cost_of_action : action -> float 28 | val cost_of_actions : action list -> float 29 | val solution : variable -> action list 30 | val report : Format.formatter -> unit 31 | end 32 | 33 | module Make (G : GRAMMAR) (A : Recover_attrib.S with module G = G) : S with module G = G 34 | -------------------------------------------------------------------------------- /src/sturgeon_null/sturgeon_stub.ml: -------------------------------------------------------------------------------- 1 | type t = Server 2 | type shell = Shell 3 | 4 | let start _ = Server 5 | let stop Server = () 6 | 7 | type flag = [ `Editable | `Clicked | `Clickable | `Invisible ] 8 | type cursor = Cursor 9 | let null = Cursor 10 | 11 | module Cursor = struct 12 | let text Cursor _ = () 13 | let printf Cursor = Printf.ksprintf ignore 14 | let is_closed Cursor = true 15 | let link Cursor = Printf.ksprintf (fun _ _ -> ()) 16 | let sub Cursor = Cursor 17 | let clear Cursor = () 18 | let rem_flag _ Cursor = Cursor 19 | let clickable Cursor _ = Cursor 20 | end 21 | 22 | module Widget = struct 23 | module Nav = struct 24 | type 'a t = Nav 25 | 26 | type 'a frame = { 27 | title: cursor; 28 | body: cursor; 29 | nav: 'a t; 30 | } 31 | 32 | let push Nav _ _ = () 33 | 34 | let make _ _ = Nav 35 | 36 | let render Nav Cursor = () 37 | end 38 | 39 | end 40 | 41 | let create_cursor Shell ~name = Cursor 42 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/typing/short_paths.mli: -------------------------------------------------------------------------------- 1 | 2 | module Desc = Short_paths_graph.Desc 3 | 4 | module Basis : sig 5 | 6 | type t 7 | 8 | val create : unit -> t 9 | 10 | val add : t -> string -> unit 11 | 12 | val load : t -> string -> string list -> string list -> Desc.Module.t -> unit 13 | 14 | end 15 | 16 | type t 17 | 18 | val initial : Basis.t -> t 19 | 20 | val add : t -> Desc.t list Lazy.t -> t 21 | 22 | type type_result = 23 | | Nth of int 24 | | Path of int list option * Path.t 25 | 26 | val find_type : t -> Path.t -> type_result 27 | 28 | type type_resolution = 29 | | Nth of int 30 | | Subst of int list 31 | | Id 32 | 33 | val find_type_resolution : t -> Path.t -> type_resolution 34 | 35 | val find_type_simple : t -> Path.t -> Path.t 36 | 37 | type class_type_result = int list option * Path.t 38 | 39 | val find_class_type : t -> Path.t -> class_type_result 40 | 41 | val find_class_type_simple : t -> Path.t -> Path.t 42 | 43 | val find_module_type : t -> Path.t -> Path.t 44 | 45 | val find_module : t -> Path.t -> Path.t 46 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/typing/short_paths.mli: -------------------------------------------------------------------------------- 1 | 2 | module Desc = Short_paths_graph.Desc 3 | 4 | module Basis : sig 5 | 6 | type t 7 | 8 | val create : unit -> t 9 | 10 | val add : t -> string -> unit 11 | 12 | val load : t -> string -> string list -> string list -> Desc.Module.t -> unit 13 | 14 | end 15 | 16 | type t 17 | 18 | val initial : Basis.t -> t 19 | 20 | val add : t -> Desc.t list Lazy.t -> t 21 | 22 | type type_result = 23 | | Nth of int 24 | | Path of int list option * Path.t 25 | 26 | val find_type : t -> Path.t -> type_result 27 | 28 | type type_resolution = 29 | | Nth of int 30 | | Subst of int list 31 | | Id 32 | 33 | val find_type_resolution : t -> Path.t -> type_resolution 34 | 35 | val find_type_simple : t -> Path.t -> Path.t 36 | 37 | type class_type_result = int list option * Path.t 38 | 39 | val find_class_type : t -> Path.t -> class_type_result 40 | 41 | val find_class_type_simple : t -> Path.t -> Path.t 42 | 43 | val find_module_type : t -> Path.t -> Path.t 44 | 45 | val find_module : t -> Path.t -> Path.t 46 | -------------------------------------------------------------------------------- /src/ocaml/support/clflags.ml: -------------------------------------------------------------------------------- 1 | (** {0 OCaml compiler compatible command-line parameters} *) 2 | 3 | let include_dirs = ref [] 4 | let fast = ref false 5 | let classic = ref false 6 | let principal = ref false 7 | let real_paths = ref true 8 | let recursive_types = ref false 9 | let strict_sequence = ref false 10 | let applicative_functors = ref true 11 | let unsafe_string = ref true 12 | let nopervasives = ref false 13 | let strict_formats = ref false 14 | let open_modules = ref [] 15 | 16 | let annotations = ref false 17 | let binary_annotations = ref true 18 | let print_types = ref false 19 | let native_code = ref false 20 | let error_size = ref 500 21 | let dont_write_files = ref true 22 | let keep_locs = ref true 23 | let keep_docs = ref false 24 | let transparent_modules = ref true 25 | let for_package = ref None 26 | let debug = ref false 27 | let opaque = ref false 28 | let unboxed_types = ref false 29 | -------------------------------------------------------------------------------- /preprocessors/recover/compressedBitSet.mli: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (* *) 3 | (* Menhir *) 4 | (* *) 5 | (* François Pottier, Inria Paris *) 6 | (* Yann Régis-Gianas, PPS, Université Paris Diderot *) 7 | (* *) 8 | (* Copyright Inria. All rights reserved. This file is distributed under the *) 9 | (* terms of the GNU General Public License version 2, as described in the *) 10 | (* file LICENSE. *) 11 | (* *) 12 | (******************************************************************************) 13 | 14 | include GSet.S with type element = int 15 | -------------------------------------------------------------------------------- /orig/ocaml_402/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Long identifiers, used in parsetree. *) 14 | 15 | type t = 16 | Lident of string 17 | | Ldot of t * string 18 | | Lapply of t * t 19 | 20 | val flatten: t -> string list 21 | val last: t -> string 22 | val parse: string -> t 23 | -------------------------------------------------------------------------------- /appveyor/easy-format-1.2.0.patch: -------------------------------------------------------------------------------- 1 | diff -Naur a/Makefile b/Makefile 2 | --- a/Makefile 2015-12-07 21:58:29.000000000 +0000 3 | +++ b/Makefile 2017-07-21 14:19:28.720009800 +0100 4 | @@ -3,6 +3,7 @@ 5 | 6 | NATDYNLINK := $(shell if [ -f `ocamlfind ocamlc -where`/dynlink.cmxa ]; \ 7 | then echo YES; else echo NO; fi) 8 | +EXT_OBJ = $(shell ocamlc -config | sed -ne "s/ext_obj: //p" | tr -d '\r') 9 | 10 | ifeq "${NATDYNLINK}" "YES" 11 | CMXS=easy_format.cmxs 12 | @@ -53,7 +54,7 @@ 13 | caml2html easy_format_example.ml -t -o easy_format_example.html 14 | 15 | soft-clean: 16 | - rm -f *.cm[iox] *.cmxs *.o *.annot \ 17 | + rm -f *.cm[iox] *.cmxs *.o *.obj *.annot \ 18 | test_easy_format lambda_example simple_example \ 19 | bytecode nativecode 20 | 21 | @@ -65,7 +66,7 @@ 22 | 23 | COMMON_INSTALL_FILES = META easy_format.cmi easy_format.mli 24 | BC_INSTALL_FILES = easy_format.cmo 25 | -NC_INSTALL_FILES = easy_format.cmx easy_format.o $(CMXS) 26 | +NC_INSTALL_FILES = easy_format.cmx easy_format$(EXT_OBJ) $(CMXS) 27 | 28 | install: 29 | echo "version = \"$(VERSION)\"" > META; cat META.tpl >> META 30 | -------------------------------------------------------------------------------- /doc/next/Protocol.wiki: -------------------------------------------------------------------------------- 1 | Next merlin protocol should be stateless. 2 | Also worth taking a look: [[https://github.com/Microsoft/language-server-protocol|Microsoft/language-server-protocol]]. 3 | 4 | The protocol is still implemented as a serie of request/answer. 5 | 6 | {{{ 7 | request-format: 8 | { 9 | uri: "path to current document", 10 | source: "full source text", 11 | setup: merlin-setup, 12 | query: merlin-query, 13 | configuration: { 14 | terminal_width: int, 15 | verbosity: int, 16 | }, 17 | } 18 | 19 | answer-format: 20 | { 21 | class: "return" | "failure" | "error" | "exception", 22 | value: , 23 | notifications: string list 24 | } 25 | 26 | merlin-query: 27 | ... 28 | 29 | merlin-setup: 30 | { 31 | build_path: string list, 32 | source_path: string list, 33 | cmi_path: string list, 34 | cmt_path: string list, 35 | findlib: string, 36 | stdlib: string, 37 | packages: string list, 38 | flags: string list, 39 | reader: string list, 40 | suffixes: (string * string) list 41 | } 42 | }}} 43 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Data types for annotations (Stypes.ml) *) 14 | 15 | type call = Tail | Stack | Inline;; 16 | 17 | type ident = 18 | | Iref_internal of Location.t (* defining occurrence *) 19 | | Iref_external 20 | | Idef of Location.t (* scope *) 21 | ;; 22 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Data types for annotations (Stypes.ml) *) 14 | 15 | type call = Tail | Stack | Inline;; 16 | 17 | type ident = 18 | | Iref_internal of Location.t (* defining occurrence *) 19 | | Iref_external 20 | | Idef of Location.t (* scope *) 21 | ;; 22 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | open Typedtree;; 14 | open Format;; 15 | 16 | val interface : formatter -> signature -> unit;; 17 | val implementation : formatter -> structure -> unit;; 18 | 19 | val implementation_with_coercion : 20 | formatter -> (structure * module_coercion) -> unit;; 21 | -------------------------------------------------------------------------------- /src/utils/local_store.ml: -------------------------------------------------------------------------------- 1 | open Std 2 | 3 | type ref_and_reset = F : 'a ref * (unit -> 'a) -> ref_and_reset 4 | type bindings = { mutable refs: ref_and_reset list } 5 | 6 | let new_bindings () = 7 | { refs = [] } 8 | 9 | let ref t f = 10 | let result = ref (f ()) in 11 | t.refs <- (F (result, f)) :: t.refs; 12 | result 13 | 14 | type 'a slot = { ref : 'a ref; mutable value : 'a } 15 | type a_slot = Slot : 'a slot -> a_slot 16 | type scope = a_slot list 17 | 18 | let fresh t = 19 | List.map ~f:(fun (F(ref,f)) -> Slot {ref; value = f ()}) t.refs 20 | 21 | let merge = (@) 22 | 23 | type ref_and_value = V : 'a ref * 'a -> ref_and_value 24 | let restore l = List.iter ~f:(fun (V(r,v)) -> r := v) l 25 | 26 | let with_scope scope f = 27 | let backup = List.rev_map ~f:(fun (Slot {ref;_}) -> V (ref,!ref)) scope in 28 | List.iter (fun (Slot {ref;value}) -> ref := value) scope; 29 | match f () with 30 | | x -> 31 | List.iter (fun (Slot s) -> s.value <- !(s.ref)) scope; 32 | restore backup; 33 | x 34 | | exception exn -> 35 | List.iter (fun (Slot s) -> s.value <- !(s.ref)) scope; 36 | restore backup; 37 | reraise exn 38 | -------------------------------------------------------------------------------- /LICENSE_MIT.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Frédéric Bour, Thomas Refis and Simon Castellan. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /orig/ocaml_403/parsing/ast_invariants.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2015 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | 15 | (** Check AST invariants *) 16 | 17 | val structure : Parsetree.structure -> unit 18 | val signature : Parsetree.signature -> unit 19 | -------------------------------------------------------------------------------- /orig/ocaml_404/parsing/ast_invariants.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2015 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | 15 | (** Check AST invariants *) 16 | 17 | val structure : Parsetree.structure -> unit 18 | val signature : Parsetree.signature -> unit 19 | -------------------------------------------------------------------------------- /orig/ocaml_405/parsing/ast_invariants.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2015 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | 15 | (** Check AST invariants *) 16 | 17 | val structure : Parsetree.structure -> unit 18 | val signature : Parsetree.signature -> unit 19 | -------------------------------------------------------------------------------- /src/kernel/msource.mli: -------------------------------------------------------------------------------- 1 | (** {0 Merlin representation of a textual source code} 2 | 3 | It bundles filename and a content, and offers functions for computing 4 | positions in the source. 5 | *) 6 | type t 7 | 8 | (** Making a content from name and contents. *) 9 | val make : Trace.t -> Mconfig.t -> string -> t 10 | 11 | (** {1 Position management} *) 12 | 13 | type position = [ 14 | | `Start 15 | | `Offset of int 16 | | `Logical of int * int 17 | | `End 18 | ] 19 | 20 | val get_offset : Trace.t -> t -> [< position] -> [> `Offset of int] 21 | 22 | val get_logical : Trace.t -> t -> [< position] -> [> `Logical of int * int] 23 | 24 | val get_lexing_pos : Trace.t -> t -> [< position] -> Lexing.position 25 | 26 | (** Updating content *) 27 | val substitute : Trace.t -> t -> [< position] -> [< position | `Length of int] -> string -> t 28 | 29 | (** {1 Accessing contents} *) 30 | 31 | (** Raw filename *) 32 | val filename : t -> string 33 | 34 | (** Unit (ML module) name *) 35 | val unitname : t -> string 36 | 37 | (** Source code of the file *) 38 | val text : t -> string 39 | 40 | (** {1 Dump} *) 41 | 42 | val dump : t -> Std.json 43 | 44 | val print_position : unit -> [< position] -> string 45 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | open Typedtree;; 14 | open Format;; 15 | 16 | val interface : formatter -> signature -> unit;; 17 | val implementation : formatter -> structure -> unit;; 18 | 19 | val implementation_with_coercion : 20 | formatter -> (structure * module_coercion) -> unit;; 21 | 22 | (* Added by merlin for debugging purposes *) 23 | val pattern : int -> formatter -> pattern -> unit 24 | -------------------------------------------------------------------------------- /src/ocaml/support/path_aux.ml: -------------------------------------------------------------------------------- 1 | let to_string_list p = 2 | let rec aux acc = function 3 | | Path.Pident id -> id.Ident.name :: acc 4 | | Path.Pdot (p, str, _) -> aux (str :: acc) p 5 | | _ -> assert false 6 | in 7 | aux [] p 8 | 9 | module Ord = struct 10 | type t = Path.t 11 | let rec compare p1 p2 = 12 | (* must ignore position when comparing paths *) 13 | if p1 == p2 then 0 else 14 | match (p1, p2) with 15 | (Path.Pdot(p1, s1, pos1), Path.Pdot(p2, s2, pos2)) -> 16 | let c = compare p1 p2 in 17 | if c <> 0 then c else String.compare s1 s2 18 | | (Path.Papply(fun1, arg1), Path.Papply(fun2, arg2)) -> 19 | let c = compare fun1 fun2 in 20 | if c <> 0 then c else compare arg1 arg2 21 | | _ -> Pervasives.compare p1 p2 22 | 23 | let equal p1 p2 = compare p1 p2 = 0 24 | 25 | let rec hash = function 26 | | Path.Pident id -> Hashtbl.hash id 27 | | Path.Pdot (p, s, _) -> 28 | let h = hash p in 29 | Hashtbl.seeded_hash h (Hashtbl.hash s) 30 | | Path.Papply (p1, p2) -> 31 | let h1 = hash p1 and h2 = hash p2 in 32 | Hashtbl.seeded_hash h1 h2 33 | end 34 | 35 | module Map = Map.Make (Ord) 36 | module Set = Set.Make (Ord) 37 | module Tbl = Hashtbl.Make (Ord) 38 | -------------------------------------------------------------------------------- /src/utils/stat_cache.ml: -------------------------------------------------------------------------------- 1 | type file_id = Unix.stats option 2 | (** An instance of file_id represents the identity of a file contents. 3 | Use this to quickly detect if a file has changed. 4 | (Detection is done by checking some fields from stat syscall, 5 | it an be tricked but should behave well in regular cases. 6 | FIXME: precision of mtime is still the second?! 7 | *) 8 | 9 | let cache = ref None 10 | 11 | let with_cache k = 12 | Std.let_ref cache (Some (Hashtbl.create 7)) k 13 | 14 | let file_id filename = 15 | try Some (Unix.stat filename) 16 | with _ -> None 17 | 18 | let file_id_check a b = 19 | let open Unix in 20 | match a, b with 21 | | None, None -> true 22 | | Some a, Some b -> 23 | a.st_mtime = b.st_mtime && 24 | a.st_size = b.st_size && 25 | a.st_ino = b.st_ino && 26 | a.st_dev = b.st_dev 27 | | Some _, None | None, Some _ -> false 28 | 29 | let cached_file_id filename = 30 | match !cache with 31 | | None -> file_id filename 32 | | Some table -> 33 | match Hashtbl.find table filename with 34 | | stats -> 35 | Logger.log "dir_cache" "reuse cache" filename; 36 | stats 37 | | exception Not_found -> 38 | let stats = file_id filename in 39 | Hashtbl.add table filename stats; 40 | stats 41 | -------------------------------------------------------------------------------- /orig/ocaml_402/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | open Parsetree;; 14 | open Format;; 15 | 16 | val interface : formatter -> signature_item list -> unit;; 17 | val implementation : formatter -> structure_item list -> unit;; 18 | val top_phrase : formatter -> toplevel_phrase -> unit;; 19 | 20 | val expression: int -> formatter -> expression -> unit 21 | val structure: int -> formatter -> structure -> unit 22 | val payload: int -> formatter -> payload -> unit 23 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/path.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Access paths *) 14 | 15 | type t = 16 | Pident of Ident.t 17 | | Pdot of t * string * int 18 | | Papply of t * t 19 | 20 | val same: t -> t -> bool 21 | val isfree: Ident.t -> t -> bool 22 | val binding_time: t -> int 23 | 24 | val nopos: int 25 | 26 | val name: ?paren:(string -> bool) -> t -> string 27 | (* [paren] tells whether a path suffix needs parentheses *) 28 | val head: t -> Ident.t 29 | 30 | val last: t -> string 31 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/path.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Access paths *) 14 | 15 | type t = 16 | Pident of Ident.t 17 | | Pdot of t * string * int 18 | | Papply of t * t 19 | 20 | val same: t -> t -> bool 21 | val isfree: Ident.t -> t -> bool 22 | val binding_time: t -> int 23 | 24 | val nopos: int 25 | 26 | val name: ?paren:(string -> bool) -> t -> string 27 | (* [paren] tells whether a path suffix needs parentheses *) 28 | val head: t -> Ident.t 29 | 30 | val last: t -> string 31 | -------------------------------------------------------------------------------- /orig/ocaml_402/parsing/parse.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Entry points in the parser *) 14 | 15 | val implementation : Lexing.lexbuf -> Parsetree.structure 16 | val interface : Lexing.lexbuf -> Parsetree.signature 17 | val toplevel_phrase : Lexing.lexbuf -> Parsetree.toplevel_phrase 18 | val use_file : Lexing.lexbuf -> Parsetree.toplevel_phrase list 19 | val core_type : Lexing.lexbuf -> Parsetree.core_type 20 | val expression : Lexing.lexbuf -> Parsetree.expression 21 | val pattern : Lexing.lexbuf -> Parsetree.pattern 22 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | open Parsetree;; 14 | open Format;; 15 | 16 | val interface : formatter -> signature_item list -> unit;; 17 | val implementation : formatter -> structure_item list -> unit;; 18 | val top_phrase : formatter -> toplevel_phrase -> unit;; 19 | 20 | val expression: int -> formatter -> expression -> unit 21 | val structure: int -> formatter -> structure -> unit 22 | val payload: int -> formatter -> payload -> unit 23 | 24 | val pattern : int -> formatter -> pattern -> unit 25 | -------------------------------------------------------------------------------- /orig/ocaml_403/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Long identifiers, used in parsetree. *) 17 | 18 | type t = 19 | Lident of string 20 | | Ldot of t * string 21 | | Lapply of t * t 22 | 23 | val flatten: t -> string list 24 | val last: t -> string 25 | val parse: string -> t 26 | -------------------------------------------------------------------------------- /orig/ocaml_404/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (** Long identifiers, used in parsetree. *) 17 | 18 | type t = 19 | Lident of string 20 | | Ldot of t * string 21 | | Lapply of t * t 22 | 23 | val flatten: t -> string list 24 | val last: t -> string 25 | val parse: string -> t 26 | -------------------------------------------------------------------------------- /orig/ocaml_405/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (** Long identifiers, used in parsetree. *) 17 | 18 | type t = 19 | Lident of string 20 | | Ldot of t * string 21 | | Lapply of t * t 22 | 23 | val flatten: t -> string list 24 | val last: t -> string 25 | val parse: string -> t 26 | -------------------------------------------------------------------------------- /src/kernel/mreader.mli: -------------------------------------------------------------------------------- 1 | type parsetree = [ 2 | | `Interface of Parsetree.signature 3 | | `Implementation of Parsetree.structure 4 | ] 5 | 6 | type comment = (string * Location.t) 7 | 8 | type result = { 9 | config : Mconfig.t; 10 | lexer_errors : exn list; 11 | parser_errors : exn list; 12 | comments : comment list; 13 | parsetree : parsetree; 14 | no_labels_for_completion : bool; 15 | } 16 | 17 | type pretty_parsetree = Extend_protocol.Reader.pretty_parsetree 18 | type outcometree = Extend_protocol.Reader.outcometree 19 | 20 | (* Ambient reader. 21 | 22 | Some actions need to interact with an external process. 23 | `with_ambient_reader' will setup this process to speed up later calls. 24 | *) 25 | 26 | val with_ambient_reader : Trace.t -> Mconfig.t -> Msource.t -> (unit -> 'a) -> 'a 27 | 28 | (* Main functions *) 29 | 30 | val parse : Trace.t -> 31 | ?for_completion:Msource.position -> Mconfig.t -> Msource.t -> result 32 | 33 | val print_pretty : Trace.t -> 34 | Mconfig.t -> Msource.t -> pretty_parsetree -> string 35 | 36 | val print_outcome : Trace.t -> 37 | Mconfig.t -> Msource.t -> outcometree -> string 38 | 39 | val print_batch_outcome : Trace.t -> 40 | Mconfig.t -> Msource.t -> outcometree list -> string list 41 | 42 | val reconstruct_identifier: Trace.t -> 43 | Mconfig.t -> Msource.t -> Lexing.position -> string Location.loc list 44 | 45 | -------------------------------------------------------------------------------- /orig/ocaml_403/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Data types for annotations (Stypes.ml) *) 17 | 18 | type call = Tail | Stack | Inline;; 19 | 20 | type ident = 21 | | Iref_internal of Location.t (* defining occurrence *) 22 | | Iref_external 23 | | Idef of Location.t (* scope *) 24 | ;; 25 | -------------------------------------------------------------------------------- /orig/ocaml_404/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Data types for annotations (Stypes.ml) *) 17 | 18 | type call = Tail | Stack | Inline;; 19 | 20 | type ident = 21 | | Iref_internal of Location.t (* defining occurrence *) 22 | | Iref_external 23 | | Idef of Location.t (* scope *) 24 | ;; 25 | -------------------------------------------------------------------------------- /orig/ocaml_405/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Data types for annotations (Stypes.ml) *) 17 | 18 | type call = Tail | Stack | Inline;; 19 | 20 | type ident = 21 | | Iref_internal of Location.t (* defining occurrence *) 22 | | Iref_external 23 | | Idef of Location.t (* scope *) 24 | ;; 25 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Data types for annotations (Stypes.ml) *) 17 | 18 | type call = Tail | Stack | Inline;; 19 | 20 | type ident = 21 | | Iref_internal of Location.t (* defining occurrence *) 22 | | Iref_external 23 | | Idef of Location.t (* scope *) 24 | ;; 25 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Data types for annotations (Stypes.ml) *) 17 | 18 | type call = Tail | Stack | Inline;; 19 | 20 | type ident = 21 | | Iref_internal of Location.t (* defining occurrence *) 22 | | Iref_external 23 | | Idef of Location.t (* scope *) 24 | ;; 25 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/typing/annot.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Gallium, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Data types for annotations (Stypes.ml) *) 17 | 18 | type call = Tail | Stack | Inline;; 19 | 20 | type ident = 21 | | Iref_internal of Location.t (* defining occurrence *) 22 | | Iref_external 23 | | Idef of Location.t (* scope *) 24 | ;; 25 | -------------------------------------------------------------------------------- /orig/ocaml_403/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Typedtree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature -> unit;; 20 | val implementation : formatter -> structure -> unit;; 21 | 22 | val implementation_with_coercion : 23 | formatter -> (structure * module_coercion) -> unit;; 24 | -------------------------------------------------------------------------------- /orig/ocaml_404/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Typedtree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature -> unit;; 20 | val implementation : formatter -> structure -> unit;; 21 | 22 | val implementation_with_coercion : 23 | formatter -> (structure * module_coercion) -> unit;; 24 | -------------------------------------------------------------------------------- /orig/ocaml_405/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Typedtree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature -> unit;; 20 | val implementation : formatter -> structure -> unit;; 21 | 22 | val implementation_with_coercion : 23 | formatter -> (structure * module_coercion) -> unit;; 24 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Inclusion checks for the class language *) 14 | 15 | open Types 16 | open Ctype 17 | open Format 18 | 19 | val class_types: 20 | Env.t -> class_type -> class_type -> class_match_failure list 21 | val class_type_declarations: 22 | Env.t -> class_type_declaration -> class_type_declaration -> 23 | class_match_failure list 24 | val class_declarations: 25 | Env.t -> class_declaration -> class_declaration -> 26 | class_match_failure list 27 | 28 | val report_error: formatter -> class_match_failure list -> unit 29 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Long identifiers, used in parsetree. *) 14 | 15 | type t = 16 | Lident of string 17 | | Ldot of t * string 18 | | Lapply of t * t 19 | 20 | val flatten: t -> string list 21 | val last: t -> string 22 | val parse: string -> t 23 | 24 | (* Merlin specific. *) 25 | 26 | val keep_suffix : t -> t * bool 27 | (** if [li', b = keep_suffix li] then: 28 | - the prefix of [li'] is a module path 29 | - [b = false] iff [li' = li]. 30 | Corollary: [b = true] if [li] is a label access 31 | (i.e. [li = X.Y.z.Foo.Bar...]) *) 32 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Inclusion checks for the class language *) 14 | 15 | open Types 16 | open Ctype 17 | open Format 18 | 19 | val class_types: 20 | Env.t -> class_type -> class_type -> class_match_failure list 21 | val class_type_declarations: 22 | Env.t -> class_type_declaration -> class_type_declaration -> 23 | class_match_failure list 24 | val class_declarations: 25 | Env.t -> class_declaration -> class_declaration -> 26 | class_match_failure list 27 | 28 | val report_error: formatter -> class_match_failure list -> unit 29 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/parser_explain.ml: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | let named_item_at = function 3 | | _ -> raise Not_found 4 | 5 | let nullable (type a) : a MenhirInterpreter.nonterminal -> bool = 6 | let open MenhirInterpreter in function 7 | | N_virtual_flag -> true 8 | | N_type_variance -> true 9 | | N_type_parameters -> true 10 | | N_type_kind -> true 11 | | N_structure_tail -> true 12 | | N_structure -> true 13 | | N_signature -> true 14 | | N_rec_flag -> true 15 | | N_private_virtual_flags -> true 16 | | N_private_flag -> true 17 | | N_post_item_attributes -> true 18 | | N_payload -> true 19 | | N_parent_binder -> true 20 | | N_override_flag -> true 21 | | N_optional_type_parameters -> true 22 | | N_opt_type_constraint -> true 23 | | N_opt_semi -> true 24 | | N_opt_pattern_type_constraint -> true 25 | | N_opt_default -> true 26 | | N_opt_bar -> true 27 | | N_opt_ampersand -> true 28 | | N_nonrec_flag -> true 29 | | N_mutable_flag -> true 30 | | N_module_type_declaration_body -> true 31 | | N_generalized_constructor_arguments -> true 32 | | N_ext_attributes -> true 33 | | N_constraints -> true 34 | | N_class_type_parameters -> true 35 | | N_class_structure -> true 36 | | N_class_sig_fields -> true 37 | | N_class_sig_body -> true 38 | | N_class_self_type -> true 39 | | N_class_self_pattern -> true 40 | | N_class_fields -> true 41 | | N_attributes -> true 42 | | _ -> false 43 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/parser_explain.ml: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | let named_item_at = function 3 | | _ -> raise Not_found 4 | 5 | let nullable (type a) : a MenhirInterpreter.nonterminal -> bool = 6 | let open MenhirInterpreter in function 7 | | N_virtual_flag -> true 8 | | N_type_variance -> true 9 | | N_type_parameters -> true 10 | | N_type_kind -> true 11 | | N_structure_tail -> true 12 | | N_structure -> true 13 | | N_signature -> true 14 | | N_rec_flag -> true 15 | | N_private_virtual_flags -> true 16 | | N_private_flag -> true 17 | | N_post_item_attributes -> true 18 | | N_payload -> true 19 | | N_parent_binder -> true 20 | | N_override_flag -> true 21 | | N_optional_type_parameters -> true 22 | | N_opt_type_constraint -> true 23 | | N_opt_semi -> true 24 | | N_opt_pattern_type_constraint -> true 25 | | N_opt_default -> true 26 | | N_opt_bar -> true 27 | | N_opt_ampersand -> true 28 | | N_nonrec_flag -> true 29 | | N_mutable_flag -> true 30 | | N_module_type_declaration_body -> true 31 | | N_generalized_constructor_arguments -> true 32 | | N_ext_attributes -> true 33 | | N_constraints -> true 34 | | N_class_type_parameters -> true 35 | | N_class_structure -> true 36 | | N_class_sig_fields -> true 37 | | N_class_sig_body -> true 38 | | N_class_self_type -> true 39 | | N_class_self_pattern -> true 40 | | N_class_fields -> true 41 | | N_attributes -> true 42 | | _ -> false 43 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/parser_explain.ml: -------------------------------------------------------------------------------- 1 | open Parser_raw 2 | let named_item_at = function 3 | | _ -> raise Not_found 4 | 5 | let nullable (type a) : a MenhirInterpreter.nonterminal -> bool = 6 | let open MenhirInterpreter in function 7 | | N_virtual_flag -> true 8 | | N_type_variance -> true 9 | | N_type_parameters -> true 10 | | N_type_kind -> true 11 | | N_structure_tail -> true 12 | | N_structure -> true 13 | | N_signature -> true 14 | | N_rec_flag -> true 15 | | N_private_virtual_flags -> true 16 | | N_private_flag -> true 17 | | N_post_item_attributes -> true 18 | | N_payload -> true 19 | | N_parent_binder -> true 20 | | N_override_flag -> true 21 | | N_optional_type_parameters -> true 22 | | N_opt_type_constraint -> true 23 | | N_opt_semi -> true 24 | | N_opt_pattern_type_constraint -> true 25 | | N_opt_default -> true 26 | | N_opt_bar -> true 27 | | N_opt_ampersand -> true 28 | | N_nonrec_flag -> true 29 | | N_mutable_flag -> true 30 | | N_module_type_declaration_body -> true 31 | | N_generalized_constructor_arguments -> true 32 | | N_ext_attributes -> true 33 | | N_constraints -> true 34 | | N_class_type_parameters -> true 35 | | N_class_structure -> true 36 | | N_class_sig_fields -> true 37 | | N_class_sig_body -> true 38 | | N_class_self_type -> true 39 | | N_class_self_pattern -> true 40 | | N_class_fields -> true 41 | | N_attributes -> true 42 | | _ -> false 43 | -------------------------------------------------------------------------------- /doc/dev/SERVER.md: -------------------------------------------------------------------------------- 1 | Merlin now implements a server. This simplify implementation of editor modes by 2 | allowing synchronous process executions. 3 | 4 | The `ocamlmerlin` binary is a wrapper, written in C, that redirects queries to 5 | `ocamlmerlin-server`. 6 | 7 | It can be used in a few different ways. 8 | 9 | `old-protocol` works as a repl: one writes a query (formatted as a json value) 10 | and reads an answer (also json). It is the protocol of merlin 1.x and 2.x. 11 | When detecting old-protocol, `ocamlmerlin` wrapper simply executes the 12 | ocamlmerlin-server. It is documented in [OLD-PROTOCOL.md](OLD-PROTOCOL.md). 13 | 14 | With the new protocol, the query is specified on the command-line and the 15 | content is read from standard input. Merlin can now be used like a regular 16 | UNIX command. Answers are written on standard output as JSON-values (or 17 | optionally, S-expression). 18 | 19 | In `single` mode, the wrapper executes `ocamlmerlin-server` and processes a 20 | single query. 21 | In `server` mode, the wrapper looks for an existing server. If none are found, 22 | it executes a new one. Then it redirects the query to the server, wait for an 23 | answer and terminates. 24 | 25 | The editor plugin does the same work in both cases, caching & calling the 26 | server is transparent. 27 | 28 | Mode is specified as the first argument to `ocamlmerlin` binary, and defaults to 29 | `old-protocol` for compatibility with previous versions. 30 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/untypeast.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Thomas Gazagnaire (OCamlPro), Fabrice Le Fessant (INRIA Saclay) *) 6 | (* *) 7 | (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (**************************************************************************) 12 | 13 | val untype_structure : Typedtree.structure -> Parsetree.structure 14 | val untype_signature : Typedtree.signature -> Parsetree.signature 15 | val untype_expression : Typedtree.expression -> Parsetree.expression 16 | val untype_type_declaration : 17 | Typedtree.type_declaration -> Parsetree.type_declaration 18 | val untype_module_type : Typedtree.module_type -> Parsetree.module_type 19 | 20 | val lident_of_path : Path.t -> Longident.t 21 | 22 | (* Merlin *) 23 | val untype_pattern : Typedtree.pattern -> Parsetree.pattern 24 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/envaux.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* OCaml port by John Malecki and Xavier Leroy *) 7 | (* *) 8 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 9 | (* en Automatique. All rights reserved. This file is distributed *) 10 | (* under the terms of the Q Public License version 1.0. *) 11 | (* *) 12 | (***********************************************************************) 13 | 14 | open Format 15 | 16 | (* Convert environment summaries to environments *) 17 | 18 | val env_from_summary : Env.summary -> Subst.t -> Env.t 19 | 20 | (* Empty the environment caches. To be called when load_path changes. *) 21 | 22 | val reset_cache: unit -> unit 23 | 24 | val env_of_only_summary : Env.t -> Env.t 25 | 26 | (* Error report *) 27 | 28 | type error = 29 | Module_not_found of Path.t 30 | 31 | exception Error of error 32 | 33 | val report_error: formatter -> error -> unit 34 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/oprint.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | open Format 14 | open Outcometree 15 | 16 | val out_value : (formatter -> out_value -> unit) ref 17 | val out_type : (formatter -> out_type -> unit) ref 18 | val out_class_type : (formatter -> out_class_type -> unit) ref 19 | val out_module_type : (formatter -> out_module_type -> unit) ref 20 | val out_sig_item : (formatter -> out_sig_item -> unit) ref 21 | val out_signature : (formatter -> out_sig_item list -> unit) ref 22 | val out_type_extension : (formatter -> out_type_extension -> unit) ref 23 | val out_phrase : (formatter -> out_phrase -> unit) ref 24 | 25 | val parenthesized_ident : string -> bool 26 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/oprint.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | open Format 14 | open Outcometree 15 | 16 | val out_value : (formatter -> out_value -> unit) ref 17 | val out_type : (formatter -> out_type -> unit) ref 18 | val out_class_type : (formatter -> out_class_type -> unit) ref 19 | val out_module_type : (formatter -> out_module_type -> unit) ref 20 | val out_sig_item : (formatter -> out_sig_item -> unit) ref 21 | val out_signature : (formatter -> out_sig_item list -> unit) ref 22 | val out_type_extension : (formatter -> out_type_extension -> unit) ref 23 | val out_phrase : (formatter -> out_phrase -> unit) ref 24 | 25 | val parenthesized_ident : string -> bool 26 | -------------------------------------------------------------------------------- /src/ocaml/support/clflags.mli: -------------------------------------------------------------------------------- 1 | (** {0 OCaml compiler compatible command-line parameters} 2 | 3 | For compatibility with typechecker. 4 | Argument parsing / build environment construction happens elsewhere. 5 | *) 6 | 7 | (** {1 Relevant settings} 8 | Parameters from OCaml compiler which affect Merlin behavior. *) 9 | val include_dirs : string list ref 10 | val fast : bool ref 11 | val classic : bool ref 12 | val principal : bool ref 13 | val real_paths : bool ref 14 | val recursive_types : bool ref 15 | val strict_sequence : bool ref 16 | val applicative_functors : bool ref 17 | val unsafe_string : bool ref 18 | val nopervasives : bool ref 19 | val strict_formats : bool ref 20 | val open_modules : string list ref 21 | 22 | (** {1 Dummy values} 23 | Ignored by merlin but kept for compatibility with upstream code. *) 24 | val annotations : bool ref 25 | val binary_annotations : bool ref 26 | val print_types : bool ref 27 | val native_code : bool ref 28 | val dont_write_files : bool ref 29 | val error_size : int ref (* max size of module related errors *) 30 | val keep_locs : bool ref 31 | val keep_docs : bool ref 32 | val transparent_modules : bool ref 33 | val for_package : string option ref 34 | val debug : bool ref 35 | val opaque : bool ref 36 | val unboxed_types : bool ref 37 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/stypes.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Moscova, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2003 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Recording and dumping (partial) type information *) 14 | 15 | (* Clflags.save_types must be true *) 16 | 17 | open Typedtree;; 18 | 19 | type annotation = 20 | | Ti_pat of pattern 21 | | Ti_expr of expression 22 | | Ti_class of class_expr 23 | | Ti_mod of module_expr 24 | | An_call of Location.t * Annot.call 25 | | An_ident of Location.t * string * Annot.ident 26 | ;; 27 | 28 | val record : annotation -> unit;; 29 | val record_phrase : Location.t -> unit;; 30 | val dump : string option -> unit;; 31 | 32 | val get_location : annotation -> Location.t;; 33 | val get_info : unit -> annotation list;; 34 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/stypes.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Moscova, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2003 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Recording and dumping (partial) type information *) 14 | 15 | (* Clflags.save_types must be true *) 16 | 17 | open Typedtree;; 18 | 19 | type annotation = 20 | | Ti_pat of pattern 21 | | Ti_expr of expression 22 | | Ti_class of class_expr 23 | | Ti_mod of module_expr 24 | | An_call of Location.t * Annot.call 25 | | An_ident of Location.t * string * Annot.ident 26 | ;; 27 | 28 | val record : annotation -> unit;; 29 | val record_phrase : Location.t -> unit;; 30 | val dump : string option -> unit;; 31 | 32 | val get_location : annotation -> Location.t;; 33 | val get_info : unit -> annotation list;; 34 | -------------------------------------------------------------------------------- /appveyor.cmd: -------------------------------------------------------------------------------- 1 | @setlocal 2 | @echo off 3 | 4 | set Path=C:\cygwin\bin;%Path% 5 | set OCAML_PREV_PATH=%PATH% 6 | set OCAML_PREV_LIB=%LIB% 7 | set OCAML_PREV_INCLUDE=%INCLUDE% 8 | 9 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare mingw" 10 | if errorlevel 1 exit /b 1 11 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare mingw64" 12 | if errorlevel 1 exit /b 1 13 | call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /release 14 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare msvc" 15 | if errorlevel 1 exit /b 1 16 | set PATH=%OCAML_PREV_PATH% 17 | set LIB=%OCAML_PREV_LIB% 18 | set INCLUDE=%OCAML_PREV_INCLUDE% 19 | call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release 20 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare msvc64" 21 | if errorlevel 1 exit /b 1 22 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh matrix" 23 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build msvc64" 24 | if errorlevel 1 exit /b 1 25 | set PATH=%OCAML_PREV_PATH% 26 | set LIB=%OCAML_PREV_LIB% 27 | set INCLUDE=%OCAML_PREV_INCLUDE% 28 | call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /release 29 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build msvc" 30 | if errorlevel 1 exit /b 1 31 | set PATH=%OCAML_PREV_PATH% 32 | set LIB=%OCAML_PREV_LIB% 33 | set INCLUDE=%OCAML_PREV_INCLUDE% 34 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build mingw" 35 | if errorlevel 1 exit /b 1 36 | bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build mingw64" 37 | if errorlevel 1 exit /b 1 38 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Typedtree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature -> unit;; 20 | val implementation : formatter -> structure -> unit;; 21 | 22 | val implementation_with_coercion : 23 | formatter -> (structure * module_coercion) -> unit;; 24 | 25 | (* Added by merlin for debugging purposes *) 26 | val pattern : int -> formatter -> pattern -> unit 27 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Typedtree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature -> unit;; 20 | val implementation : formatter -> structure -> unit;; 21 | 22 | val implementation_with_coercion : 23 | formatter -> (structure * module_coercion) -> unit;; 24 | 25 | (* Added by merlin for debugging purposes *) 26 | val pattern : int -> formatter -> pattern -> unit 27 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/primitive.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Description of primitive functions *) 14 | 15 | type description = 16 | { prim_name: string; (* Name of primitive or C function *) 17 | prim_arity: int; (* Number of arguments *) 18 | prim_alloc: bool; (* Does it allocates or raise? *) 19 | prim_native_name: string; (* Name of C function for the nat. code gen. *) 20 | prim_native_float: bool } (* Does the above operate on unboxed floats? *) 21 | 22 | val parse_declaration: int -> string list -> description 23 | 24 | val description_list: description -> string list 25 | 26 | val native_name: description -> string 27 | val byte_name: description -> string 28 | -------------------------------------------------------------------------------- /src/kernel/mtyper.mli: -------------------------------------------------------------------------------- 1 | (** {1 Result of typechecker} 2 | 3 | [Mtyper] essentially produces a typedtree, but to make sense of it 4 | the OCaml typechecker need to be in a specific state. 5 | 6 | The [result] type wraps a snapshot of this state with the typedtree to 7 | ensure correct accesses. 8 | *) 9 | 10 | type result 11 | 12 | type typedtree = [ 13 | | `Interface of Typedtree.signature 14 | | `Implementation of Typedtree.structure 15 | ] 16 | 17 | val run : Trace.t -> Mconfig.t -> Msource.t -> Mreader.parsetree -> result 18 | 19 | val with_typer : result -> (unit -> 'a) -> 'a 20 | 21 | val get_env : ?pos:Msource.position -> result -> Env.t 22 | 23 | val get_typedtree : result -> typedtree 24 | 25 | val get_errors : result -> exn list 26 | 27 | (** Heuristic to find suitable environment to complete / type at given position. 28 | * 1. Try to find environment near given cursor. 29 | * 2. Check if there is an invalid construct between found env and cursor : 30 | * Case a. 31 | * > let x = valid_expr || 32 | * The env found is the right most env from valid_expr, it's a correct 33 | * answer. 34 | * Case b. 35 | * > let x = valid_expr 36 | * > let y = invalid_construction|| 37 | * In this case, the env found is the same as in case a, however it is 38 | * preferable to use env from enclosing module rather than an env from 39 | * inside x definition. 40 | *) 41 | val node_at : Trace.t -> 42 | ?skip_recovered:bool -> result -> Lexing.position -> Mbrowse.t 43 | -------------------------------------------------------------------------------- /src/ocaml/support/lexer_ident.mli: -------------------------------------------------------------------------------- 1 | (* {{{ COPYING *( 2 | 3 | This file is part of Merlin, an helper for ocaml editors 4 | 5 | Copyright (C) 2013 - 2015 Frédéric Bour 6 | Thomas Refis 7 | Simon Castellan 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a 10 | copy of this software and associated documentation files (the "Software"), 11 | to deal in the Software without restriction, including without limitation the 12 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | sell copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | The Software is provided "as is", without warranty of any kind, express or 20 | implied, including but not limited to the warranties of merchantability, 21 | fitness for a particular purpose and noninfringement. In no event shall 22 | the authors or copyright holders be liable for any claim, damages or other 23 | liability, whether in an action of contract, tort or otherwise, arising 24 | from, out of or in connection with the software or the use or other dealings 25 | in the Software. 26 | 27 | )* }}} *) 28 | 29 | val token: Lexing.lexbuf -> Parser_raw.token 30 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/primitive.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Description of primitive functions *) 14 | 15 | type description = 16 | { prim_name: string; (* Name of primitive or C function *) 17 | prim_arity: int; (* Number of arguments *) 18 | prim_alloc: bool; (* Does it allocates or raise? *) 19 | prim_native_name: string; (* Name of C function for the nat. code gen. *) 20 | prim_native_float: bool } (* Does the above operate on unboxed floats? *) 21 | 22 | val parse_declaration: int -> string list -> description 23 | 24 | val description_list: description -> string list 25 | 26 | val native_name: description -> string 27 | val byte_name: description -> string 28 | -------------------------------------------------------------------------------- /orig/ocaml_402/utils/tbl.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Association tables from any ordered type to any type. 14 | We use the generic ordering to compare keys. *) 15 | 16 | type ('a, 'b) t 17 | 18 | val empty: ('a, 'b) t 19 | val add: 'a -> 'b -> ('a, 'b) t -> ('a, 'b) t 20 | val find: 'a -> ('a, 'b) t -> 'b 21 | val mem: 'a -> ('a, 'b) t -> bool 22 | val remove: 'a -> ('a, 'b) t -> ('a, 'b) t 23 | val iter: ('a -> 'b -> unit) -> ('a, 'b) t -> unit 24 | val map: ('a -> 'b -> 'c) -> ('a, 'b) t -> ('a, 'c) t 25 | val fold: ('a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c 26 | 27 | open Format 28 | 29 | val print: (formatter -> 'a -> unit) -> (formatter -> 'b -> unit) -> 30 | formatter -> ('a, 'b) t -> unit 31 | -------------------------------------------------------------------------------- /orig/ocaml_403/utils/terminfo.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Basic interface to the terminfo database *) 17 | 18 | type status = 19 | | Uninitialised 20 | | Bad_term 21 | | Good_term of int 22 | ;; 23 | external setup : out_channel -> status = "caml_terminfo_setup";; 24 | external backup : int -> unit = "caml_terminfo_backup";; 25 | external standout : bool -> unit = "caml_terminfo_standout";; 26 | external resume : int -> unit = "caml_terminfo_resume";; 27 | -------------------------------------------------------------------------------- /orig/ocaml_404/utils/numbers.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Pierre Chambart, OCamlPro *) 6 | (* Mark Shinwell and Leo White, Jane Street Europe *) 7 | (* *) 8 | (* Copyright 2013--2016 OCamlPro SAS *) 9 | (* Copyright 2014--2016 Jane Street Group LLC *) 10 | (* *) 11 | (* All rights reserved. This file is distributed under the terms of *) 12 | (* the GNU Lesser General Public License version 2.1, with the *) 13 | (* special exception on linking described in the file LICENSE. *) 14 | (* *) 15 | (**************************************************************************) 16 | 17 | (** Modules about numbers that satisfy [Identifiable.S]. *) 18 | 19 | module Int : sig 20 | include Identifiable.S with type t = int 21 | 22 | (** [zero_to_n n] is the set of numbers \{0, ..., n\} (inclusive). *) 23 | val zero_to_n : int -> Set.t 24 | end 25 | 26 | module Float : Identifiable.S with type t = float 27 | -------------------------------------------------------------------------------- /orig/ocaml_404/utils/terminfo.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Basic interface to the terminfo database *) 17 | 18 | type status = 19 | | Uninitialised 20 | | Bad_term 21 | | Good_term of int 22 | ;; 23 | external setup : out_channel -> status = "caml_terminfo_setup";; 24 | external backup : int -> unit = "caml_terminfo_backup";; 25 | external standout : bool -> unit = "caml_terminfo_standout";; 26 | external resume : int -> unit = "caml_terminfo_resume";; 27 | -------------------------------------------------------------------------------- /orig/ocaml_405/utils/numbers.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Pierre Chambart, OCamlPro *) 6 | (* Mark Shinwell and Leo White, Jane Street Europe *) 7 | (* *) 8 | (* Copyright 2013--2016 OCamlPro SAS *) 9 | (* Copyright 2014--2016 Jane Street Group LLC *) 10 | (* *) 11 | (* All rights reserved. This file is distributed under the terms of *) 12 | (* the GNU Lesser General Public License version 2.1, with the *) 13 | (* special exception on linking described in the file LICENSE. *) 14 | (* *) 15 | (**************************************************************************) 16 | 17 | (** Modules about numbers that satisfy {!Identifiable.S}. *) 18 | 19 | module Int : sig 20 | include Identifiable.S with type t = int 21 | 22 | (** [zero_to_n n] is the set of numbers \{0, ..., n\} (inclusive). *) 23 | val zero_to_n : int -> Set.t 24 | end 25 | 26 | module Float : Identifiable.S with type t = float 27 | -------------------------------------------------------------------------------- /orig/ocaml_405/utils/terminfo.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Basic interface to the terminfo database *) 17 | 18 | type status = 19 | | Uninitialised 20 | | Bad_term 21 | | Good_term of int 22 | ;; 23 | external setup : out_channel -> status = "caml_terminfo_setup";; 24 | external backup : int -> unit = "caml_terminfo_backup";; 25 | external standout : bool -> unit = "caml_terminfo_standout";; 26 | external resume : int -> unit = "caml_terminfo_resume";; 27 | -------------------------------------------------------------------------------- /orig/ocaml_403/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Parsetree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature_item list -> unit;; 20 | val implementation : formatter -> structure_item list -> unit;; 21 | val top_phrase : formatter -> toplevel_phrase -> unit;; 22 | 23 | val expression: int -> formatter -> expression -> unit 24 | val structure: int -> formatter -> structure -> unit 25 | val payload: int -> formatter -> payload -> unit 26 | -------------------------------------------------------------------------------- /orig/ocaml_404/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Parsetree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature_item list -> unit;; 20 | val implementation : formatter -> structure_item list -> unit;; 21 | val top_phrase : formatter -> toplevel_phrase -> unit;; 22 | 23 | val expression: int -> formatter -> expression -> unit 24 | val structure: int -> formatter -> structure -> unit 25 | val payload: int -> formatter -> payload -> unit 26 | -------------------------------------------------------------------------------- /orig/ocaml_405/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Parsetree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature_item list -> unit;; 20 | val implementation : formatter -> structure_item list -> unit;; 21 | val top_phrase : formatter -> toplevel_phrase -> unit;; 22 | 23 | val expression: int -> formatter -> expression -> unit 24 | val structure: int -> formatter -> structure -> unit 25 | val payload: int -> formatter -> payload -> unit 26 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Parsetree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature_item list -> unit;; 20 | val implementation : formatter -> structure_item list -> unit;; 21 | val top_phrase : formatter -> toplevel_phrase -> unit;; 22 | 23 | val expression: int -> formatter -> expression -> unit 24 | val structure: int -> formatter -> structure -> unit 25 | val payload: int -> formatter -> payload -> unit 26 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Parsetree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature_item list -> unit;; 20 | val implementation : formatter -> structure_item list -> unit;; 21 | val top_phrase : formatter -> toplevel_phrase -> unit;; 22 | 23 | val expression: int -> formatter -> expression -> unit 24 | val structure: int -> formatter -> structure -> unit 25 | val payload: int -> formatter -> payload -> unit 26 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/parsing/printast.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Parsetree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature_item list -> unit;; 20 | val implementation : formatter -> structure_item list -> unit;; 21 | val top_phrase : formatter -> toplevel_phrase -> unit;; 22 | 23 | val expression: int -> formatter -> expression -> unit 24 | val structure: int -> formatter -> structure -> unit 25 | val payload: int -> formatter -> payload -> unit 26 | -------------------------------------------------------------------------------- /orig/ocaml_402/parsing/syntaxerr.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Auxiliary type for reporting syntax errors *) 14 | 15 | open Format 16 | 17 | type error = 18 | Unclosed of Location.t * string * Location.t * string 19 | | Expecting of Location.t * string 20 | | Not_expecting of Location.t * string 21 | | Applicative_path of Location.t 22 | | Variable_in_scope of Location.t * string 23 | | Other of Location.t 24 | | Ill_formed_ast of Location.t * string 25 | 26 | exception Error of error 27 | exception Escape_error 28 | 29 | val report_error: formatter -> error -> unit 30 | (* Deprecated. Use Location.{error_of_exn, report_error}. *) 31 | 32 | val location_of_error: error -> Location.t 33 | val ill_formed_ast: Location.t -> string -> 'a 34 | -------------------------------------------------------------------------------- /src/frontend/query_commands.mli: -------------------------------------------------------------------------------- 1 | 2 | (* {{{ COPYING *( 3 | 4 | This file is part of Merlin, an helper for ocaml editors 5 | 6 | Copyright (C) 2013 - 2015 Frédéric Bour 7 | Thomas Refis 8 | Simon Castellan 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files (the "Software"), 12 | to deal in the Software without restriction, including without limitation the 13 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | sell copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | The Software is provided "as is", without warranty of any kind, express or 21 | implied, including but not limited to the warranties of merchantability, 22 | fitness for a particular purpose and noninfringement. In no event shall 23 | the authors or copyright holders be liable for any claim, damages or other 24 | liability, whether in an action of contract, tort or otherwise, arising 25 | from, out of or in connection with the software or the use or other dealings 26 | in the Software. 27 | 28 | )* }}} *) 29 | 30 | open Sturgeon_stub 31 | 32 | val dispatch : Mpipeline.t -> 'a Query_protocol.t -> 'a 33 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/typing/printtyped.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Damien Doligez, projet Para, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1999 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Typedtree;; 17 | open Format;; 18 | 19 | val interface : formatter -> signature -> unit;; 20 | val implementation : formatter -> structure -> unit;; 21 | 22 | val implementation_with_coercion : 23 | formatter -> (structure * module_coercion) -> unit;; 24 | 25 | (* Added by merlin for debugging purposes *) 26 | val pattern : int -> formatter -> pattern -> unit 27 | val expression : int -> formatter -> expression -> unit 28 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/datarepr.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Compute constructor and label descriptions from type declarations, 14 | determining their representation. *) 15 | 16 | open Asttypes 17 | open Types 18 | 19 | val constructor_descrs: 20 | type_expr -> constructor_declaration list -> 21 | private_flag -> (Ident.t * constructor_description) list 22 | val extension_descr: 23 | Path.t -> extension_constructor -> constructor_description 24 | val label_descrs: 25 | type_expr -> label_declaration list -> 26 | record_representation -> private_flag -> 27 | (Ident.t * label_description) list 28 | 29 | exception Constr_not_found 30 | 31 | val find_constr_by_tag: 32 | constructor_tag -> constructor_declaration list -> 33 | constructor_declaration 34 | -------------------------------------------------------------------------------- /orig/ocaml_403/utils/terminfo.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Basic interface to the terminfo database *) 17 | 18 | type status = 19 | | Uninitialised 20 | | Bad_term 21 | | Good_term of int (* number of lines of the terminal *) 22 | ;; 23 | external setup : out_channel -> status = "caml_terminfo_setup";; 24 | external backup : int -> unit = "caml_terminfo_backup";; 25 | external standout : bool -> unit = "caml_terminfo_standout";; 26 | external resume : int -> unit = "caml_terminfo_resume";; 27 | -------------------------------------------------------------------------------- /orig/ocaml_404/utils/terminfo.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Basic interface to the terminfo database *) 17 | 18 | type status = 19 | | Uninitialised 20 | | Bad_term 21 | | Good_term of int (* number of lines of the terminal *) 22 | ;; 23 | external setup : out_channel -> status = "caml_terminfo_setup";; 24 | external backup : int -> unit = "caml_terminfo_backup";; 25 | external standout : bool -> unit = "caml_terminfo_standout";; 26 | external resume : int -> unit = "caml_terminfo_resume";; 27 | -------------------------------------------------------------------------------- /orig/ocaml_405/utils/terminfo.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Basic interface to the terminfo database *) 17 | 18 | type status = 19 | | Uninitialised 20 | | Bad_term 21 | | Good_term of int (* number of lines of the terminal *) 22 | ;; 23 | external setup : out_channel -> status = "caml_terminfo_setup";; 24 | external backup : int -> unit = "caml_terminfo_backup";; 25 | external standout : bool -> unit = "caml_terminfo_standout";; 26 | external resume : int -> unit = "caml_terminfo_resume";; 27 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/parsing/syntaxerr.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Auxiliary type for reporting syntax errors *) 14 | 15 | open Format 16 | 17 | type error = 18 | Unclosed of Location.t * string * Location.t * string 19 | | Expecting of Location.t * string 20 | | Not_expecting of Location.t * string 21 | | Applicative_path of Location.t 22 | | Variable_in_scope of Location.t * string 23 | | Other of Location.t 24 | | Ill_formed_ast of Location.t * string 25 | 26 | exception Error of error 27 | exception Escape_error of Location.t 28 | 29 | val report_error: formatter -> error -> unit 30 | (* Deprecated. Use Location.{error_of_exn, report_error}. *) 31 | 32 | val location_of_error: error -> Location.t 33 | val ill_formed_ast: Location.t -> string -> 'a 34 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/datarepr.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Compute constructor and label descriptions from type declarations, 14 | determining their representation. *) 15 | 16 | open Asttypes 17 | open Types 18 | 19 | val constructor_descrs: 20 | type_expr -> constructor_declaration list -> 21 | private_flag -> (Ident.t * constructor_description) list 22 | val extension_descr: 23 | Path.t -> extension_constructor -> constructor_description 24 | val label_descrs: 25 | type_expr -> label_declaration list -> 26 | record_representation -> private_flag -> 27 | (Ident.t * label_description) list 28 | 29 | exception Constr_not_found 30 | 31 | val find_constr_by_tag: 32 | constructor_tag -> constructor_declaration list -> 33 | constructor_declaration 34 | -------------------------------------------------------------------------------- /src/ocaml/support/tbl.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* $Id: tbl.mli 11156 2011-07-27 14:17:02Z doligez $ *) 14 | 15 | (* Association tables from any ordered type to any type. 16 | We use the generic ordering to compare keys. *) 17 | 18 | type ('a, 'b) t 19 | 20 | val empty: ('a, 'b) t 21 | val add: 'a -> 'b -> ('a, 'b) t -> ('a, 'b) t 22 | val find: 'a -> ('a, 'b) t -> 'b 23 | val mem: 'a -> ('a, 'b) t -> bool 24 | val remove: 'a -> ('a, 'b) t -> ('a, 'b) t 25 | val iter: ('a -> 'b -> unit) -> ('a, 'b) t -> unit 26 | val map: ('a -> 'b -> 'c) -> ('a, 'b) t -> ('a, 'c) t 27 | val fold: ('a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c 28 | 29 | open Format 30 | 31 | val print: (formatter -> 'a -> unit) -> (formatter -> 'b -> unit) -> 32 | formatter -> ('a, 'b) t -> unit 33 | -------------------------------------------------------------------------------- /orig/ocaml_403/parsing/parse.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Entry points in the parser *) 17 | 18 | val implementation : Lexing.lexbuf -> Parsetree.structure 19 | val interface : Lexing.lexbuf -> Parsetree.signature 20 | val toplevel_phrase : Lexing.lexbuf -> Parsetree.toplevel_phrase 21 | val use_file : Lexing.lexbuf -> Parsetree.toplevel_phrase list 22 | val core_type : Lexing.lexbuf -> Parsetree.core_type 23 | val expression : Lexing.lexbuf -> Parsetree.expression 24 | val pattern : Lexing.lexbuf -> Parsetree.pattern 25 | -------------------------------------------------------------------------------- /orig/ocaml_404/parsing/parse.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (** Entry points in the parser *) 17 | 18 | val implementation : Lexing.lexbuf -> Parsetree.structure 19 | val interface : Lexing.lexbuf -> Parsetree.signature 20 | val toplevel_phrase : Lexing.lexbuf -> Parsetree.toplevel_phrase 21 | val use_file : Lexing.lexbuf -> Parsetree.toplevel_phrase list 22 | val core_type : Lexing.lexbuf -> Parsetree.core_type 23 | val expression : Lexing.lexbuf -> Parsetree.expression 24 | val pattern : Lexing.lexbuf -> Parsetree.pattern 25 | -------------------------------------------------------------------------------- /orig/ocaml_405/parsing/parse.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (** Entry points in the parser *) 17 | 18 | val implementation : Lexing.lexbuf -> Parsetree.structure 19 | val interface : Lexing.lexbuf -> Parsetree.signature 20 | val toplevel_phrase : Lexing.lexbuf -> Parsetree.toplevel_phrase 21 | val use_file : Lexing.lexbuf -> Parsetree.toplevel_phrase list 22 | val core_type : Lexing.lexbuf -> Parsetree.core_type 23 | val expression : Lexing.lexbuf -> Parsetree.expression 24 | val pattern : Lexing.lexbuf -> Parsetree.pattern 25 | -------------------------------------------------------------------------------- /src/analysis/outline.mli: -------------------------------------------------------------------------------- 1 | (* {{{ COPYING *( 2 | 3 | This file is part of Merlin, an helper for ocaml editors 4 | 5 | Copyright (C) 2013 - 2015 Frédéric Bour 6 | Thomas Refis 7 | Simon Castellan 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a 10 | copy of this software and associated documentation files (the "Software"), 11 | to deal in the Software without restriction, including without limitation the 12 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | sell copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | The Software is provided "as is", without warranty of any kind, express or 20 | implied, including but not limited to the warranties of merchantability, 21 | fitness for a particular purpose and noninfringement. In no event shall 22 | the authors or copyright holders be liable for any claim, damages or other 23 | liability, whether in an action of contract, tort or otherwise, arising 24 | from, out of or in connection with the software or the use or other dealings 25 | in the Software. 26 | 27 | )* }}} *) 28 | 29 | val get : Browse_tree.t list -> Query_protocol.outline 30 | val shape : Lexing.position -> Browse_tree.t list -> Query_protocol.shape list 31 | -------------------------------------------------------------------------------- /src/kernel/mppx.ml: -------------------------------------------------------------------------------- 1 | open Mconfig 2 | 3 | let change_directory dir = 4 | Logger.log "Mppx" "changing_directory" dir; 5 | match Sys.chdir dir with 6 | | () -> true 7 | | exception exn -> 8 | Logger.logf "Mppx" "changing directory" 9 | "chang_directory %S failed with %t" dir 10 | (fun () -> Printexc.to_string exn); 11 | false 12 | 13 | 14 | let with_include_dir path f = 15 | let saved = !Clflags.include_dirs in 16 | let restore () = Clflags.include_dirs := saved in 17 | Clflags.include_dirs := path; 18 | let result = 19 | begin 20 | try 21 | f () 22 | with 23 | | e -> 24 | restore (); 25 | raise e 26 | end 27 | in 28 | restore (); 29 | result 30 | 31 | 32 | let rewrite _trace cfg parsetree = 33 | let ppx = cfg.ocaml.ppx @ Ppxsetup.command_line cfg.merlin.packages_ppx in 34 | let prev_dir = Sys.getcwd () in 35 | let restore () = 36 | if not (change_directory prev_dir) then 37 | ignore (change_directory "/") 38 | in 39 | ignore (change_directory cfg.query.directory); 40 | (* add include path attribute to the parsetree *) 41 | with_include_dir (Mconfig.build_path cfg) @@ fun () -> 42 | match Pparse.apply_rewriters ~ppx ~tool_name:"merlin" parsetree with 43 | | parsetree -> 44 | restore (); 45 | cfg, parsetree 46 | | exception exn -> 47 | Logger.logf "Mppx" "rewrite" "failed with %t" (fun () -> 48 | match Location.error_of_exn exn with 49 | | None -> Printexc.to_string exn 50 | | Some err -> err.Location.msg 51 | ); 52 | Msupport.raise_error exn; 53 | restore (); 54 | cfg, parsetree 55 | -------------------------------------------------------------------------------- /src/frontend/old/old_command.mli: -------------------------------------------------------------------------------- 1 | (* {{{ COPYING *( 2 | 3 | This file is part of Merlin, an helper for ocaml editors 4 | 5 | Copyright (C) 2013 - 2015 Frédéric Bour 6 | Thomas Refis 7 | Simon Castellan 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a 10 | copy of this software and associated documentation files (the "Software"), 11 | to deal in the Software without restriction, including without limitation the 12 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | sell copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | The Software is provided "as is", without warranty of any kind, express or 20 | implied, including but not limited to the warranties of merchantability, 21 | fitness for a particular purpose and noninfringement. In no event shall 22 | the authors or copyright holders be liable for any claim, damages or other 23 | liability, whether in an action of contract, tort or otherwise, arising 24 | from, out of or in connection with the software or the use or other dealings 25 | in the Software. 26 | 27 | )* }}} *) 28 | 29 | open Sturgeon_stub 30 | 31 | val default_config : Mconfig.t ref 32 | 33 | val dispatch : Trace.t -> Old_protocol.Context.t -> 'a Old_protocol.command -> 'a 34 | -------------------------------------------------------------------------------- /preprocessors/recover/utils.ml: -------------------------------------------------------------------------------- 1 | open MenhirSdk 2 | 3 | let const c = fun _ -> c 4 | 5 | let group_assoc l = 6 | let cons k v acc = (k, List.rev v) :: acc in 7 | let rec aux k v vs acc = function 8 | | [] -> List.rev (cons k (v :: vs) acc) 9 | | (k', v') :: xs when compare k k' = 0 -> 10 | if compare v v' = 0 then 11 | aux k v vs acc xs 12 | else 13 | aux k v' (v :: vs) acc xs 14 | | (k', v') :: xs -> 15 | aux k' v' [] (cons k (v :: vs) acc) xs 16 | in 17 | match List.sort compare l with 18 | | [] -> [] 19 | | (k, v) :: xs -> aux k v [] [] xs 20 | 21 | (* negation to put nan as the max *) 22 | let compare_float a b = - compare (-.a) (-.b) 23 | 24 | let min_float a b = 25 | if compare_float a b > 0 then b else a 26 | 27 | let arg_min_float f a b = 28 | if compare_float (f a) (f b) <= 0 then a else b 29 | 30 | exception Found of int 31 | let array_exists arr f = 32 | try 33 | for i = 0 to Array.length arr - 1 do 34 | if f arr.(i) then raise (Found i); 35 | done; 36 | false 37 | with Found _ -> true 38 | 39 | let array_findi arr f = 40 | match 41 | for i = 0 to Array.length arr - 1 do 42 | if f arr.(i) then raise (Found i); 43 | done 44 | with () -> raise Not_found 45 | | exception (Found i) -> i 46 | 47 | let array_find arr f = 48 | arr.(array_findi arr f) 49 | 50 | let array_assoc arr x = 51 | snd (array_find arr (fun (x',_) -> compare x x' = 0)) 52 | 53 | let list_fmt f l = 54 | "[" ^ String.concat "; " (List.map f l) ^ "]" 55 | 56 | let fst3 (x,_,_) = x 57 | 58 | let rec list_last = function 59 | | [x] -> x 60 | | _ :: xs -> list_last xs 61 | | [] -> invalid_arg "list_last" 62 | -------------------------------------------------------------------------------- /orig/ocaml_403/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Inclusion checks for the class language *) 17 | 18 | open Types 19 | open Ctype 20 | open Format 21 | 22 | val class_types: 23 | Env.t -> class_type -> class_type -> class_match_failure list 24 | val class_type_declarations: 25 | Env.t -> class_type_declaration -> class_type_declaration -> 26 | class_match_failure list 27 | val class_declarations: 28 | Env.t -> class_declaration -> class_declaration -> 29 | class_match_failure list 30 | 31 | val report_error: formatter -> class_match_failure list -> unit 32 | -------------------------------------------------------------------------------- /orig/ocaml_404/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Inclusion checks for the class language *) 17 | 18 | open Types 19 | open Ctype 20 | open Format 21 | 22 | val class_types: 23 | Env.t -> class_type -> class_type -> class_match_failure list 24 | val class_type_declarations: 25 | Env.t -> class_type_declaration -> class_type_declaration -> 26 | class_match_failure list 27 | val class_declarations: 28 | Env.t -> class_declaration -> class_declaration -> 29 | class_match_failure list 30 | 31 | val report_error: formatter -> class_match_failure list -> unit 32 | -------------------------------------------------------------------------------- /orig/ocaml_405/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Inclusion checks for the class language *) 17 | 18 | open Types 19 | open Ctype 20 | open Format 21 | 22 | val class_types: 23 | Env.t -> class_type -> class_type -> class_match_failure list 24 | val class_type_declarations: 25 | Env.t -> class_type_declaration -> class_type_declaration -> 26 | class_match_failure list 27 | val class_declarations: 28 | Env.t -> class_declaration -> class_declaration -> 29 | class_match_failure list 30 | 31 | val report_error: formatter -> class_match_failure list -> unit 32 | -------------------------------------------------------------------------------- /orig/ocaml_403/utils/ccomp.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Compiling C files and building C libraries *) 17 | 18 | val command: string -> int 19 | val run_command: string -> unit 20 | val compile_file: string -> int 21 | val create_archive: string -> string list -> int 22 | val expand_libname: string -> string 23 | val quote_files: string list -> string 24 | val quote_optfile: string option -> string 25 | (*val make_link_options: string list -> string*) 26 | 27 | type link_mode = 28 | | Exe 29 | | Dll 30 | | MainDll 31 | | Partial 32 | 33 | val call_linker: link_mode -> string -> string list -> string -> bool 34 | -------------------------------------------------------------------------------- /orig/ocaml_404/utils/ccomp.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Compiling C files and building C libraries *) 17 | 18 | val command: string -> int 19 | val run_command: string -> unit 20 | val compile_file: string -> int 21 | val create_archive: string -> string list -> int 22 | val expand_libname: string -> string 23 | val quote_files: string list -> string 24 | val quote_optfile: string option -> string 25 | (*val make_link_options: string list -> string*) 26 | 27 | type link_mode = 28 | | Exe 29 | | Dll 30 | | MainDll 31 | | Partial 32 | 33 | val call_linker: link_mode -> string -> string list -> string -> bool 34 | -------------------------------------------------------------------------------- /orig/ocaml_405/utils/ccomp.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Compiling C files and building C libraries *) 17 | 18 | val command: string -> int 19 | val run_command: string -> unit 20 | val compile_file: string -> int 21 | val create_archive: string -> string list -> int 22 | val expand_libname: string -> string 23 | val quote_files: string list -> string 24 | val quote_optfile: string option -> string 25 | (*val make_link_options: string list -> string*) 26 | 27 | type link_mode = 28 | | Exe 29 | | Dll 30 | | MainDll 31 | | Partial 32 | 33 | val call_linker: link_mode -> string -> string list -> string -> bool 34 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (** Long identifiers, used in parsetree. *) 17 | 18 | type t = 19 | Lident of string 20 | | Ldot of t * string 21 | | Lapply of t * t 22 | 23 | val flatten: t -> string list 24 | val last: t -> string 25 | val parse: string -> t 26 | 27 | (* Merlin specific. *) 28 | 29 | val keep_suffix : t -> t * bool 30 | (** if [li', b = keep_suffix li] then: 31 | - the prefix of [li'] is a module path 32 | - [b = false] iff [li' = li]. 33 | Corollary: [b = true] if [li] is a label access 34 | (i.e. [li = X.Y.z.Foo.Bar...]) *) 35 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Inclusion checks for the class language *) 17 | 18 | open Types 19 | open Ctype 20 | open Format 21 | 22 | val class_types: 23 | Env.t -> class_type -> class_type -> class_match_failure list 24 | val class_type_declarations: 25 | Env.t -> class_type_declaration -> class_type_declaration -> 26 | class_match_failure list 27 | val class_declarations: 28 | Env.t -> class_declaration -> class_declaration -> 29 | class_match_failure list 30 | 31 | val report_error: formatter -> class_match_failure list -> unit 32 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (** Long identifiers, used in parsetree. *) 17 | 18 | type t = 19 | Lident of string 20 | | Ldot of t * string 21 | | Lapply of t * t 22 | 23 | val flatten: t -> string list 24 | val last: t -> string 25 | val parse: string -> t 26 | 27 | (* Merlin specific. *) 28 | 29 | val keep_suffix : t -> t * bool 30 | (** if [li', b = keep_suffix li] then: 31 | - the prefix of [li'] is a module path 32 | - [b = false] iff [li' = li]. 33 | Corollary: [b = true] if [li] is a label access 34 | (i.e. [li = X.Y.z.Foo.Bar...]) *) 35 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Inclusion checks for the class language *) 17 | 18 | open Types 19 | open Ctype 20 | open Format 21 | 22 | val class_types: 23 | Env.t -> class_type -> class_type -> class_match_failure list 24 | val class_type_declarations: 25 | Env.t -> class_type_declaration -> class_type_declaration -> 26 | class_match_failure list 27 | val class_declarations: 28 | Env.t -> class_declaration -> class_declaration -> 29 | class_match_failure list 30 | 31 | val report_error: formatter -> class_match_failure list -> unit 32 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/parsing/longident.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (** Long identifiers, used in parsetree. *) 17 | 18 | type t = 19 | Lident of string 20 | | Ldot of t * string 21 | | Lapply of t * t 22 | 23 | val flatten: t -> string list 24 | val last: t -> string 25 | val parse: string -> t 26 | 27 | (* Merlin specific. *) 28 | 29 | val keep_suffix : t -> t * bool 30 | (** if [li', b = keep_suffix li] then: 31 | - the prefix of [li'] is a module path 32 | - [b = false] iff [li' = li]. 33 | Corollary: [b = true] if [li] is a label access 34 | (i.e. [li = X.Y.z.Foo.Bar...]) *) 35 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/typing/includeclass.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1997 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | (* Inclusion checks for the class language *) 17 | 18 | open Types 19 | open Ctype 20 | open Format 21 | 22 | val class_types: 23 | Env.t -> class_type -> class_type -> class_match_failure list 24 | val class_type_declarations: 25 | Env.t -> class_type_declaration -> class_type_declaration -> 26 | class_match_failure list 27 | val class_declarations: 28 | Env.t -> class_declaration -> class_declaration -> 29 | class_match_failure list 30 | 31 | val report_error: formatter -> class_match_failure list -> unit 32 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/tast_helper.ml: -------------------------------------------------------------------------------- 1 | open Std 2 | open Typedtree 3 | 4 | module Pat = struct 5 | let pat_extra = [] 6 | let pat_attributes = [] 7 | 8 | let constant ?(loc=Location.none) pat_env pat_type c = 9 | let pat_desc = Tpat_constant c in 10 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 11 | 12 | let var ?loc pat_env pat_type str = 13 | let pat_loc = 14 | match loc with 15 | | None -> str.Asttypes.loc 16 | | Some loc -> loc 17 | in 18 | let pat_desc = Tpat_var (Ident.create str.Asttypes.txt, str) in 19 | { pat_desc; pat_loc; pat_extra; pat_attributes; pat_type; pat_env } 20 | 21 | let record ?(loc=Location.none) pat_env pat_type lst closed_flag = 22 | let pat_desc = Tpat_record (lst, closed_flag) in 23 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 24 | 25 | let tuple ?(loc=Location.none) pat_env pat_type lst = 26 | let pat_desc = Tpat_tuple lst in 27 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 28 | 29 | let construct ?(loc=Location.none) pat_env pat_type lid cstr_desc args = 30 | let pat_desc = Tpat_construct (lid, cstr_desc, args) in 31 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 32 | 33 | let pat_or ?(loc=Location.none) ?row_desc pat_env pat_type p1 p2 = 34 | let pat_desc = Tpat_or (p1, p2, row_desc) in 35 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 36 | 37 | let variant ?(loc=Location.none) pat_env pat_type lbl sub rd = 38 | let pat_desc = Tpat_variant (lbl, sub, rd) in 39 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 40 | end 41 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/tast_helper.ml: -------------------------------------------------------------------------------- 1 | open Std 2 | open Typedtree 3 | 4 | module Pat = struct 5 | let pat_extra = [] 6 | let pat_attributes = [] 7 | 8 | let constant ?(loc=Location.none) pat_env pat_type c = 9 | let pat_desc = Tpat_constant c in 10 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 11 | 12 | let var ?loc pat_env pat_type str = 13 | let pat_loc = 14 | match loc with 15 | | None -> str.Asttypes.loc 16 | | Some loc -> loc 17 | in 18 | let pat_desc = Tpat_var (Ident.create str.Asttypes.txt, str) in 19 | { pat_desc; pat_loc; pat_extra; pat_attributes; pat_type; pat_env } 20 | 21 | let record ?(loc=Location.none) pat_env pat_type lst closed_flag = 22 | let pat_desc = Tpat_record (lst, closed_flag) in 23 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 24 | 25 | let tuple ?(loc=Location.none) pat_env pat_type lst = 26 | let pat_desc = Tpat_tuple lst in 27 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 28 | 29 | let construct ?(loc=Location.none) pat_env pat_type lid cstr_desc args = 30 | let pat_desc = Tpat_construct (lid, cstr_desc, args) in 31 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 32 | 33 | let pat_or ?(loc=Location.none) ?row_desc pat_env pat_type p1 p2 = 34 | let pat_desc = Tpat_or (p1, p2, row_desc) in 35 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 36 | 37 | let variant ?(loc=Location.none) pat_env pat_type lbl sub rd = 38 | let pat_desc = Tpat_variant (lbl, sub, rd) in 39 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 40 | end 41 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/tast_helper.ml: -------------------------------------------------------------------------------- 1 | open Std 2 | open Typedtree 3 | 4 | module Pat = struct 5 | let pat_extra = [] 6 | let pat_attributes = [] 7 | 8 | let constant ?(loc=Location.none) pat_env pat_type c = 9 | let pat_desc = Tpat_constant c in 10 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 11 | 12 | let var ?loc pat_env pat_type str = 13 | let pat_loc = 14 | match loc with 15 | | None -> str.Asttypes.loc 16 | | Some loc -> loc 17 | in 18 | let pat_desc = Tpat_var (Ident.create str.Asttypes.txt, str) in 19 | { pat_desc; pat_loc; pat_extra; pat_attributes; pat_type; pat_env } 20 | 21 | let record ?(loc=Location.none) pat_env pat_type lst closed_flag = 22 | let pat_desc = Tpat_record (lst, closed_flag) in 23 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 24 | 25 | let tuple ?(loc=Location.none) pat_env pat_type lst = 26 | let pat_desc = Tpat_tuple lst in 27 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 28 | 29 | let construct ?(loc=Location.none) pat_env pat_type lid cstr_desc args = 30 | let pat_desc = Tpat_construct (lid, cstr_desc, args) in 31 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 32 | 33 | let pat_or ?(loc=Location.none) ?row_desc pat_env pat_type p1 p2 = 34 | let pat_desc = Tpat_or (p1, p2, row_desc) in 35 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 36 | 37 | let variant ?(loc=Location.none) pat_env pat_type lbl sub rd = 38 | let pat_desc = Tpat_variant (lbl, sub, rd) in 39 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 40 | end 41 | -------------------------------------------------------------------------------- /src/ocaml/typer_405/tast_helper.ml: -------------------------------------------------------------------------------- 1 | open Std 2 | open Typedtree 3 | 4 | module Pat = struct 5 | let pat_extra = [] 6 | let pat_attributes = [] 7 | 8 | let constant ?(loc=Location.none) pat_env pat_type c = 9 | let pat_desc = Tpat_constant c in 10 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 11 | 12 | let var ?loc pat_env pat_type str = 13 | let pat_loc = 14 | match loc with 15 | | None -> str.Asttypes.loc 16 | | Some loc -> loc 17 | in 18 | let pat_desc = Tpat_var (Ident.create str.Asttypes.txt, str) in 19 | { pat_desc; pat_loc; pat_extra; pat_attributes; pat_type; pat_env } 20 | 21 | let record ?(loc=Location.none) pat_env pat_type lst closed_flag = 22 | let pat_desc = Tpat_record (lst, closed_flag) in 23 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 24 | 25 | let tuple ?(loc=Location.none) pat_env pat_type lst = 26 | let pat_desc = Tpat_tuple lst in 27 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 28 | 29 | let construct ?(loc=Location.none) pat_env pat_type lid cstr_desc args = 30 | let pat_desc = Tpat_construct (lid, cstr_desc, args) in 31 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 32 | 33 | let pat_or ?(loc=Location.none) ?row_desc pat_env pat_type p1 p2 = 34 | let pat_desc = Tpat_or (p1, p2, row_desc) in 35 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 36 | 37 | let variant ?(loc=Location.none) pat_env pat_type lbl sub rd = 38 | let pat_desc = Tpat_variant (lbl, sub, rd) in 39 | { pat_desc; pat_loc = loc; pat_extra; pat_attributes; pat_type; pat_env } 40 | end 41 | -------------------------------------------------------------------------------- /src/utils/ppxsetup.mli: -------------------------------------------------------------------------------- 1 | (* {{{ COPYING *( 2 | 3 | This file is part of Merlin, an helper for ocaml editors 4 | 5 | Copyright (C) 2013 - 2015 Frédéric Bour 6 | Thomas Refis 7 | Simon Castellan 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a 10 | copy of this software and associated documentation files (the "Software"), 11 | to deal in the Software without restriction, including without limitation the 12 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | sell copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | The Software is provided "as is", without warranty of any kind, express or 20 | implied, including but not limited to the warranties of merchantability, 21 | fitness for a particular purpose and noninfringement. In no event shall 22 | the authors or copyright holders be liable for any claim, damages or other 23 | liability, whether in an action of contract, tort or otherwise, arising 24 | from, out of or in connection with the software or the use or other dealings 25 | in the Software. 26 | 27 | )* }}} *) 28 | 29 | type t 30 | 31 | val empty: t 32 | val add_ppx: string -> t -> t 33 | val add_ppxopts: string -> string list -> t -> t 34 | 35 | val union: t -> t -> t 36 | 37 | val command_line: t -> string list 38 | 39 | val dump : t -> Std.json 40 | -------------------------------------------------------------------------------- /orig/ocaml_403/typing/envaux.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* OCaml port by John Malecki and Xavier Leroy *) 7 | (* *) 8 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 9 | (* en Automatique. *) 10 | (* *) 11 | (* All rights reserved. This file is distributed under the terms of *) 12 | (* the GNU Lesser General Public License version 2.1, with the *) 13 | (* special exception on linking described in the file LICENSE. *) 14 | (* *) 15 | (**************************************************************************) 16 | 17 | open Format 18 | 19 | (* Convert environment summaries to environments *) 20 | 21 | val env_from_summary : Env.summary -> Subst.t -> Env.t 22 | 23 | (* Empty the environment caches. To be called when load_path changes. *) 24 | 25 | val reset_cache: unit -> unit 26 | 27 | val env_of_only_summary : Env.t -> Env.t 28 | 29 | (* Error report *) 30 | 31 | type error = 32 | Module_not_found of Path.t 33 | 34 | exception Error of error 35 | 36 | val report_error: formatter -> error -> unit 37 | -------------------------------------------------------------------------------- /orig/ocaml_404/typing/envaux.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* OCaml port by John Malecki and Xavier Leroy *) 7 | (* *) 8 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 9 | (* en Automatique. *) 10 | (* *) 11 | (* All rights reserved. This file is distributed under the terms of *) 12 | (* the GNU Lesser General Public License version 2.1, with the *) 13 | (* special exception on linking described in the file LICENSE. *) 14 | (* *) 15 | (**************************************************************************) 16 | 17 | open Format 18 | 19 | (* Convert environment summaries to environments *) 20 | 21 | val env_from_summary : Env.summary -> Subst.t -> Env.t 22 | 23 | (* Empty the environment caches. To be called when load_path changes. *) 24 | 25 | val reset_cache: unit -> unit 26 | 27 | val env_of_only_summary : Env.t -> Env.t 28 | 29 | (* Error report *) 30 | 31 | type error = 32 | Module_not_found of Path.t 33 | 34 | exception Error of error 35 | 36 | val report_error: formatter -> error -> unit 37 | -------------------------------------------------------------------------------- /orig/ocaml_405/typing/envaux.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *) 6 | (* OCaml port by John Malecki and Xavier Leroy *) 7 | (* *) 8 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 9 | (* en Automatique. *) 10 | (* *) 11 | (* All rights reserved. This file is distributed under the terms of *) 12 | (* the GNU Lesser General Public License version 2.1, with the *) 13 | (* special exception on linking described in the file LICENSE. *) 14 | (* *) 15 | (**************************************************************************) 16 | 17 | open Format 18 | 19 | (* Convert environment summaries to environments *) 20 | 21 | val env_from_summary : Env.summary -> Subst.t -> Env.t 22 | 23 | (* Empty the environment caches. To be called when load_path changes. *) 24 | 25 | val reset_cache: unit -> unit 26 | 27 | val env_of_only_summary : Env.t -> Env.t 28 | 29 | (* Error report *) 30 | 31 | type error = 32 | Module_not_found of Path.t 33 | 34 | exception Error of error 35 | 36 | val report_error: formatter -> error -> unit 37 | -------------------------------------------------------------------------------- /preprocessors/explain/gen_explain.ml: -------------------------------------------------------------------------------- 1 | open MenhirSdk 2 | open Cmly_api 3 | open Printf 4 | 5 | module G = Cmly_read.Read(struct let filename = Sys.argv.(1) end) 6 | 7 | open G 8 | 9 | let print_header () = 10 | let name = Filename.chop_extension (Filename.basename Sys.argv.(1)) in 11 | printf "open %s\n" (String.capitalize name) 12 | 13 | let attributes_at st = 14 | List.fold_left 15 | (fun attrs (prod, pos) -> 16 | if pos > 0 then 17 | let _, _, attrs' = (G.Production.rhs prod).(pos - 1) in 18 | attrs' @ attrs 19 | else 20 | attrs) 21 | [] (Lr0.items (Lr1.lr0 st)) 22 | 23 | let print_named_items () = 24 | let print_item st = 25 | match List.filter (Attribute.has_label "item") (attributes_at st) with 26 | | [] -> () 27 | | (x :: _) as xs -> 28 | let xs = List.map Attribute.payload xs |> List.sort_uniq compare in 29 | if List.length xs > 1 then 30 | eprintf "Warning: state %d has multiple items, %s.\n" 31 | (Lr1.to_int st) (String.concat " " xs); 32 | printf " | %d -> %s\n" 33 | (Lr1.to_int st) (Attribute.payload x) 34 | in 35 | printf "let named_item_at = function\n"; 36 | Lr1.iter print_item; 37 | printf " | _ -> raise Not_found\n\n" 38 | 39 | let print_nullable () = 40 | let print_n n = 41 | if Nonterminal.nullable n then 42 | printf " | N_%s -> true\n" (Nonterminal.mangled_name n) 43 | in 44 | printf "let nullable (type a) : a MenhirInterpreter.nonterminal -> bool =\n\ 45 | \ let open MenhirInterpreter in function\n"; 46 | Nonterminal.iter print_n; 47 | printf " | _ -> false\n" 48 | 49 | let () = 50 | print_header (); 51 | print_named_items (); 52 | print_nullable () 53 | -------------------------------------------------------------------------------- /src/ocaml/support/pparse.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Daniel de Rauglaudre, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | open Format 14 | 15 | type error = 16 | | CannotRun of string 17 | | WrongMagic of string 18 | 19 | exception Error of error 20 | 21 | (** If [restore = true] (the default), cookies set by external rewriters will be 22 | kept for later calls. *) 23 | 24 | val apply_rewriters_str: ppx:string list -> ?restore:bool -> tool_name:string -> Parsetree.structure -> Parsetree.structure 25 | val apply_rewriters_sig: ppx:string list -> ?restore:bool -> tool_name:string -> Parsetree.signature -> Parsetree.signature 26 | 27 | val apply_rewriters: ppx:string list -> ?restore:bool -> tool_name:string -> Mreader.parsetree -> Mreader.parsetree 28 | 29 | val report_error : formatter -> error -> unit 30 | 31 | val apply_pp : filename:string -> source:string -> pp:string -> 32 | [> `Interface of Parsetree.signature | `Implementation of Parsetree.structure ] 33 | -------------------------------------------------------------------------------- /orig/ocaml_402/parsing/asttypes.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* Auxiliary a.s.t. types used by parsetree and typedtree. *) 14 | 15 | type constant = 16 | Const_int of int 17 | | Const_char of char 18 | | Const_string of string * string option 19 | | Const_float of string 20 | | Const_int32 of int32 21 | | Const_int64 of int64 22 | | Const_nativeint of nativeint 23 | 24 | type rec_flag = Nonrecursive | Recursive 25 | 26 | type direction_flag = Upto | Downto 27 | 28 | type private_flag = Private | Public 29 | 30 | type mutable_flag = Immutable | Mutable 31 | 32 | type virtual_flag = Virtual | Concrete 33 | 34 | type override_flag = Override | Fresh 35 | 36 | type closed_flag = Closed | Open 37 | 38 | type label = string 39 | 40 | type 'a loc = 'a Location.loc = { 41 | txt : 'a; 42 | loc : Location.t; 43 | } 44 | 45 | 46 | type variance = 47 | | Covariant 48 | | Contravariant 49 | | Invariant 50 | -------------------------------------------------------------------------------- /orig/ocaml_402/typing/cmi_format.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Fabrice Le Fessant, INRIA Saclay *) 6 | (* *) 7 | (* Copyright 2012 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | type pers_flags = Rectypes 14 | 15 | type cmi_infos = { 16 | cmi_name : string; 17 | cmi_sign : Types.signature_item list; 18 | cmi_crcs : (string * Digest.t option) list; 19 | cmi_flags : pers_flags list; 20 | } 21 | 22 | (* write the magic + the cmi information *) 23 | val output_cmi : string -> out_channel -> cmi_infos -> Digest.t 24 | 25 | (* read the cmi information (the magic is supposed to have already been read) *) 26 | val input_cmi : in_channel -> cmi_infos 27 | 28 | (* read a cmi from a filename, checking the magic *) 29 | val read_cmi : string -> cmi_infos 30 | 31 | (* Error report *) 32 | 33 | type error = 34 | Not_an_interface of string 35 | | Wrong_version_interface of string * string 36 | | Corrupted_interface of string 37 | 38 | exception Error of error 39 | 40 | open Format 41 | 42 | val report_error: formatter -> error -> unit 43 | -------------------------------------------------------------------------------- /orig/ocaml_403/typing/oprint.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Format 17 | open Outcometree 18 | 19 | val out_value : (formatter -> out_value -> unit) ref 20 | val out_type : (formatter -> out_type -> unit) ref 21 | val out_class_type : (formatter -> out_class_type -> unit) ref 22 | val out_module_type : (formatter -> out_module_type -> unit) ref 23 | val out_sig_item : (formatter -> out_sig_item -> unit) ref 24 | val out_signature : (formatter -> out_sig_item list -> unit) ref 25 | val out_type_extension : (formatter -> out_type_extension -> unit) ref 26 | val out_phrase : (formatter -> out_phrase -> unit) ref 27 | 28 | val parenthesized_ident : string -> bool 29 | -------------------------------------------------------------------------------- /orig/ocaml_404/typing/oprint.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Format 17 | open Outcometree 18 | 19 | val out_value : (formatter -> out_value -> unit) ref 20 | val out_type : (formatter -> out_type -> unit) ref 21 | val out_class_type : (formatter -> out_class_type -> unit) ref 22 | val out_module_type : (formatter -> out_module_type -> unit) ref 23 | val out_sig_item : (formatter -> out_sig_item -> unit) ref 24 | val out_signature : (formatter -> out_sig_item list -> unit) ref 25 | val out_type_extension : (formatter -> out_type_extension -> unit) ref 26 | val out_phrase : (formatter -> out_phrase -> unit) ref 27 | 28 | val parenthesized_ident : string -> bool 29 | -------------------------------------------------------------------------------- /orig/ocaml_405/typing/oprint.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Format 17 | open Outcometree 18 | 19 | val out_value : (formatter -> out_value -> unit) ref 20 | val out_type : (formatter -> out_type -> unit) ref 21 | val out_class_type : (formatter -> out_class_type -> unit) ref 22 | val out_module_type : (formatter -> out_module_type -> unit) ref 23 | val out_sig_item : (formatter -> out_sig_item -> unit) ref 24 | val out_signature : (formatter -> out_sig_item list -> unit) ref 25 | val out_type_extension : (formatter -> out_type_extension -> unit) ref 26 | val out_phrase : (formatter -> out_phrase -> unit) ref 27 | 28 | val parenthesized_ident : string -> bool 29 | -------------------------------------------------------------------------------- /src/ocaml/typer_402/typing/cmi_format.mli: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Fabrice Le Fessant, INRIA Saclay *) 6 | (* *) 7 | (* Copyright 2012 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | type pers_flags = Rectypes 14 | 15 | type cmi_infos = { 16 | cmi_name : string; 17 | cmi_sign : Types.signature_item list; 18 | cmi_crcs : (string * Digest.t option) list; 19 | cmi_flags : pers_flags list; 20 | } 21 | 22 | (* write the magic + the cmi information *) 23 | val output_cmi : string -> out_channel -> cmi_infos -> Digest.t 24 | 25 | (* read the cmi information (the magic is supposed to have already been read) *) 26 | val input_cmi : in_channel -> cmi_infos 27 | 28 | (* read a cmi from a filename, checking the magic *) 29 | val read_cmi : string -> cmi_infos 30 | 31 | (* Error report *) 32 | 33 | type error = 34 | Not_an_interface of string 35 | | Wrong_version_interface of string * string 36 | | Corrupted_interface of string 37 | 38 | exception Error of error 39 | 40 | open Format 41 | 42 | val report_error: formatter -> error -> unit 43 | -------------------------------------------------------------------------------- /src/ocaml/typer_403/typing/oprint.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Format 17 | open Outcometree 18 | 19 | val out_value : (formatter -> out_value -> unit) ref 20 | val out_type : (formatter -> out_type -> unit) ref 21 | val out_class_type : (formatter -> out_class_type -> unit) ref 22 | val out_module_type : (formatter -> out_module_type -> unit) ref 23 | val out_sig_item : (formatter -> out_sig_item -> unit) ref 24 | val out_signature : (formatter -> out_sig_item list -> unit) ref 25 | val out_type_extension : (formatter -> out_type_extension -> unit) ref 26 | val out_phrase : (formatter -> out_phrase -> unit) ref 27 | 28 | val parenthesized_ident : string -> bool 29 | -------------------------------------------------------------------------------- /src/ocaml/typer_404/typing/oprint.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 2002 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | 16 | open Format 17 | open Outcometree 18 | 19 | val out_value : (formatter -> out_value -> unit) ref 20 | val out_type : (formatter -> out_type -> unit) ref 21 | val out_class_type : (formatter -> out_class_type -> unit) ref 22 | val out_module_type : (formatter -> out_module_type -> unit) ref 23 | val out_sig_item : (formatter -> out_sig_item -> unit) ref 24 | val out_signature : (formatter -> out_sig_item list -> unit) ref 25 | val out_type_extension : (formatter -> out_type_extension -> unit) ref 26 | val out_phrase : (formatter -> out_phrase -> unit) ref 27 | 28 | val parenthesized_ident : string -> bool 29 | --------------------------------------------------------------------------------