├── .github └── workflows │ ├── esy-ci.yml │ ├── nix-build.yml │ ├── opam-ci.yml │ └── print-esy-cache.js ├── .gitignore ├── .npmignore ├── .ocamlformat ├── .ocamlformat-ignore ├── CHANGES.md ├── CODE_OF_CONDUCT.md ├── LICENSE.txt ├── Makefile ├── ORIGINS.md ├── PLAN ├── README.md ├── docs ├── GETTING_STARTED_CONTRIBUTING.md ├── README.md ├── RELEASING.md ├── TYPE_PARAMETERS_PARSING.md ├── USING_PARSER_PROGRAMMATICALLY.md └── site │ ├── Bookmark.js │ ├── ORIGINS.md │ └── theme-white │ ├── theme.js │ └── theme.styl.html ├── dune ├── dune-project ├── esy.json ├── esy.lock.json ├── esy.lock ├── .gitattributes ├── .gitignore ├── index.json ├── opam │ ├── astring.0.8.5 │ │ └── opam │ ├── base-bytes.base │ │ └── opam │ ├── base-threads.base │ │ └── opam │ ├── base-unix.base │ │ └── opam │ ├── camlp-streams.5.0.1 │ │ └── opam │ ├── cmdliner.1.3.0 │ │ └── opam │ ├── cppo.1.8.0 │ │ └── opam │ ├── crunch.4.0.0 │ │ └── opam │ ├── csexp.1.5.2 │ │ └── opam │ ├── dune-build-info.3.17.2 │ │ └── opam │ ├── dune-configurator.3.17.2 │ │ └── opam │ ├── dune.3.17.2 │ │ └── opam │ ├── fix.20230505 │ │ └── opam │ ├── fmt.0.9.0 │ │ └── opam │ ├── fpath.0.7.3 │ │ └── opam │ ├── lambda-term.3.3.2 │ │ └── opam │ ├── logs.0.7.0 │ │ └── opam │ ├── lwt.5.9.0 │ │ └── opam │ ├── lwt_react.1.2.0 │ │ └── opam │ ├── menhir.20240715 │ │ └── opam │ ├── menhirCST.20240715 │ │ └── opam │ ├── menhirLib.20240715 │ │ └── opam │ ├── menhirSdk.20240715 │ │ └── opam │ ├── merlin-extend.0.6.2 │ │ └── opam │ ├── mew.0.1.0 │ │ └── opam │ ├── mew_vi.0.5.0 │ │ └── opam │ ├── ocaml-compiler-libs.v0.12.4 │ │ └── opam │ ├── ocamlbuild.0.16.1 │ │ └── opam │ ├── ocamlfind.1.9.8 │ │ └── opam │ ├── ocplib-endian.1.2 │ │ └── opam │ ├── odoc-parser.3.0.0~beta1 │ │ └── opam │ ├── odoc.3.0.0~beta1 │ │ └── opam │ ├── ppx_derivers.1.2.1 │ │ └── opam │ ├── ppxlib.0.36.0 │ │ └── opam │ ├── ptime.1.2.0 │ │ └── opam │ ├── re.1.12.0 │ │ └── opam │ ├── react.1.2.2 │ │ └── opam │ ├── result.1.5 │ │ └── opam │ ├── seq.base │ │ └── opam │ ├── sexplib0.v0.17.0 │ │ └── opam │ ├── stdlib-shims.0.3.0 │ │ └── opam │ ├── topkg.1.0.7 │ │ └── opam │ ├── trie.1.0.0 │ │ └── opam │ ├── tyxml.4.6.0 │ │ └── opam │ ├── uchar.0.0.2 │ │ └── opam │ ├── utop.2.15.0-1 │ │ └── opam │ ├── uucp.16.0.0 │ │ └── opam │ ├── uuseg.16.0.0 │ │ └── opam │ ├── uutf.1.0.3 │ │ └── opam │ ├── xdg.3.17.2 │ │ └── opam │ ├── yojson.2.2.2 │ │ └── opam │ └── zed.3.2.3 │ │ └── opam └── overrides │ ├── opam__s__ocamlfind_opam__c__1.9.8_opam_override │ ├── files │ │ └── findlib.patch │ └── package.json │ └── opam__s__uchar_opam__c__0.0.2_opam_override │ ├── files │ └── winpatch.patch │ └── package.json ├── flake.lock ├── flake.nix ├── js ├── dune ├── refmt.ml └── testRefmtJs.js ├── nix ├── ci.nix ├── default.nix └── shell.nix ├── package.json ├── reason.json ├── reason.opam ├── rtop.esy.lock ├── .gitattributes ├── .gitignore ├── index.json ├── opam │ ├── base-bytes.base │ │ └── opam │ ├── base-threads.base │ │ └── opam │ ├── base-unix.base │ │ └── opam │ ├── cppo.1.6.9 │ │ └── opam │ ├── csexp.1.5.2 │ │ └── opam │ ├── dot-merlin-reader.4.9 │ │ └── opam │ ├── dune-build-info.3.11.1 │ │ └── opam │ ├── dune-configurator.3.11.1 │ │ └── opam │ ├── dune.3.11.1 │ │ └── opam │ ├── fix.20230505 │ │ └── opam │ ├── lambda-term.3.3.2 │ │ └── opam │ ├── logs.0.7.0 │ │ └── opam │ ├── lwt.5.7.0 │ │ └── opam │ ├── lwt_react.1.2.0 │ │ └── opam │ ├── menhir.20230608 │ │ └── opam │ ├── menhirLib.20230608 │ │ └── opam │ ├── menhirSdk.20230608 │ │ └── opam │ ├── merlin-extend.0.6.1 │ │ └── opam │ ├── merlin-lib.4.12-501 │ │ └── opam │ ├── merlin.4.12-501 │ │ └── opam │ ├── mew.0.1.0 │ │ └── opam │ ├── mew_vi.0.5.0 │ │ └── opam │ ├── ocaml-compiler-libs.v0.12.4 │ │ └── opam │ ├── ocamlbuild.0.14.2+win │ │ └── opam │ ├── ocamlfind.1.9.6 │ │ ├── files │ │ │ └── 0001-Harden-test-for-OCaml-5.patch │ │ └── opam │ ├── ocplib-endian.1.2 │ │ └── opam │ ├── ppx_derivers.1.2.1 │ │ └── opam │ ├── ppxlib.0.31.0 │ │ └── opam │ ├── react.1.2.2 │ │ └── opam │ ├── reason.3.10.0 │ │ └── opam │ ├── result.1.5 │ │ └── opam │ ├── seq.base │ │ ├── files │ │ │ ├── META.seq │ │ │ └── seq.install │ │ └── opam │ ├── sexplib0.v0.16.0 │ │ └── opam │ ├── stdlib-shims.0.3.0 │ │ └── opam │ ├── topkg.1.0.7 │ │ └── opam │ ├── trie.1.0.0 │ │ └── opam │ ├── uchar.0.0.2 │ │ └── opam │ ├── utop.2.13.1 │ │ └── opam │ ├── uucp.15.1.0 │ │ └── opam │ ├── uuseg.15.1.0 │ │ └── opam │ ├── uutf.1.0.3 │ │ └── opam │ ├── xdg.3.11.1 │ │ └── opam │ ├── yojson.2.1.1 │ │ └── opam │ └── zed.3.2.3 │ │ └── opam └── overrides │ ├── opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override │ ├── files │ │ ├── ocamlbuild-0.14.2.patch │ │ └── winpatch.patch │ └── package.json │ ├── opam__s__ocamlfind_opam__c__1.9.6_opam_override │ ├── files │ │ └── findlib.patch │ └── package.json │ └── opam__s__uchar_opam__c__0.0.2_opam_override │ ├── files │ └── winpatch.patch │ └── package.json ├── rtop.json ├── rtop.opam ├── rtop ├── dune ├── reason_toploop.cppo.ml ├── reason_util.ml ├── reason_utop.cppo.ml └── rtop.ml ├── scripts └── esy-prepublish.js ├── src ├── menhir-recover │ ├── Makefile │ ├── attributes.ml │ ├── dune │ ├── emitter.ml │ ├── emitter.mli │ ├── main.ml │ ├── recovery_custom.ml │ ├── recovery_intf.ml │ ├── synthesis.ml │ └── utils.ml ├── reason-merlin │ ├── dune │ └── ocamlmerlin_reason.cppo.ml ├── reason-parser │ ├── TODO │ ├── dune │ ├── error-handling.md │ ├── menhir_error_processor.ml │ ├── merlin_recovery.ml │ ├── merlin_recovery.mli │ ├── ocaml_util.cppo.ml │ ├── reason_attributes.ml │ ├── reason_comment.ml │ ├── reason_config.ml │ ├── reason_declarative_lexer.mll │ ├── reason_errors.ml │ ├── reason_errors.mli │ ├── reason_heuristics.ml │ ├── reason_layout.ml │ ├── reason_lexer.ml │ ├── reason_lexer.mli │ ├── reason_location.ml │ ├── reason_multi_parser.ml │ ├── reason_multi_parser.mli │ ├── reason_oprint.ml │ ├── reason_parser.mly │ ├── reason_parser_def.mli │ ├── reason_parser_explain.ml │ ├── reason_pprint_ast.ml │ ├── reason_pprint_ast.mli │ ├── reason_recover_parser.ml │ ├── reason_recover_parser.mli │ ├── reason_single_parser.ml │ ├── reason_single_parser.mli │ ├── reason_syntax_util.ml │ ├── reason_syntax_util.mli │ ├── reason_toolchain.ml │ ├── reason_toolchain_conf.ml │ ├── reason_toolchain_ocaml.ml │ ├── reason_toolchain_reason.ml │ └── vendor │ │ ├── cmdliner │ │ ├── VERSION │ │ ├── cmdliner_arg.ml │ │ ├── cmdliner_arg.mli │ │ ├── cmdliner_base.ml │ │ ├── cmdliner_base.mli │ │ ├── cmdliner_cline.ml │ │ ├── cmdliner_cline.mli │ │ ├── cmdliner_cmd.ml │ │ ├── cmdliner_cmd.mli │ │ ├── cmdliner_docgen.ml │ │ ├── cmdliner_docgen.mli │ │ ├── cmdliner_eval.ml │ │ ├── cmdliner_eval.mli │ │ ├── cmdliner_exit.ml │ │ ├── cmdliner_exit.mli │ │ ├── cmdliner_info.ml │ │ ├── cmdliner_info.mli │ │ ├── cmdliner_manpage.ml │ │ ├── cmdliner_manpage.mli │ │ ├── cmdliner_msg.ml │ │ ├── cmdliner_msg.mli │ │ ├── cmdliner_term.ml │ │ ├── cmdliner_term.mli │ │ ├── cmdliner_term_deprecated.ml │ │ ├── cmdliner_trie.ml │ │ ├── cmdliner_trie.mli │ │ ├── dune │ │ ├── vendored_cmdliner.ml │ │ └── vendored_cmdliner.mli │ │ └── easy_format │ │ ├── VERSION │ │ ├── dune │ │ ├── vendored_easy_format.ml │ │ └── vendored_easy_format.mli ├── refmt │ ├── .gitignore │ ├── README.md │ ├── dune │ ├── eol_convert.ml │ ├── eol_detect.ml │ ├── git_commit.mli │ ├── package.ml │ ├── printer_maker.ml │ ├── reason_implementation_printer.ml │ ├── reason_implementation_printer.mli │ ├── reason_interface_printer.ml │ ├── reason_interface_printer.mli │ ├── refmt.ml │ └── refmt_args.ml ├── refmttype │ ├── dune │ ├── reason_format_type.ml │ └── reason_type_of_ocaml_type.ml └── vendored-omp │ ├── CHANGES.md │ ├── LICENSE.md │ ├── MANUAL.md │ ├── Makefile │ ├── README.md │ ├── dune │ ├── dune-project-old │ ├── dune-workspace.dev │ ├── examples │ ├── omp_ppx_define │ │ ├── META │ │ ├── Makefile │ │ ├── ppx_define.ml │ │ ├── standalone.ml │ │ └── test.ml │ ├── omp_ppx_here │ │ ├── META │ │ ├── Makefile │ │ ├── ppx_here.ml │ │ └── standalone.ml │ └── omp_ppx_parse │ │ ├── META │ │ ├── Makefile │ │ ├── ppx_parse.ml │ │ ├── standalone.ml │ │ └── test.ml │ ├── ocaml-migrate-parsetree.backup-opam │ ├── src │ ├── ast_402.ml │ ├── ast_403.ml │ ├── ast_404.ml │ ├── ast_405.ml │ ├── ast_406.ml │ ├── ast_407.ml │ ├── ast_408.ml │ ├── ast_409.ml │ ├── ast_410.ml │ ├── ast_411.ml │ ├── ast_412.ml │ ├── ast_413.ml │ ├── ast_414.ml │ ├── ast_500.ml │ ├── ast_51.ml │ ├── ast_52.ml │ ├── ast_53.ml │ ├── caml_format_doc.cppo.ml │ ├── cinaps_helpers │ ├── compiler-functions │ │ ├── ge_406_and_lt_408.ml │ │ ├── ge_408_and_lt_410.ml │ │ ├── ge_410_and_lt_412.ml │ │ ├── ge_412.ml │ │ ├── ge_50.ml │ │ ├── ge_52.ml │ │ └── lt_406.ml │ ├── config │ │ └── gen.ml │ ├── dune │ ├── locations.ml │ ├── migrate_parsetree_402_403.ml │ ├── migrate_parsetree_402_403_migrate.ml │ ├── migrate_parsetree_403_402.ml │ ├── migrate_parsetree_403_402_migrate.ml │ ├── migrate_parsetree_403_404.ml │ ├── migrate_parsetree_403_404_migrate.ml │ ├── migrate_parsetree_404_403.ml │ ├── migrate_parsetree_404_403_migrate.ml │ ├── migrate_parsetree_404_405.ml │ ├── migrate_parsetree_404_405_migrate.ml │ ├── migrate_parsetree_405_404.ml │ ├── migrate_parsetree_405_404_migrate.ml │ ├── migrate_parsetree_405_406.ml │ ├── migrate_parsetree_405_406_migrate.ml │ ├── migrate_parsetree_406_405.ml │ ├── migrate_parsetree_406_405_migrate.ml │ ├── migrate_parsetree_406_407.ml │ ├── migrate_parsetree_406_407_migrate.ml │ ├── migrate_parsetree_407_406.ml │ ├── migrate_parsetree_407_406_migrate.ml │ ├── migrate_parsetree_407_408.ml │ ├── migrate_parsetree_407_408_migrate.ml │ ├── migrate_parsetree_408_407.ml │ ├── migrate_parsetree_408_407_migrate.ml │ ├── migrate_parsetree_408_409.ml │ ├── migrate_parsetree_408_409_migrate.ml │ ├── migrate_parsetree_409_408.ml │ ├── migrate_parsetree_409_408_migrate.ml │ ├── migrate_parsetree_409_410.ml │ ├── migrate_parsetree_409_410_migrate.ml │ ├── migrate_parsetree_410_409.ml │ ├── migrate_parsetree_410_409_migrate.ml │ ├── migrate_parsetree_410_411.ml │ ├── migrate_parsetree_410_411_migrate.ml │ ├── migrate_parsetree_411_410.ml │ ├── migrate_parsetree_411_410_migrate.ml │ ├── migrate_parsetree_411_412.ml │ ├── migrate_parsetree_411_412_migrate.ml │ ├── migrate_parsetree_412_411.ml │ ├── migrate_parsetree_412_411_migrate.ml │ ├── migrate_parsetree_412_413.ml │ ├── migrate_parsetree_412_413_migrate.ml │ ├── migrate_parsetree_413_412.ml │ ├── migrate_parsetree_413_412_migrate.ml │ ├── migrate_parsetree_413_414.ml │ ├── migrate_parsetree_413_414_migrate.ml │ ├── migrate_parsetree_414_413.ml │ ├── migrate_parsetree_414_413_migrate.ml │ ├── migrate_parsetree_414_500.ml │ ├── migrate_parsetree_414_500_migrate.ml │ ├── migrate_parsetree_500_414.ml │ ├── migrate_parsetree_500_414_migrate.ml │ ├── migrate_parsetree_500_51.ml │ ├── migrate_parsetree_500_51_migrate.ml │ ├── migrate_parsetree_51_500.ml │ ├── migrate_parsetree_51_500_migrate.ml │ ├── migrate_parsetree_51_52.ml │ ├── migrate_parsetree_51_52_migrate.ml │ ├── migrate_parsetree_52_51.ml │ ├── migrate_parsetree_52_51_migrate.ml │ ├── migrate_parsetree_52_53.ml │ ├── migrate_parsetree_52_53_migrate.ml │ ├── migrate_parsetree_53_52.ml │ ├── migrate_parsetree_53_52_migrate.ml │ ├── migrate_parsetree_def.ml │ ├── migrate_parsetree_def.mli │ ├── migrate_parsetree_driver_main.ml │ ├── migrate_parsetree_versions.ml │ ├── migrate_parsetree_versions.mli │ ├── reason_omp.ml │ └── stdlib0.ml │ └── tools │ ├── add_special_comments.ml │ ├── add_special_comments.mli │ ├── dune │ ├── gencopy.ml │ ├── pp.ml │ ├── pp.mli │ ├── pp_rewrite.mli │ └── pp_rewrite.mll └── test ├── 4.06 ├── attributes.t ├── dune ├── error-comments.t ├── error-lowercase_module.t ├── error-lowercase_module_rec.t ├── error-reservedField.t ├── error-reservedRecord.t ├── error-reservedRecordPunned.t ├── error-reservedRecordType.t ├── error-reservedRecordTypePunned.t ├── error-syntaxError.t ├── objects.t ├── type-trailing.t │ ├── input.re │ └── run.t └── typecheck-module-and-class.t ├── 4.08 ├── dune ├── error-comments.t ├── error-lowercase_module.t ├── error-lowercase_module_rec.t ├── error-reservedField.t ├── error-reservedRecord.t ├── error-reservedRecordPunned.t ├── error-reservedRecordType.t ├── error-reservedRecordTypePunned.t ├── error-syntaxError.t ├── mlSyntax.t │ ├── input.ml │ └── run.t ├── type-jsx.t │ ├── input.re │ └── run.t └── typecheck-features.t ├── 4.10 ├── attributes-re.t │ ├── input.re │ └── run.t ├── dune ├── local-openings.t │ ├── input.ml │ └── run.t ├── reasonComments-re.t │ ├── input.re │ └── run.t ├── type-jsx.t │ ├── input.re │ └── run.t └── typecheck-let-ops.t ├── 4.12 ├── attributes-re.t │ ├── input.re │ └── run.t ├── dune ├── local-openings.t │ ├── input.ml │ └── run.t ├── reasonComments-re.t │ ├── input.re │ └── run.t ├── type-jsx.t │ ├── input.re │ └── run.t └── typecheck-let-ops.t ├── README.md ├── arityConversion.t ├── arity.txt ├── input.ml └── run.t ├── assert.t ├── input.re └── run.t ├── attributes-rei.t ├── input.rei └── run.t ├── backportSyntax.t ├── input.re └── run.t ├── basic.t ├── input.re └── run.t ├── basicStructures.t ├── input.re └── run.t ├── basics.t ├── input.re └── run.t ├── basics_no_semi.t ├── input.re └── run.t ├── bigarray.t ├── input.re └── run.t ├── bigarraySyntax.t ├── input.re └── run.t ├── bucklescript.t ├── input.re └── run.t ├── class.t ├── input.re └── run.t ├── class_types.t ├── input.re └── run.t ├── comments-ml.t ├── input.ml └── run.t ├── comments-mli.t ├── input.mli └── run.t ├── dune ├── emptyFileComment.t ├── input.re └── run.t ├── escapesInStrings.t ├── input.re └── run.t ├── extension-exprs.t ├── input.re └── run.t ├── extension-str-in-module.t ├── extensions.t ├── input.re └── run.t ├── externals.t ├── input.re └── run.t ├── fdLeak.t ├── input.re └── run.t ├── firstClassModules.t ├── input.re └── run.t ├── fixme.t ├── input.re └── run.t ├── functionInfix.t ├── input.re └── run.t ├── general-syntax-re.t ├── input.re └── run.t ├── general-syntax-rei.t ├── input.rei └── run.t ├── generics.t ├── input.re └── run.t ├── if.t ├── input.re └── run.t ├── imperative.t ├── input.re └── run.t ├── infix.t ├── input.re └── run.t ├── inlineRecord.t ├── input.re └── run.t ├── jsx.t ├── input.re └── run.t ├── jsx_functor.t ├── input.re └── run.t ├── knownMlIssues.t ├── input.ml └── run.t ├── knownReIssues.t ├── input.re └── run.t ├── lazy.t ├── input.re └── run.t ├── letop.t ├── input.re └── run.t ├── lib ├── dune ├── fdLeak.ml └── outcometreePrinter.cppo.ml ├── lineComments.t ├── input.re └── run.t ├── mlFunctions.t ├── input.ml └── run.t ├── mlVariants.t ├── input.ml └── run.t ├── modules.t ├── input.re └── run.t ├── modules_no_semi.t ├── input.re └── run.t ├── mutation.t ├── input.re └── run.t ├── object.t ├── input.re └── run.t ├── ocaml_identifiers.t ├── input.ml └── run.t ├── oo.t ├── input.re └── run.t ├── patternMatching.t ├── input.re └── run.t ├── pervasive.t ├── input.mli └── run.t ├── pexpFun.t ├── input.re └── run.t ├── pipeFirst.t ├── input.re └── run.t ├── polymorphism.t ├── input.re └── run.t ├── print-width-env.t ├── raw-identifiers.t ├── input.re └── run.t ├── reasonComments-rei.t ├── input.rei └── run.t ├── rtopIntegration.t ├── sequences.t ├── input.re └── run.t ├── sharpop.t ├── input.re └── run.t ├── singleLineCommentEof.t ├── input.re └── run.t ├── testUtils.t ├── input.re └── run.t ├── trailing.t ├── input.re └── run.t ├── trailingSpaces.t ├── input.re └── run.t ├── type-pipeFirst.t ├── input.re └── run.t ├── typeDeclarations.t ├── input.re └── run.t ├── typeParameters.t ├── input.re └── run.t ├── uchar-esc.t ├── input.re └── run.t ├── uncurried.t ├── input.re └── run.t ├── unicodeIdentifiers.t ├── input.re └── run.t ├── variants.t ├── input.re └── run.t ├── version.t ├── whitespace-re.t ├── input.re └── run.t ├── whitespace-rei.t ├── input.rei └── run.t ├── wrapping-re.t ├── input.re └── run.t └── wrapping-rei.t ├── input.rei └── run.t /.github/workflows/print-esy-cache.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const os = require("os"); 3 | const path = require("path"); 4 | 5 | const ESY_FOLDER = process.env.ESY__PREFIX 6 | ? process.env.ESY__PREFIX 7 | : path.join(os.homedir(), ".esy"); 8 | 9 | const someEsy3 = fs 10 | .readdirSync(ESY_FOLDER) 11 | .filter((name) => name.length > 0 && name[0] === "3"); 12 | 13 | const esy3 = someEsy3 14 | .sort() 15 | .pop(); 16 | 17 | console.log(path.join(ESY_FOLDER, esy3, "i")); 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | .DS_Store 3 | *.log 4 | 5 | # gitignored, but not npmignored. Published by `npm run prepublish` 6 | refmt.js 7 | refmt.map 8 | 9 | # Esy 10 | _esy 11 | _esybuild 12 | _esyinstall 13 | _release 14 | _export/ 15 | 16 | # opam 17 | _opam/ 18 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | _esy 2 | node_modules 3 | _build 4 | .git 5 | refmt.js 6 | refmt.map 7 | -------------------------------------------------------------------------------- /.ocamlformat: -------------------------------------------------------------------------------- 1 | break-infix = fit-or-vertical 2 | break-infix-before-func = false 3 | break-fun-decl = fit-or-vertical 4 | break-separators = before 5 | break-sequences = true 6 | cases-exp-indent = 2 7 | dock-collection-brackets = false 8 | field-space = loose 9 | if-then-else = keyword-first 10 | indicate-multiline-delimiters = no 11 | infix-precedence = parens 12 | leading-nested-match-parens = true 13 | let-and = sparse 14 | let-module = sparse 15 | ocp-indent-compat = true 16 | parens-tuple = multi-line-only 17 | parse-docstrings = true 18 | sequence-blank-line = preserve-one 19 | sequence-style = terminator 20 | single-case = sparse 21 | space-around-arrays= true 22 | space-around-lists= true 23 | space-around-records= true 24 | space-around-variants= true 25 | type-decl = sparse 26 | wrap-comments = true 27 | wrap-fun-args = false 28 | -------------------------------------------------------------------------------- /.ocamlformat-ignore: -------------------------------------------------------------------------------- 1 | src/vendored-omp/** 2 | src/reason-parser/vendor/** 3 | test/**.cppo.ml 4 | src/**.cppo.ml 5 | src/**.cppo.mli 6 | rtop/**.cppo.ml 7 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated. 4 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2015-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PLAN: -------------------------------------------------------------------------------- 1 | Fix error recovery & error reporting 2 | 3 | Step 1: remove existing implementation 4 | 5 | OK * Put reason parser in its own file 6 | OK * Remove menhir error management: 7 | OK - remove "error" token 8 | OK - remove error messages infrastructure 9 | OK Now message defaults to "Syntax error" 10 | * Fix reported error location (when recovering or not) 11 | 12 | Step 2: reintroduce recovery 13 | * Preprocess grammar: 14 | - check exhaustivity of recovery 15 | - produce a mapping of automaton states to automaton-items suitable for 16 | recovery 17 | * Instrument parser: 18 | - first, always complete the AST and drop user input (":'(") 19 | - second, introduce an heuristic for recovering based on location 20 | 21 | Step 3: reintroduce error messages 22 | * Ask the crowd: 23 | What should messages look like? 24 | Which situations are tricky or counter-intuitive? 25 | * Make a testsuite representative of common syntax errors 26 | * ... Design an analysis sufficient to produce the messages automatically 27 | :P 28 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ### Documentation 2 | 3 | > This directory is not the Reason _User_ documentation. This directory is for 4 | > Reason contributor documentation. **The Reason user docs live online at 5 | > [https://reasonml.github.io](https://reasonml.github.io)**. The repo for 6 | > those Reason docs lives at 7 | > [github.com/reasonml/reasonml.github.io](https://github.com/reasonml/reasonml.github.io) 8 | 9 | **Inside of this directory:** 10 | 11 | 12 | **Getting Started Contributing:** 13 | 14 | [`GETTING_STARTED_CONTRIBUTING.md`](./GETTING_STARTED_CONTRIBUTING.md). 15 | 16 | **Releasing:** 17 | [`RELEASING.md`](./RELEASING.md) 18 | 19 | **Programmatically Using Reason Parser From JavaScript:** 20 | [`USING_PARSER_PROGRAMMATICALLY.md`](./USING_PARSER_PROGRAMMATICALLY.md) 21 | 22 | -------------------------------------------------------------------------------- /dune: -------------------------------------------------------------------------------- 1 | (dirs :standard \ node_modules js) 2 | 3 | ; (install 4 | ; (package reason) 5 | ; (section bin) 6 | ; (files src/refmt/refmt.bc)) 7 | -------------------------------------------------------------------------------- /esy.lock/.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | # Set eol to LF so files aren't converted to CRLF-eol on Windows. 3 | * text eol=lf linguist-generated 4 | -------------------------------------------------------------------------------- /esy.lock/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Reset any possible .gitignore, we want all esy.lock to be un-ignored. 3 | !* 4 | -------------------------------------------------------------------------------- /esy.lock/opam/base-bytes.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: " " 3 | authors: " " 4 | homepage: " " 5 | depends: [ 6 | "ocaml" {>= "4.02.0"} 7 | "ocamlfind" {>= "1.5.3"} 8 | ] 9 | synopsis: "Bytes library distributed with the OCaml compiler" 10 | x-maintained: true 11 | -------------------------------------------------------------------------------- /esy.lock/opam/base-threads.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "https://github.com/ocaml/opam-repository/issues" 3 | description: """ 4 | Threads library distributed with the OCaml compiler 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /esy.lock/opam/base-unix.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "https://github.com/ocaml/opam-repository/issues" 3 | description: """ 4 | Unix library distributed with the OCaml compiler 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /esy.lock/opam/fix.20230505/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | ] 7 | homepage: "https://gitlab.inria.fr/fpottier/fix" 8 | dev-repo: "git+https://gitlab.inria.fr/fpottier/fix.git" 9 | bug-reports: "francois.pottier@inria.fr" 10 | license: "LGPL-2.0-only" 11 | build: [ 12 | ["dune" "build" "-p" name "-j" jobs] 13 | ] 14 | depends: [ 15 | "ocaml" { >= "4.03" } 16 | "dune" { >= "1.3" } 17 | ] 18 | synopsis: "Algorithmic building blocks for memoization, recursion, and more" 19 | url { 20 | src: 21 | "https://gitlab.inria.fr/fpottier/fix/-/archive/20230505/archive.tar.gz" 22 | checksum: [ 23 | "md5=2a4afa633128c5010677222f7b3c9451" 24 | "sha512=30d446ba6c19aef78b52d9831eb26f8f6ac10e88bd1eff36d16fbbfb32278b2637e31e63a160aec4abbbfdb1e7612ed25d68c936f4cbf2073e51d713ff3a8adf" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /esy.lock/opam/fpath.0.7.3/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Daniel Bünzli " 3 | authors: ["The fpath programmers"] 4 | homepage: "https://erratique.ch/software/fpath" 5 | doc: "https://erratique.ch/software/fpath/doc" 6 | dev-repo: "git+https://erratique.ch/repos/fpath.git" 7 | bug-reports: "https://github.com/dbuenzli/fpath/issues" 8 | tags: [ "file" "system" "path" "org:erratique" ] 9 | license: "ISC" 10 | depends: [ 11 | "ocaml" {>= "4.03.0"} 12 | "ocamlfind" {build} 13 | "ocamlbuild" {build} 14 | "topkg" {build & >= "0.9.0"} 15 | "astring" 16 | ] 17 | build: [[ 18 | "ocaml" "pkg/pkg.ml" "build" 19 | "--dev-pkg=true" {dev} ]] 20 | 21 | synopsis: """File system paths for OCaml""" 22 | description: """\ 23 | 24 | Fpath is an OCaml module for handling file system paths with POSIX or 25 | Windows conventions. Fpath processes paths without accessing the file 26 | system and is independent from any system library. 27 | 28 | Fpath depends on [Astring][astring] and is distributed under the ISC 29 | license. 30 | 31 | [astring]: http://erratique.ch/software/astring 32 | """ 33 | url { 34 | src: "https://erratique.ch/software/fpath/releases/fpath-0.7.3.tbz" 35 | checksum: [ 36 | "sha256=12b08ff192d037d9b6d69e9ca19d1d385184f20b3237c27231e437ac81ace70f" 37 | "md5=0740b530e8fed5b0adc5eee8463cfc2f" 38 | ] 39 | } 40 | 41 | x-maintenance-intent: ["(latest)"] -------------------------------------------------------------------------------- /esy.lock/opam/lwt_react.1.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | 3 | synopsis: "Helpers for using React with Lwt" 4 | license: "MIT" 5 | homepage: "https://github.com/ocsigen/lwt" 6 | doc: "https://ocsigen.org/lwt/dev/api/Lwt_react" 7 | bug-reports: "https://github.com/ocsigen/lwt/issues" 8 | 9 | authors: [ 10 | "Jérémie Dimino" 11 | ] 12 | maintainer: [ 13 | "Anton Bachin " 14 | ] 15 | dev-repo: "git+https://github.com/ocsigen/lwt.git" 16 | 17 | depends: [ 18 | "dune" {>= "1.8.0"} 19 | "lwt" {>= "3.0.0"} 20 | "ocaml" {>= "4.08"} 21 | "react" {>= "1.0.0"} 22 | "cppo" {build & >= "1.1.0"} 23 | ] 24 | 25 | build: [ 26 | ["dune" "build" "-p" name "-j" jobs] 27 | ] 28 | url { 29 | src: "https://github.com/ocsigen/lwt/archive/5.6.0.tar.gz" 30 | checksum: [ 31 | "md5=e63979ee40a80d5b9e9e5545f33323b4" 32 | "sha512=d616389bc9e0da11f25843ab7541ac2d40c9543700a89455f14115b339bbe58cef2b8acf0ae97fd54e15a4cb93149cfe1ebfda301aa93933045f76b7d9344160" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /esy.lock/opam/menhir.20240715/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "GPL-2.0-only" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" {>= "4.03.0"} 17 | "dune" {>= "2.8.0"} 18 | "menhirLib" {= version} 19 | "menhirSdk" {= version} 20 | "menhirCST" {= version} 21 | ] 22 | synopsis: "An LR(1) parser generator" 23 | url { 24 | src: 25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20240715/archive.tar.gz" 26 | checksum: [ 27 | "md5=d39a8943fe1be28199e5ec1f4133504c" 28 | "sha512=4f933cfc9026f5f2ffda9b0e626862560a233c35ecf097d179edd926d9009bdf46b6611294aea02b63c34427348568f37376a033fbe8cf98a7746fa6f1354dbd" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /esy.lock/opam/menhirCST.20240715/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | ] 7 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 8 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 9 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 10 | license: "LGPL-2.0-only WITH OCaml-LGPL-linking-exception" 11 | build: [ 12 | ["dune" "build" "-p" name "-j" jobs] 13 | ] 14 | depends: [ 15 | "ocaml" { >= "4.08" } 16 | "dune" { >= "2.8.0" } 17 | ] 18 | conflicts: [ 19 | "menhir" { != version } 20 | ] 21 | synopsis: "Runtime support library for parsers generated by Menhir" 22 | url { 23 | src: 24 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20240715/archive.tar.gz" 25 | checksum: [ 26 | "md5=d39a8943fe1be28199e5ec1f4133504c" 27 | "sha512=4f933cfc9026f5f2ffda9b0e626862560a233c35ecf097d179edd926d9009bdf46b6611294aea02b63c34427348568f37376a033fbe8cf98a7746fa6f1354dbd" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /esy.lock/opam/menhirLib.20240715/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "LGPL-2.0-only WITH OCaml-LGPL-linking-exception" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" { >= "4.03.0" } 17 | "dune" { >= "2.8.0" } 18 | ] 19 | conflicts: [ 20 | "menhir" { != version } 21 | ] 22 | synopsis: "Runtime support library for parsers generated by Menhir" 23 | url { 24 | src: 25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20240715/archive.tar.gz" 26 | checksum: [ 27 | "md5=d39a8943fe1be28199e5ec1f4133504c" 28 | "sha512=4f933cfc9026f5f2ffda9b0e626862560a233c35ecf097d179edd926d9009bdf46b6611294aea02b63c34427348568f37376a033fbe8cf98a7746fa6f1354dbd" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /esy.lock/opam/menhirSdk.20240715/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "LGPL-2.0-only WITH OCaml-LGPL-linking-exception" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" { >= "4.03.0" } 17 | "dune" { >= "2.8.0" } 18 | ] 19 | conflicts: [ 20 | "menhir" { != version } 21 | ] 22 | synopsis: "Compile-time library for auxiliary tools related to Menhir" 23 | url { 24 | src: 25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20240715/archive.tar.gz" 26 | checksum: [ 27 | "md5=d39a8943fe1be28199e5ec1f4133504c" 28 | "sha512=4f933cfc9026f5f2ffda9b0e626862560a233c35ecf097d179edd926d9009bdf46b6611294aea02b63c34427348568f37376a033fbe8cf98a7746fa6f1354dbd" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /esy.lock/opam/merlin-extend.0.6.2/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Frederic Bour " 3 | authors: "Frederic Bour " 4 | homepage: "https://github.com/let-def/merlin-extend" 5 | bug-reports: "https://github.com/let-def/merlin-extend" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/let-def/merlin-extend.git" 8 | build: [ 9 | ["dune" "subst"] {dev} 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "dune" {>= "1.0"} 14 | "cppo" {build & >= "1.1.0"} 15 | "ocaml" {>= "4.02.3"} 16 | ] 17 | synopsis: "A protocol to provide custom frontend to Merlin" 18 | description: """ 19 | This protocol allows to replace the OCaml frontend of Merlin. 20 | It extends what used to be done with the `-pp' flag to handle a few more cases.""" 21 | doc: "https://let-def.github.io/merlin-extend" 22 | url { 23 | src: 24 | "https://github.com/let-def/merlin-extend/releases/download/v0.6.2/merlin-extend-0.6.2.tbz" 25 | checksum: [ 26 | "sha256=47558e7f30b64462f2b9c82fb7f787133acfa0d5132452b6ad7848e0b0f4d779" 27 | "sha512=50696cb2099b84d4a5497fb778c969ca446e5639a91bcde6e2177588fbf72fe4f7a3c27b62384292ad873291719c5893673f1acce4755e81b5e05f9fd3e45b65" 28 | ] 29 | } 30 | x-commit-hash: "098988ee19502645cf039b41027ec4f5e89197ab" 31 | -------------------------------------------------------------------------------- /esy.lock/opam/mew.0.1.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "zandoye@gmail.com" 3 | authors: [ "ZAN DoYe" ] 4 | homepage: "https://github.com/kandu/mew" 5 | bug-reports: "https://github.com/kandu/mew/issues" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/kandu/mew.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" {>= "4.02.3"} 13 | "result" 14 | "trie" {>= "1.0.0"} 15 | "dune" {>= "1.1.0"} 16 | ] 17 | 18 | synopsis: "Modal editing witch" 19 | description: """ 20 | This is the core module of mew, a general modal editing engine generator.""" 21 | 22 | url { 23 | src: "https://github.com/kandu/mew/archive/0.1.0.tar.gz" 24 | checksum: [ 25 | "sha256=64d38ceb52ef574cb314bdd693f7e4a9c9e483e80a58595db22f2df76a8a59e6" 26 | "md5=2298149d1415cd804ab4e01f01ea10a0" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /esy.lock/opam/mew_vi.0.5.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "zandoye@gmail.com" 3 | authors: [ "ZAN DoYe" ] 4 | homepage: "https://github.com/kandu/mew_vi" 5 | bug-reports: "https://github.com/kandu/mew_vi/issues" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/kandu/mew_vi.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" {>= "4.02.3"} 13 | "mew" {>= "0.1.0" & < "0.2"} 14 | "react" 15 | "dune" {>= "1.1.0"} 16 | ] 17 | 18 | synopsis: "Modal editing witch, VI interpreter" 19 | description: """ 20 | A vi-like modal editing engine generator.""" 21 | 22 | url { 23 | src: "https://github.com/kandu/mew_vi/archive/0.5.0.tar.gz" 24 | checksum: [ 25 | "sha256=a692fa7cdcc9e80fd9387c4f61677776b9fc15f9f7175b4220fcd1a73d1bafda" 26 | "md5=341e9a9a20383641015bf503952906bc" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "OCaml compiler libraries repackaged" 3 | description: """ 4 | This packages exposes the OCaml compiler libraries repackages under 5 | the toplevel names Ocaml_common, Ocaml_bytecomp, Ocaml_optcomp, ...""" 6 | maintainer: ["Jane Street developers"] 7 | authors: ["Jane Street Group, LLC"] 8 | license: "MIT" 9 | homepage: "https://github.com/janestreet/ocaml-compiler-libs" 10 | bug-reports: "https://github.com/janestreet/ocaml-compiler-libs/issues" 11 | depends: [ 12 | "dune" {>= "2.8"} 13 | "ocaml" {>= "4.04.1" & < "5.2.0"} 14 | "odoc" {with-doc} 15 | ] 16 | build: [ 17 | ["dune" "subst"] {dev} 18 | [ 19 | "dune" 20 | "build" 21 | "-p" 22 | name 23 | "-j" 24 | jobs 25 | "@install" 26 | "@runtest" {with-test} 27 | "@doc" {with-doc} 28 | ] 29 | ] 30 | dev-repo: "git+https://github.com/janestreet/ocaml-compiler-libs.git" 31 | url { 32 | src: 33 | "https://github.com/janestreet/ocaml-compiler-libs/releases/download/v0.12.4/ocaml-compiler-libs-v0.12.4.tbz" 34 | checksum: [ 35 | "sha256=4ec9c9ec35cc45c18c7a143761154ef1d7663036a29297f80381f47981a07760" 36 | "sha512=978dba8dfa61f98fa24fda7a9c26c2e837081f37d1685fe636dc19cfc3278a940cf01a10293504b185c406706bc1008bc54313d50f023bcdea6d5ac6c0788b35" 37 | ] 38 | } 39 | x-commit-hash: "8cd12f18bb7171c2b67d661868c4271fae528d93" 40 | -------------------------------------------------------------------------------- /esy.lock/opam/ppx_derivers.1.2.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "jeremie@dimino.org" 3 | authors: ["Jérémie Dimino"] 4 | license: "BSD-3-Clause" 5 | homepage: "https://github.com/ocaml-ppx/ppx_derivers" 6 | bug-reports: "https://github.com/ocaml-ppx/ppx_derivers/issues" 7 | dev-repo: "git+https://github.com/ocaml-ppx/ppx_derivers.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" 13 | "dune" 14 | ] 15 | synopsis: "Shared [@@deriving] plugin registry" 16 | description: """ 17 | Ppx_derivers is a tiny package whose sole purpose is to allow 18 | ppx_deriving and ppx_type_conv to inter-operate gracefully when linked 19 | as part of the same ocaml-migrate-parsetree driver.""" 20 | url { 21 | src: "https://github.com/ocaml-ppx/ppx_derivers/archive/1.2.1.tar.gz" 22 | checksum: [ 23 | "sha256=b6595ee187dea792b31fc54a0e1524ab1e48bc6068d3066c45215a138cc73b95" 24 | "md5=5dc2bf130c1db3c731fe0fffc5648b41" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /esy.lock/opam/result.1.5/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/result" 5 | dev-repo: "git+https://github.com/janestreet/result.git" 6 | bug-reports: "https://github.com/janestreet/result/issues" 7 | license: "BSD-3-Clause" 8 | build: [["dune" "build" "-p" name "-j" jobs]] 9 | depends: [ 10 | "ocaml" 11 | "dune" {>= "1.0"} 12 | ] 13 | synopsis: "Compatibility Result module" 14 | description: """ 15 | Projects that want to use the new result type defined in OCaml >= 4.03 16 | while staying compatible with older version of OCaml should use the 17 | Result module defined in this library.""" 18 | url { 19 | src: 20 | "https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz" 21 | checksum: [ 22 | "sha256=7c3a5e238558f4c1a4f5acca816bc705a0e12f68dc0005c61ddbf2e6cab8ee32" 23 | "md5=1b82dec78849680b49ae9a8a365b831b" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /esy.lock/opam/seq.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: " " 3 | authors: " " 4 | homepage: " " 5 | depends: [ 6 | "ocaml" {>= "4.07.0"} 7 | ] 8 | dev-repo: "git+https://github.com/ocaml/ocaml.git" 9 | bug-reports: "https://caml.inria.fr/mantis/main_page.php" 10 | synopsis: 11 | "Compatibility package for OCaml's standard iterator type starting from 4.07." 12 | extra-source "seq.install" { 13 | src: 14 | "https://raw.githubusercontent.com/ocaml/opam-source-archives/main/patches/seq/seq.install" 15 | checksum: [ 16 | "sha256=fff926c2c4d5a82b6c94c60c4c35eb06e3d39975893ebe6b1f0e6557cbe34904" 17 | "md5=026b31e1df290373198373d5aaa26e42" 18 | ] 19 | } 20 | extra-source "META.seq" { 21 | src: 22 | "https://raw.githubusercontent.com/ocaml/opam-source-archives/main/patches/seq/META.seq" 23 | checksum: [ 24 | "sha256=e95062b4d0519ef8335c02f7d0f1952d11b814c7ab7e6d566a206116162fa2be" 25 | "md5=b33c8a1a6c7ed797816ce27df4855107" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /esy.lock/opam/sexplib0.v0.17.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/sexplib0" 5 | bug-reports: "https://github.com/janestreet/sexplib0/issues" 6 | dev-repo: "git+https://github.com/janestreet/sexplib0.git" 7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/sexplib0/index.html" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "4.14.0"} 14 | "dune" {>= "3.11.0"} 15 | ] 16 | available: arch != "arm32" & arch != "x86_32" 17 | synopsis: "Library containing the definition of S-expressions and some base converters" 18 | description: " 19 | Part of Jane Street's Core library 20 | The Core suite of libraries is an industrial strength alternative to 21 | OCaml's standard library that was developed by Jane Street, the 22 | largest industrial user of OCaml. 23 | " 24 | url { 25 | src: 26 | "https://github.com/janestreet/sexplib0/archive/refs/tags/v0.17.0.tar.gz" 27 | checksum: [ 28 | "md5=abafe8fd1d6302e55a315f4d78960d2a" 29 | "sha512=ad387e40789fe70a11473db7e85fe017b801592624414e9030730b2e92ea08f98095fb6e9236430f33c801605ebee0a2a6284e0f618a26a7da4599d4fd9d395d" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /esy.lock/opam/stdlib-shims.0.3.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "The stdlib-shims programmers" 3 | authors: "The stdlib-shims programmers" 4 | homepage: "https://github.com/ocaml/stdlib-shims" 5 | doc: "https://ocaml.github.io/stdlib-shims/" 6 | dev-repo: "git+https://github.com/ocaml/stdlib-shims.git" 7 | bug-reports: "https://github.com/ocaml/stdlib-shims/issues" 8 | tags: ["stdlib" "compatibility" "org:ocaml"] 9 | license: ["LGPL-2.1-only WITH OCaml-LGPL-linking-exception"] 10 | depends: [ 11 | "dune" 12 | "ocaml" {>= "4.02.3"} 13 | ] 14 | build: [ "dune" "build" "-p" name "-j" jobs ] 15 | synopsis: "Backport some of the new stdlib features to older compiler" 16 | description: """ 17 | Backport some of the new stdlib features to older compiler, 18 | such as the Stdlib module. 19 | 20 | This allows projects that require compatibility with older compiler to 21 | use these new features in their code. 22 | """ 23 | x-commit-hash: "fb6815e5d745f07fd567c11671149de6ef2e74c8" 24 | url { 25 | src: 26 | "https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz" 27 | checksum: [ 28 | "sha256=babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a" 29 | "sha512=1151d7edc8923516e9a36995a3f8938d323aaade759ad349ed15d6d8501db61ffbe63277e97c4d86149cf371306ac23df0f581ec7e02611f58335126e1870980" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /esy.lock/opam/trie.1.0.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "zandoye@gmail.com" 3 | authors: [ "ZAN DoYe" ] 4 | homepage: "https://github.com/kandu/trie/" 5 | bug-reports: "https://github.com/kandu/trie/issues" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/kandu/trie.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" {>= "4.02"} 13 | "dune" {>= "1.0"} 14 | ] 15 | synopsis: "Strict impure trie tree" 16 | url { 17 | src: "https://github.com/kandu/trie/archive/1.0.0.tar.gz" 18 | checksum: [ 19 | "sha256=c2f8054ea44216e6a3a961b28f7630e0e3dbfbd1b504ae741be230cbe32498ea" 20 | "md5=84519b5f8bd92490bfc68a52f706ba14" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /esy.lock/opam/xdg.3.17.2/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "XDG Base Directory Specification" 3 | description: 4 | "https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html" 5 | maintainer: ["Jane Street Group, LLC "] 6 | authors: ["Jane Street Group, LLC "] 7 | license: "MIT" 8 | homepage: "https://github.com/ocaml/dune" 9 | doc: "https://dune.readthedocs.io/" 10 | bug-reports: "https://github.com/ocaml/dune/issues" 11 | depends: [ 12 | "dune" {>= "3.12"} 13 | "ocaml" {>= "4.08"} 14 | "odoc" {with-doc} 15 | ] 16 | dev-repo: "git+https://github.com/ocaml/dune.git" 17 | build: [ 18 | ["dune" "subst"] {dev} 19 | ["rm" "-rf" "vendor/csexp"] 20 | ["rm" "-rf" "vendor/pp"] 21 | [ 22 | "dune" 23 | "build" 24 | "-p" 25 | name 26 | "-j" 27 | jobs 28 | "@install" 29 | "@doc" {with-doc} 30 | ] 31 | ] 32 | url { 33 | src: 34 | "https://github.com/ocaml/dune/releases/download/3.17.2/dune-3.17.2.tbz" 35 | checksum: [ 36 | "sha256=9deafeed0ecfe9e65e642cd8e6197f0864f73fcd7b94b5b199ae4d2e07a2ea64" 37 | "sha512=1e85bb297a12c9571b8645541d85a719deffb619d5e4f48dbf4566ac14e9f385d8a05342698a6f9c81ba17325b1da4ad004a5772d66cd88ed135c43d43e88f9e" 38 | ] 39 | } 40 | x-commit-hash: "fedec664a6ba500f94ba4558112f52d5719bed4d" 41 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.8_opam_override/files/findlib.patch: -------------------------------------------------------------------------------- 1 | --- ./Makefile 2 | +++ ./Makefile 3 | @@ -56,7 +56,7 @@ 4 | export USE_CYGPATH; \ 5 | cat findlib.conf.in | \ 6 | $(SH) tools/patch '@SITELIB@' '$(FINDLIB_OCAML_SITELIB)' | \ 7 | - $(SH) tools/patch '@FINDLIB_PATH@' '$(FINDLIB_PATH)' -p >findlib.conf 8 | + $(SH) tools/patch '@FINDLIB_PATH@' '$(FINDLIB_PATH)' >findlib.conf 9 | if ./tools/cmd_from_same_dir ocamlc; then \ 10 | echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \ 11 | fi 12 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.8_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": [ 3 | [ 4 | "bash", 5 | "-c", 6 | "#{os == 'windows' ? 'patch -p1 < findlib.patch' : 'true'}" 7 | ], 8 | [ 9 | "./configure", 10 | "-bindir", 11 | "#{self.bin}", 12 | "-sitelib", 13 | "#{self.lib}", 14 | "-mandir", 15 | "#{self.man}", 16 | "-config", 17 | "#{self.lib}/findlib.conf", 18 | "-no-custom", 19 | "-no-topfind" 20 | ], 21 | [ 22 | "make", 23 | "all" 24 | ], 25 | [ 26 | "make", 27 | "opt" 28 | ] 29 | ], 30 | "install": [ 31 | [ 32 | "make", 33 | "install" 34 | ], 35 | [ 36 | "install", 37 | "-m", 38 | "0755", 39 | "ocaml-stub", 40 | "#{self.bin}/ocaml" 41 | ], 42 | [ 43 | "mkdir", 44 | "-p", 45 | "#{self.toplevel}" 46 | ], 47 | [ 48 | "install", 49 | "-m", 50 | "0644", 51 | "src/findlib/topfind", 52 | "#{self.toplevel}/topfind" 53 | ] 54 | ], 55 | "exportedEnv": { 56 | "OCAML_TOPLEVEL_PATH": { 57 | "val": "#{self.toplevel}", 58 | "scope": "global" 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__uchar_opam__c__0.0.2_opam_override/files/winpatch.patch: -------------------------------------------------------------------------------- 1 | --- ./pkg/topkg.ml 2 | +++ ./pkg/topkg.ml 3 | @@ -344,7 +344,7 @@ 4 | let build ccomp btool bdir pkg mvs = 5 | let ext_to_string = Exts.ext_to_string ccomp in 6 | let install, exec = build_strings btool bdir ext_to_string mvs in 7 | - let e = Sys.command exec in 8 | + let e = Sys.command ("bash -c '" ^ exec ^ "'") in 9 | if e <> 0 then exit e else 10 | let install_file = pkg ^ ".install" in 11 | try 12 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__uchar_opam__c__0.0.2_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": [ 3 | [ 4 | "bash", 5 | "-c", 6 | "#{os == 'windows' ? 'patch -p1 < winpatch.patch' : 'true' }" 7 | ], 8 | "ocaml pkg/git.ml", 9 | "ocaml pkg/build.ml native=true native-dynlink=true" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "inputs": { 5 | "nixpkgs": "nixpkgs_2" 6 | }, 7 | "locked": { 8 | "lastModified": 1743885887, 9 | "narHash": "sha256-m7/Dlkq+sS9d+Ypg0tg7MIK+UupfRvtLMdtY4JVWc1Q=", 10 | "owner": "nix-ocaml", 11 | "repo": "nix-overlays", 12 | "rev": "475a35ae7f8d96254cdb57ee5ccd042c74390562", 13 | "type": "github" 14 | }, 15 | "original": { 16 | "owner": "nix-ocaml", 17 | "repo": "nix-overlays", 18 | "type": "github" 19 | } 20 | }, 21 | "nixpkgs_2": { 22 | "locked": { 23 | "lastModified": 1743862455, 24 | "narHash": "sha256-I/QXtrqznq1321mYR9TyMPX/zCWb9iAH64hO+pEBY00=", 25 | "owner": "NixOS", 26 | "repo": "nixpkgs", 27 | "rev": "06f3516b0397bd241bde2daefc8538fc886c5467", 28 | "type": "github" 29 | }, 30 | "original": { 31 | "owner": "NixOS", 32 | "repo": "nixpkgs", 33 | "rev": "06f3516b0397bd241bde2daefc8538fc886c5467", 34 | "type": "github" 35 | } 36 | }, 37 | "root": { 38 | "inputs": { 39 | "nixpkgs": "nixpkgs" 40 | } 41 | } 42 | }, 43 | "root": "root", 44 | "version": 7 45 | } 46 | -------------------------------------------------------------------------------- /js/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name refmt) 3 | (modes js) 4 | (js_of_ocaml 5 | (flags --source-map --debug-info --pretty --linkall +weak.js +toplevel.js --opt 3 --disable strict)) 6 | (libraries reason js_of_ocaml)) 7 | -------------------------------------------------------------------------------- /js/testRefmtJs.js: -------------------------------------------------------------------------------- 1 | const refmt = require('../refmt') 2 | console.log(refmt) 3 | 4 | console.log(refmt.printRE(refmt.parseRE(`let f = (a) => a + 1; print_int(f(5))`))) 5 | console.log(refmt.printREI(refmt.parseREI(`let f: (~a: string) => int`))) 6 | console.log(refmt.printML(refmt.parseML(`let f a = a + 1 print_int @@ f 5`))) 7 | console.log(refmt.printMLI(refmt.parseMLI(`val f : a:string -> int`))) 8 | 9 | try { 10 | refmt.parseRE(`let f => =`) 11 | } catch (e) { 12 | console.log(e) 13 | } 14 | try { 15 | refmt.parseMLI(`val f: `) 16 | } catch (e) { 17 | console.log(e) 18 | } 19 | 20 | try { 21 | refmt.parseRE(`type X = Foo`) 22 | } catch (e) { 23 | console.log(e) 24 | } 25 | 26 | console.log("=============== we're good! ===============") 27 | -------------------------------------------------------------------------------- /nix/ci.nix: -------------------------------------------------------------------------------- 1 | { ocamlVersion }: 2 | 3 | let 4 | lock = builtins.fromJSON (builtins.readFile ./../flake.lock); 5 | pkgs = 6 | let 7 | src = fetchGit { 8 | url = with lock.nodes.nixpkgs.locked;"https://github.com/${owner}/${repo}"; 9 | inherit (lock.nodes.nixpkgs.locked) rev; 10 | allRefs = true; 11 | }; 12 | in 13 | import src { 14 | extraOverlays = [ 15 | (self: super: { 16 | ocamlPackages = super.ocaml-ng."ocamlPackages_${ocamlVersion}".overrideScope (oself: osuper: { 17 | ppxlib = osuper.ppxlib.overrideAttrs (_: { 18 | src = super.fetchFromGitHub { 19 | owner = "ocaml-ppx"; 20 | repo = "ppxlib"; 21 | rev = "3374fe83926ea192ceccc9977032bff72ecaf2f7"; 22 | hash = "sha256-KfuA31hmFHpPkp7lq7lH6jaQyLiqBd/UnY5+ctntmF0="; 23 | }; 24 | }); 25 | pp = osuper.pp.overrideAttrs (_: { 26 | doCheck = false; 27 | }); 28 | }); 29 | }) 30 | ]; 31 | }; 32 | in 33 | 34 | pkgs.callPackage ./. { doCheck = true; } 35 | -------------------------------------------------------------------------------- /nix/shell.nix: -------------------------------------------------------------------------------- 1 | { mkShell 2 | , ocamlPackages 3 | , reason 4 | , cacert 5 | , curl 6 | , git 7 | , release-mode ? false 8 | }: 9 | 10 | mkShell { 11 | inputsFrom = [ reason ]; 12 | nativeBuildInputs = with ocamlPackages; [ 13 | utop 14 | merlin 15 | # odoc 16 | ocamlformat 17 | ]; 18 | buildInputs = 19 | with ocamlPackages; (if release-mode then [ cacert curl dune-release git ] else [ ]); 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reason", 3 | "version": "3.6.2", 4 | "description": "Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/reasonml/reason.git" 8 | }, 9 | "main": "refmt.js", 10 | "keywords": [ 11 | "reason", 12 | "ocaml", 13 | "react", 14 | "javascript" 15 | ], 16 | "license": "MIT", 17 | "homepage": "https://github.com/reasonml/reason", 18 | "dependencies": { 19 | "esy": "^0.9.0-beta.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /reason.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@esy-ocaml/reason", 3 | "version": "3.8.2", 4 | "license": "MIT", 5 | "description": "Native Compiler Support for Reason: Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/reasonml/reason.git" 9 | }, 10 | "dependencies": { 11 | "ocaml": ">= 4.2.0 < 5.1.0", 12 | "@opam/fix": "*", 13 | "@opam/ocamlfind": "*", 14 | "@opam/menhir": " >= 20180523.0.0", 15 | "@opam/merlin-extend": " >= 0.6", 16 | "@opam/ppx_derivers": "< 2.0.0", 17 | "@opam/ppxlib": "> 0.28.x", 18 | "@opam/dune": ">= 2.9.3", 19 | "@opam/dune-build-info": ">= 2.9.3" 20 | }, 21 | "devDependencies": { 22 | "@opam/merlin": "*", 23 | "ocaml": "~4.14.0" 24 | }, 25 | "esy": { 26 | "build": [ [ "dune", "build", "-p", "reason", "--disable-promotion" ] ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /reason.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | version: "3.16.0" 4 | synopsis: "Reason: Syntax & Toolchain for OCaml" 5 | description: """ 6 | Reason gives OCaml a new syntax that is remniscient of languages like 7 | JavaScript. It's also the umbrella project for a set of tools for the OCaml & 8 | JavaScript ecosystem.""" 9 | maintainer: [ 10 | "Jordan Walke " 11 | "Antonio Nuno Monteiro " 12 | ] 13 | authors: ["Jordan Walke "] 14 | license: "MIT" 15 | homepage: "https://reasonml.github.io/" 16 | bug-reports: "https://github.com/reasonml/reason/issues" 17 | depends: [ 18 | "dune" {>= "3.8"} 19 | "ocaml" {>= "4.08" & < "5.4"} 20 | "ocamlfind" {build} 21 | "dune-build-info" {>= "2.9.3"} 22 | "menhir" {>= "20180523"} 23 | "merlin-extend" {>= "0.6.2"} 24 | "fix" 25 | "ppx_derivers" 26 | "cppo" 27 | "ppxlib" {>= "0.36.0"} 28 | "odoc" {with-doc} 29 | ] 30 | build: [ 31 | ["dune" "subst"] {dev} 32 | [ 33 | "dune" 34 | "build" 35 | "-p" 36 | name 37 | "-j" 38 | jobs 39 | "@install" 40 | "@runtest" {with-test} 41 | "@doc" {with-doc} 42 | ] 43 | ] 44 | dev-repo: "git+https://github.com/reasonml/reason.git" 45 | -------------------------------------------------------------------------------- /rtop.esy.lock/.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | # Set eol to LF so files aren't converted to CRLF-eol on Windows. 3 | * text eol=lf linguist-generated 4 | -------------------------------------------------------------------------------- /rtop.esy.lock/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Reset any possible .gitignore, we want all esy.lock to be un-ignored. 3 | !* 4 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/base-bytes.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: " " 3 | authors: " " 4 | homepage: " " 5 | depends: [ 6 | "ocaml" {>= "4.02.0"} 7 | "ocamlfind" {>= "1.5.3"} 8 | ] 9 | synopsis: "Bytes library distributed with the OCaml compiler" 10 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/base-threads.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "https://github.com/ocaml/opam-repository/issues" 3 | description: """ 4 | Threads library distributed with the OCaml compiler 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/base-unix.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "https://github.com/ocaml/opam-repository/issues" 3 | description: """ 4 | Unix library distributed with the OCaml compiler 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/dot-merlin-reader.4.9/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "defree@gmail.com" 3 | authors: "The Merlin team" 4 | synopsis: "Reads config files for merlin" 5 | homepage: "https://github.com/ocaml/merlin" 6 | bug-reports: "https://github.com/ocaml/merlin/issues" 7 | dev-repo: "git+https://github.com/ocaml/merlin.git" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "subst"] {dev} 11 | ["dune" "build" "-p" name "-j" jobs] 12 | ] 13 | depends: [ 14 | "ocaml" {>= "4.08" & < "6.0"} 15 | "dune" {>= "2.9.0"} 16 | "merlin-lib" {>= "4.9"} 17 | "ocamlfind" {>= "1.6.0"} 18 | ] 19 | description: 20 | "Helper process: reads .merlin files and outputs the normalized content to 21 | stdout." 22 | url { 23 | src: 24 | "https://github.com/ocaml/merlin/releases/download/v4.9-414/merlin-4.9-414.tbz" 25 | checksum: [ 26 | "sha256=e23fc47813591269ff9d27c820988e520a662c89dd0af7ea652b21517499cbfd" 27 | "sha512=2199f963368597d10cc197e41ebb883f6a166018c9da3fe259c354550df41b713781003598a2fe5956b0a4ae96f8c07ba33831d3cf6f9d494b731944f87e491e" 28 | ] 29 | } 30 | x-commit-hash: "df75a4550704c113ac29505fd68ef9b7893d4bf5" 31 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/fix.20230505/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | ] 7 | homepage: "https://gitlab.inria.fr/fpottier/fix" 8 | dev-repo: "git+https://gitlab.inria.fr/fpottier/fix.git" 9 | bug-reports: "francois.pottier@inria.fr" 10 | license: "LGPL-2.0-only" 11 | build: [ 12 | ["dune" "build" "-p" name "-j" jobs] 13 | ] 14 | depends: [ 15 | "ocaml" { >= "4.03" } 16 | "dune" { >= "1.3" } 17 | ] 18 | synopsis: "Algorithmic building blocks for memoization, recursion, and more" 19 | url { 20 | src: 21 | "https://gitlab.inria.fr/fpottier/fix/-/archive/20230505/archive.tar.gz" 22 | checksum: [ 23 | "md5=2a4afa633128c5010677222f7b3c9451" 24 | "sha512=30d446ba6c19aef78b52d9831eb26f8f6ac10e88bd1eff36d16fbbfb32278b2637e31e63a160aec4abbbfdb1e7612ed25d68c936f4cbf2073e51d713ff3a8adf" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/lwt_react.1.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | 3 | synopsis: "Helpers for using React with Lwt" 4 | license: "MIT" 5 | homepage: "https://github.com/ocsigen/lwt" 6 | doc: "https://ocsigen.org/lwt/dev/api/Lwt_react" 7 | bug-reports: "https://github.com/ocsigen/lwt/issues" 8 | 9 | authors: [ 10 | "Jérémie Dimino" 11 | ] 12 | maintainer: [ 13 | "Anton Bachin " 14 | ] 15 | dev-repo: "git+https://github.com/ocsigen/lwt.git" 16 | 17 | depends: [ 18 | "dune" {>= "1.8.0"} 19 | "lwt" {>= "3.0.0"} 20 | "ocaml" {>= "4.08"} 21 | "react" {>= "1.0.0"} 22 | "cppo" {build & >= "1.1.0"} 23 | ] 24 | 25 | build: [ 26 | ["dune" "build" "-p" name "-j" jobs] 27 | ] 28 | url { 29 | src: "https://github.com/ocsigen/lwt/archive/5.6.0.tar.gz" 30 | checksum: [ 31 | "md5=e63979ee40a80d5b9e9e5545f33323b4" 32 | "sha512=d616389bc9e0da11f25843ab7541ac2d40c9543700a89455f14115b339bbe58cef2b8acf0ae97fd54e15a4cb93149cfe1ebfda301aa93933045f76b7d9344160" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/menhir.20230608/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "GPL-2.0-only" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" {>= "4.03.0"} 17 | "dune" {>= "2.8.0"} 18 | "menhirLib" {= version} 19 | "menhirSdk" {= version} 20 | ] 21 | synopsis: "An LR(1) parser generator" 22 | url { 23 | src: 24 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20230608/archive.tar.gz" 25 | checksum: [ 26 | "md5=8ff26b1e3685c472b7b3aba2fe938a43" 27 | "sha512=334b9dcb1283a28b8547082a89536b1d439ff588290b8eaecdf4802c5f74dbc8d16ad6fc6c0820036183518d83e2cc273a75787a8b41137424c8e7ee82e2b50a" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/menhirLib.20230608/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" { >= "4.03.0" } 17 | "dune" { >= "2.8.0" } 18 | ] 19 | conflicts: [ 20 | "menhir" { != version } 21 | ] 22 | synopsis: "Runtime support library for parsers generated by Menhir" 23 | url { 24 | src: 25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20230608/archive.tar.gz" 26 | checksum: [ 27 | "md5=8ff26b1e3685c472b7b3aba2fe938a43" 28 | "sha512=334b9dcb1283a28b8547082a89536b1d439ff588290b8eaecdf4802c5f74dbc8d16ad6fc6c0820036183518d83e2cc273a75787a8b41137424c8e7ee82e2b50a" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/menhirSdk.20230608/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" { >= "4.03.0" } 17 | "dune" { >= "2.8.0" } 18 | ] 19 | conflicts: [ 20 | "menhir" { != version } 21 | ] 22 | synopsis: "Compile-time library for auxiliary tools related to Menhir" 23 | url { 24 | src: 25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20230608/archive.tar.gz" 26 | checksum: [ 27 | "md5=8ff26b1e3685c472b7b3aba2fe938a43" 28 | "sha512=334b9dcb1283a28b8547082a89536b1d439ff588290b8eaecdf4802c5f74dbc8d16ad6fc6c0820036183518d83e2cc273a75787a8b41137424c8e7ee82e2b50a" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/merlin-extend.0.6.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Frederic Bour " 3 | authors: "Frederic Bour " 4 | homepage: "https://github.com/let-def/merlin-extend" 5 | bug-reports: "https://github.com/let-def/merlin-extend" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/let-def/merlin-extend.git" 8 | build: [ 9 | ["dune" "subst"] {dev} 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "dune" {>= "1.0"} 14 | "cppo" {build & >= "1.1.0"} 15 | "ocaml" {>= "4.02.3"} 16 | ] 17 | synopsis: "A protocol to provide custom frontend to Merlin" 18 | description: """ 19 | This protocol allows to replace the OCaml frontend of Merlin. 20 | It extends what used to be done with the `-pp' flag to handle a few more cases.""" 21 | doc: "https://let-def.github.io/merlin-extend" 22 | url { 23 | src: 24 | "https://github.com/let-def/merlin-extend/releases/download/v0.6.1/merlin-extend-0.6.1.tbz" 25 | checksum: [ 26 | "sha256=5ec84b355ddb2d129a5948b132bfacc93adcbde2158c7de695f7bfc3650bead7" 27 | "sha512=631fc96aab2f35e12a078c9b4907ca7b0db9f1e3a4026040e6c23b82e0171c256a89fb5d4c887f1d156eb9e3152783cdf7a546b2496051007a1bcf5777417396" 28 | ] 29 | } 30 | x-commit-hash: "cf2707bbe8e034c6ecf5d0fecd3fd889f6ab14bf" 31 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/merlin-lib.4.12-501/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "defree@gmail.com" 3 | authors: "The Merlin team" 4 | homepage: "https://github.com/ocaml/merlin" 5 | bug-reports: "https://github.com/ocaml/merlin/issues" 6 | dev-repo: "git+https://github.com/ocaml/merlin.git" 7 | license: "MIT" 8 | build: [ 9 | ["dune" "subst"] {dev} 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "5.1" & < "5.2"} 14 | "dune" {>= "2.9.0"} 15 | "csexp" {>= "1.5.1"} 16 | "menhir" {dev & >= "20201216"} 17 | "menhirLib" {dev & >= "20201216"} 18 | "menhirSdk" {dev & >= "20201216"} 19 | ] 20 | synopsis: 21 | "Merlin's libraries" 22 | description: 23 | "These libraries provides access to low-level compiler interfaces and the 24 | standard higher-level merlin protocol. The library is provided as-is, is not 25 | thoroughly documented, and its public API might break with any new release." 26 | url { 27 | src: 28 | "https://github.com/ocaml/merlin/releases/download/v4.12-501/merlin-4.12-501.tbz" 29 | checksum: [ 30 | "sha256=cccc33235497403590f4f68a2f8a3727a265463984b3b9645ebc1abb2f9088c0" 31 | "sha512=95ece87b42316824cc5c847bada2bb1f2131a2b75b00a79d561f1ff801d107146df6d2732cf340d5000a0de373a03d09714a35f75b0ec1e6ab869b2cdaf065e8" 32 | ] 33 | } 34 | x-commit-hash: "fcc3157ab0b2ecccf6ac530d8add326fdbf9fb1c" 35 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/mew.0.1.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "zandoye@gmail.com" 3 | authors: [ "ZAN DoYe" ] 4 | homepage: "https://github.com/kandu/mew" 5 | bug-reports: "https://github.com/kandu/mew/issues" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/kandu/mew.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" {>= "4.02.3"} 13 | "result" 14 | "trie" {>= "1.0.0"} 15 | "dune" {>= "1.1.0"} 16 | ] 17 | 18 | synopsis: "Modal editing witch" 19 | description: """ 20 | This is the core module of mew, a general modal editing engine generator.""" 21 | 22 | url { 23 | src: "https://github.com/kandu/mew/archive/0.1.0.tar.gz" 24 | checksum: "md5=2298149d1415cd804ab4e01f01ea10a0" 25 | } 26 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/mew_vi.0.5.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "zandoye@gmail.com" 3 | authors: [ "ZAN DoYe" ] 4 | homepage: "https://github.com/kandu/mew_vi" 5 | bug-reports: "https://github.com/kandu/mew_vi/issues" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/kandu/mew_vi.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" {>= "4.02.3"} 13 | "mew" {>= "0.1.0" & < "0.2"} 14 | "react" 15 | "dune" {>= "1.1.0"} 16 | ] 17 | 18 | synopsis: "Modal editing witch, VI interpreter" 19 | description: """ 20 | A vi-like modal editing engine generator.""" 21 | 22 | url { 23 | src: "https://github.com/kandu/mew_vi/archive/0.5.0.tar.gz" 24 | checksum: "md5=341e9a9a20383641015bf503952906bc" 25 | } 26 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "OCaml compiler libraries repackaged" 3 | description: """ 4 | This packages exposes the OCaml compiler libraries repackages under 5 | the toplevel names Ocaml_common, Ocaml_bytecomp, Ocaml_optcomp, ...""" 6 | maintainer: ["Jane Street developers"] 7 | authors: ["Jane Street Group, LLC"] 8 | license: "MIT" 9 | homepage: "https://github.com/janestreet/ocaml-compiler-libs" 10 | bug-reports: "https://github.com/janestreet/ocaml-compiler-libs/issues" 11 | depends: [ 12 | "dune" {>= "2.8"} 13 | "ocaml" {>= "4.04.1"} 14 | "odoc" {with-doc} 15 | ] 16 | build: [ 17 | ["dune" "subst"] {dev} 18 | [ 19 | "dune" 20 | "build" 21 | "-p" 22 | name 23 | "-j" 24 | jobs 25 | "@install" 26 | "@runtest" {with-test} 27 | "@doc" {with-doc} 28 | ] 29 | ] 30 | dev-repo: "git+https://github.com/janestreet/ocaml-compiler-libs.git" 31 | url { 32 | src: 33 | "https://github.com/janestreet/ocaml-compiler-libs/releases/download/v0.12.4/ocaml-compiler-libs-v0.12.4.tbz" 34 | checksum: [ 35 | "sha256=4ec9c9ec35cc45c18c7a143761154ef1d7663036a29297f80381f47981a07760" 36 | "sha512=978dba8dfa61f98fa24fda7a9c26c2e837081f37d1685fe636dc19cfc3278a940cf01a10293504b185c406706bc1008bc54313d50f023bcdea6d5ac6c0788b35" 37 | ] 38 | } 39 | x-commit-hash: "8cd12f18bb7171c2b67d661868c4271fae528d93" 40 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/ocamlfind.1.9.6/files/0001-Harden-test-for-OCaml-5.patch: -------------------------------------------------------------------------------- 1 | diff a/configure b/configure 2 | --- a/configure 3 | +++ b/configure 4 | @@ -294,7 +294,7 @@ 5 | # If findlib has been configured -sitelib $(ocamlc -where) then there's 6 | # nothing to do, but otherwise we need to put OCaml's Standard Library 7 | # into the path setting. 8 | - if [ ! -e "${ocaml_sitelib}/stdlib/META" ]; then 9 | + if [ ! -e "${ocaml_sitelib}/stdlib.cmi" ]; then 10 | ocamlpath="${ocaml_core_stdlib}${path_sep}${ocamlpath}" 11 | fi 12 | fi 13 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/ppx_derivers.1.2.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "jeremie@dimino.org" 3 | authors: ["Jérémie Dimino"] 4 | license: "BSD-3-Clause" 5 | homepage: "https://github.com/ocaml-ppx/ppx_derivers" 6 | bug-reports: "https://github.com/ocaml-ppx/ppx_derivers/issues" 7 | dev-repo: "git+https://github.com/ocaml-ppx/ppx_derivers.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" 13 | "dune" 14 | ] 15 | synopsis: "Shared [@@deriving] plugin registry" 16 | description: """ 17 | Ppx_derivers is a tiny package whose sole purpose is to allow 18 | ppx_deriving and ppx_type_conv to inter-operate gracefully when linked 19 | as part of the same ocaml-migrate-parsetree driver.""" 20 | url { 21 | src: "https://github.com/ocaml-ppx/ppx_derivers/archive/1.2.1.tar.gz" 22 | checksum: "md5=5dc2bf130c1db3c731fe0fffc5648b41" 23 | } 24 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/result.1.5/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/result" 5 | dev-repo: "git+https://github.com/janestreet/result.git" 6 | bug-reports: "https://github.com/janestreet/result/issues" 7 | license: "BSD-3-Clause" 8 | build: [["dune" "build" "-p" name "-j" jobs]] 9 | depends: [ 10 | "ocaml" 11 | "dune" {>= "1.0"} 12 | ] 13 | synopsis: "Compatibility Result module" 14 | description: """ 15 | Projects that want to use the new result type defined in OCaml >= 4.03 16 | while staying compatible with older version of OCaml should use the 17 | Result module defined in this library.""" 18 | url { 19 | src: 20 | "https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz" 21 | checksum: "md5=1b82dec78849680b49ae9a8a365b831b" 22 | } 23 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/seq.base/files/META.seq: -------------------------------------------------------------------------------- 1 | name="seq" 2 | version="[distributed with OCaml 4.07 or above]" 3 | description="dummy backward-compatibility package for iterators" 4 | requires="" 5 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/seq.base/files/seq.install: -------------------------------------------------------------------------------- 1 | lib:[ 2 | "META.seq" {"META"} 3 | ] 4 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/seq.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: " " 3 | authors: " " 4 | homepage: " " 5 | depends: [ 6 | "ocaml" {>= "4.07.0"} 7 | ] 8 | dev-repo: "git+https://github.com/ocaml/ocaml.git" 9 | bug-reports: "https://caml.inria.fr/mantis/main_page.php" 10 | synopsis: 11 | "Compatibility package for OCaml's standard iterator type starting from 4.07." 12 | extra-files: [ 13 | ["seq.install" "md5=026b31e1df290373198373d5aaa26e42"] 14 | ["META.seq" "md5=b33c8a1a6c7ed797816ce27df4855107"] 15 | ] 16 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/sexplib0.v0.16.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/sexplib0" 5 | bug-reports: "https://github.com/janestreet/sexplib0/issues" 6 | dev-repo: "git+https://github.com/janestreet/sexplib0.git" 7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/sexplib0/index.html" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "4.08.0"} 14 | "dune" {>= "2.0.0"} 15 | ] 16 | synopsis: "Library containing the definition of S-expressions and some base converters" 17 | description: " 18 | Part of Jane Street's Core library 19 | The Core suite of libraries is an industrial strength alternative to 20 | OCaml's standard library that was developed by Jane Street, the 21 | largest industrial user of OCaml. 22 | " 23 | url { 24 | src: "https://ocaml.janestreet.com/ocaml-core/v0.16/files/sexplib0-v0.16.0.tar.gz" 25 | checksum: "sha256=86dba26468194512f789f2fb709063515a9cb4e5c4461c021c239a369590701d" 26 | } 27 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/stdlib-shims.0.3.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "The stdlib-shims programmers" 3 | authors: "The stdlib-shims programmers" 4 | homepage: "https://github.com/ocaml/stdlib-shims" 5 | doc: "https://ocaml.github.io/stdlib-shims/" 6 | dev-repo: "git+https://github.com/ocaml/stdlib-shims.git" 7 | bug-reports: "https://github.com/ocaml/stdlib-shims/issues" 8 | tags: ["stdlib" "compatibility" "org:ocaml"] 9 | license: ["LGPL-2.1-only WITH OCaml-LGPL-linking-exception"] 10 | depends: [ 11 | "dune" 12 | "ocaml" {>= "4.02.3"} 13 | ] 14 | build: [ "dune" "build" "-p" name "-j" jobs ] 15 | synopsis: "Backport some of the new stdlib features to older compiler" 16 | description: """ 17 | Backport some of the new stdlib features to older compiler, 18 | such as the Stdlib module. 19 | 20 | This allows projects that require compatibility with older compiler to 21 | use these new features in their code. 22 | """ 23 | x-commit-hash: "fb6815e5d745f07fd567c11671149de6ef2e74c8" 24 | url { 25 | src: 26 | "https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz" 27 | checksum: [ 28 | "sha256=babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a" 29 | "sha512=1151d7edc8923516e9a36995a3f8938d323aaade759ad349ed15d6d8501db61ffbe63277e97c4d86149cf371306ac23df0f581ec7e02611f58335126e1870980" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/trie.1.0.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "zandoye@gmail.com" 3 | authors: [ "ZAN DoYe" ] 4 | homepage: "https://github.com/kandu/trie/" 5 | bug-reports: "https://github.com/kandu/trie/issues" 6 | license: "MIT" 7 | dev-repo: "git+https://github.com/kandu/trie.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" {>= "4.02"} 13 | "dune" {>= "1.0"} 14 | ] 15 | synopsis: "Strict impure trie tree" 16 | url { 17 | src: "https://github.com/kandu/trie/archive/1.0.0.tar.gz" 18 | checksum: "md5=84519b5f8bd92490bfc68a52f706ba14" 19 | } 20 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/uchar.0.0.2/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Daniel Bünzli " 3 | authors: ["Daniel Bünzli "] 4 | homepage: "http://ocaml.org" 5 | doc: "https://ocaml.github.io/uchar/" 6 | dev-repo: "git+https://github.com/ocaml/uchar.git" 7 | bug-reports: "https://github.com/ocaml/uchar/issues" 8 | tags: [ "text" "character" "unicode" "compatibility" "org:ocaml.org" ] 9 | license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception" 10 | depends: [ 11 | "ocaml" {>= "3.12.0"} 12 | "ocamlbuild" {build} 13 | ] 14 | build: [ 15 | ["ocaml" "pkg/git.ml"] 16 | [ 17 | "ocaml" 18 | "pkg/build.ml" 19 | "native=%{ocaml:native}%" 20 | "native-dynlink=%{ocaml:native-dynlink}%" 21 | ] 22 | ] 23 | synopsis: "Compatibility library for OCaml's Uchar module" 24 | description: """ 25 | The `uchar` package provides a compatibility library for the 26 | [`Uchar`][1] module introduced in OCaml 4.03. 27 | 28 | The `uchar` package is distributed under the license of the OCaml 29 | compiler. See [LICENSE](LICENSE) for details. 30 | 31 | [1]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Uchar.html""" 32 | url { 33 | src: 34 | "https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz" 35 | checksum: "md5=c9ba2c738d264c420c642f7bb1cf4a36" 36 | } 37 | -------------------------------------------------------------------------------- /rtop.esy.lock/opam/xdg.3.11.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "XDG Base Directory Specification" 3 | description: 4 | "https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html" 5 | maintainer: ["Jane Street Group, LLC "] 6 | authors: ["Jane Street Group, LLC "] 7 | license: "MIT" 8 | homepage: "https://github.com/ocaml/dune" 9 | doc: "https://dune.readthedocs.io/" 10 | bug-reports: "https://github.com/ocaml/dune/issues" 11 | depends: [ 12 | "dune" {>= "3.5"} 13 | "ocaml" {>= "4.08"} 14 | "odoc" {with-doc} 15 | ] 16 | dev-repo: "git+https://github.com/ocaml/dune.git" 17 | build: [ 18 | ["dune" "subst"] {dev} 19 | ["rm" "-rf" "vendor/csexp"] 20 | ["rm" "-rf" "vendor/pp"] 21 | [ 22 | "dune" 23 | "build" 24 | "-p" 25 | name 26 | "-j" 27 | jobs 28 | "@install" 29 | "@doc" {with-doc} 30 | ] 31 | ] 32 | url { 33 | src: 34 | "https://github.com/ocaml/dune/releases/download/3.11.1/dune-3.11.1.tbz" 35 | checksum: [ 36 | "sha256=866f2307adadaf7604f3bf9d98bb4098792baa046953a6726c96c40fc5ed3f71" 37 | "sha512=c888153b204a16bcfed2636de776bbd5f9ca84484e716cc1e9ef3ba3c904e9dd15a2609ae943cddb6097912623ec54618c58386d6730ff742d746850400fb3cc" 38 | ] 39 | } 40 | x-commit-hash: "7cbb0e7277c6cacd1ccf7941cac5a03c25fc63cf" 41 | -------------------------------------------------------------------------------- /rtop.esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override/files/ocamlbuild-0.14.2.patch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reasonml/reason/5785bb621ebef76056483272a9c1c5f0abc49b87/rtop.esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override/files/ocamlbuild-0.14.2.patch -------------------------------------------------------------------------------- /rtop.esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override/files/winpatch.patch: -------------------------------------------------------------------------------- 1 | --- ./Makefile 2 | +++ ./Makefile 3 | @@ -271,7 +271,7 @@ 4 | echo ' "ocamlbuild.byte" {"ocamlbuild.byte"}' >> ocamlbuild.install 5 | ifeq ($(OCAML_NATIVE), true) 6 | echo ' "ocamlbuild.native" {"ocamlbuild.native"}' >> ocamlbuild.install 7 | - echo ' "ocamlbuild.native" {"ocamlbuild"}' >> ocamlbuild.install 8 | + echo " \"ocamlbuild.native\" {\"ocamlbuild${EXE}\"}" >> ocamlbuild.install 9 | else 10 | echo ' "ocamlbuild.byte" {"ocamlbuild"}' >> ocamlbuild.install 11 | endif 12 | -------------------------------------------------------------------------------- /rtop.esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": [ 3 | [ 4 | "bash", 5 | "-c", 6 | "#{os == 'windows' ? 'patch -p1 < winpatch.patch' : 'true'}" 7 | ], 8 | [ 9 | "make", 10 | "-f", 11 | "configure.make", 12 | "all", 13 | "OCAMLBUILD_PREFIX=#{self.install}", 14 | "OCAMLBUILD_BINDIR=#{self.bin}", 15 | "OCAMLBUILD_LIBDIR=#{self.lib}", 16 | "OCAMLBUILD_MANDIR=#{self.man}", 17 | "OCAMLBUILD_NATIVE=true", 18 | "OCAMLBUILD_NATIVE_TOOLS=true", 19 | "EXE=#{os == 'windows' ? '.exe': ''}" 20 | ], 21 | [ 22 | "make", 23 | "check-if-preinstalled", 24 | "all", 25 | "EXE=#{os == 'windows' ? '.exe': ''}", 26 | "opam-install" 27 | ] 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /rtop.esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.6_opam_override/files/findlib.patch: -------------------------------------------------------------------------------- 1 | --- ./Makefile 2 | +++ ./Makefile 3 | @@ -55,7 +55,7 @@ 4 | export USE_CYGPATH; \ 5 | cat findlib.conf.in | \ 6 | $(SH) tools/patch '@SITELIB@' '$(OCAML_SITELIB)' | \ 7 | - $(SH) tools/patch '@FINDLIB_PATH@' '$(FINDLIB_PATH)' -p >findlib.conf 8 | + $(SH) tools/patch '@FINDLIB_PATH@' '$(FINDLIB_PATH)' >findlib.conf 9 | if ./tools/cmd_from_same_dir ocamlc; then \ 10 | echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \ 11 | fi 12 | -------------------------------------------------------------------------------- /rtop.esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.6_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": [ 3 | [ 4 | "bash", 5 | "-c", 6 | "#{os == 'windows' ? 'patch -p1 < findlib.patch' : 'true'}" 7 | ], 8 | [ 9 | "./configure", 10 | "-bindir", 11 | "#{self.bin}", 12 | "-sitelib", 13 | "#{self.lib}", 14 | "-mandir", 15 | "#{self.man}", 16 | "-config", 17 | "#{self.lib}/findlib.conf", 18 | "-no-custom", 19 | "-no-topfind" 20 | ], 21 | [ 22 | "make", 23 | "all" 24 | ], 25 | [ 26 | "make", 27 | "opt" 28 | ] 29 | ], 30 | "install": [ 31 | [ 32 | "make", 33 | "install" 34 | ], 35 | [ 36 | "install", 37 | "-m", 38 | "0755", 39 | "ocaml-stub", 40 | "#{self.bin}/ocaml" 41 | ], 42 | [ 43 | "mkdir", 44 | "-p", 45 | "#{self.toplevel}" 46 | ], 47 | [ 48 | "install", 49 | "-m", 50 | "0644", 51 | "src/findlib/topfind", 52 | "#{self.toplevel}/topfind" 53 | ] 54 | ], 55 | "exportedEnv": { 56 | "OCAML_TOPLEVEL_PATH": { 57 | "val": "#{self.toplevel}", 58 | "scope": "global" 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /rtop.esy.lock/overrides/opam__s__uchar_opam__c__0.0.2_opam_override/files/winpatch.patch: -------------------------------------------------------------------------------- 1 | --- ./pkg/topkg.ml 2 | +++ ./pkg/topkg.ml 3 | @@ -344,7 +344,7 @@ 4 | let build ccomp btool bdir pkg mvs = 5 | let ext_to_string = Exts.ext_to_string ccomp in 6 | let install, exec = build_strings btool bdir ext_to_string mvs in 7 | - let e = Sys.command exec in 8 | + let e = Sys.command ("bash -c '" ^ exec ^ "'") in 9 | if e <> 0 then exit e else 10 | let install_file = pkg ^ ".install" in 11 | try 12 | -------------------------------------------------------------------------------- /rtop.esy.lock/overrides/opam__s__uchar_opam__c__0.0.2_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": [ 3 | [ 4 | "bash", 5 | "-c", 6 | "#{os == 'windows' ? 'patch -p1 < winpatch.patch' : 'true' }" 7 | ], 8 | "ocaml pkg/git.ml", 9 | "ocaml pkg/build.ml native=true native-dynlink=true" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /rtop.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@esy-ocaml/rtop", 3 | "version": "3.8.2", 4 | "license": "MIT", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/reasonml/reason.git" 8 | }, 9 | "dependencies": { 10 | "@esy-ocaml/substs": "^0.0.1", 11 | "@opam/ocamlfind": "*", 12 | "@opam/dune": ">= 2.9.3", 13 | "@opam/reason": "^3.8.0", 14 | "@opam/utop": " >= 1.17.0", 15 | "ocaml": ">= 4.3.0 < 5.2.0" 16 | }, 17 | "devDependencies": { 18 | "@opam/merlin": "*", 19 | "ocaml": "5.x" 20 | }, 21 | "esy": { 22 | "build": [["dune", "build", "-p", "reason", "--disable-promotion"]] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /rtop.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | version: "3.16.0" 4 | synopsis: "Reason toplevel" 5 | description: 6 | "rtop is the toplevel (or REPL) for Reason, based on utop (https://github.com/ocaml-community/utop)." 7 | maintainer: [ 8 | "Jordan Walke " 9 | "Antonio Nuno Monteiro " 10 | ] 11 | authors: ["Jordan Walke "] 12 | license: "MIT" 13 | homepage: "https://reasonml.github.io/" 14 | bug-reports: "https://github.com/reasonml/reason/issues" 15 | depends: [ 16 | "dune" {>= "3.8"} 17 | "ocaml" {>= "4.08" & < "5.4"} 18 | "reason" {= version} 19 | "utop" {>= "2.0"} 20 | "cppo" 21 | "odoc" {with-doc} 22 | ] 23 | build: [ 24 | ["dune" "subst"] {dev} 25 | [ 26 | "dune" 27 | "build" 28 | "-p" 29 | name 30 | "-j" 31 | jobs 32 | "@install" 33 | "@runtest" {with-test} 34 | "@doc" {with-doc} 35 | ] 36 | ] 37 | dev-repo: "git+https://github.com/reasonml/reason.git" 38 | -------------------------------------------------------------------------------- /rtop/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name rtop) 3 | (public_name rtop) 4 | (modules reason_util reason_utop reason_toploop) 5 | (wrapped false) 6 | (modes byte) 7 | (libraries 8 | menhirLib 9 | reason.easy_format 10 | reason 11 | utop 12 | reason.ocaml-migrate-parsetree)) 13 | 14 | (rule 15 | (targets reason_toploop.ml) 16 | (deps reason_toploop.cppo.ml) 17 | (action 18 | (run cppo -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) 19 | 20 | (rule 21 | (targets reason_utop.ml) 22 | (deps reason_utop.cppo.ml) 23 | (action 24 | (run cppo -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) 25 | 26 | (executable 27 | (name rtop) 28 | (public_name rtop) 29 | (package rtop) 30 | (modules rtop) 31 | (link_flags -linkall) 32 | (modes byte) 33 | (libraries rtop)) 34 | -------------------------------------------------------------------------------- /src/menhir-recover/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean 2 | 3 | all: 4 | dune build main.exe 5 | 6 | clean: 7 | dune clean 8 | 9 | test-dijkstra: 10 | dune build main.exe demo/calc.exe 11 | _build/default/main.exe _build/default/demo/parser.cmly 12 | 13 | test-custom: 14 | dune build main.exe demo/calc.exe 15 | _build/default/main.exe -custom _build/default/demo/parser.cmly 16 | -------------------------------------------------------------------------------- /src/menhir-recover/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name main) 3 | (libraries fix menhirLib menhirSdk) 4 | (flags :standard -w -67)) 5 | -------------------------------------------------------------------------------- /src/menhir-recover/emitter.mli: -------------------------------------------------------------------------------- 1 | open MenhirSdk.Cmly_api 2 | open Attributes 3 | open Synthesis 4 | open Recovery_intf 5 | 6 | module Make 7 | (G : GRAMMAR) 8 | (A : ATTRIBUTES with module G := G) 9 | (S : SYNTHESIZER with module G := G) 10 | (R : RECOVERY with module G := G) : sig 11 | val emit : Format.formatter -> unit 12 | end 13 | -------------------------------------------------------------------------------- /src/menhir-recover/recovery_intf.ml: -------------------------------------------------------------------------------- 1 | open MenhirSdk.Cmly_api 2 | 3 | module type RECOVERY = sig 4 | module G : GRAMMAR 5 | 6 | type item = G.lr1 * G.production * int 7 | 8 | type recovery = 9 | { prefix : int 10 | ; cases : (G.lr1 option * item list) list 11 | } 12 | (** [prefix] is the size of the known prefix of the stack. It means that in 13 | the kernel of current state, there is an item whose dot is at position 14 | [prefix]. (we know the incoming symbols for these stack frames and we can 15 | enumerate the possible state numbers). 16 | 17 | [cases] is a mapping that associates to each possible state found at 18 | stack.[-prefix] (or None if the stack is empty) a list of reductions to 19 | execute. 20 | 21 | The actual list of actions to reduce an item [(state, prod, pos)] is given 22 | by [Synthesizer.solution (Trail (state, prod, pos))] *) 23 | 24 | val recover : G.lr1 -> recovery 25 | end 26 | 27 | module type RECOVER = functor 28 | (G : GRAMMAR) 29 | (S : Synthesis.SYNTHESIZER with module G := G) 30 | -> RECOVERY with module G := G 31 | -------------------------------------------------------------------------------- /src/reason-merlin/dune: -------------------------------------------------------------------------------- 1 | (rule 2 | (targets ocamlmerlin_reason.ml) 3 | (deps ocamlmerlin_reason.cppo.ml) 4 | (action 5 | (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) 6 | 7 | (executable 8 | (name ocamlmerlin_reason) 9 | (public_name ocamlmerlin-reason) 10 | (package reason) 11 | (libraries compiler-libs.common merlin-extend reason)) 12 | -------------------------------------------------------------------------------- /src/reason-parser/TODO: -------------------------------------------------------------------------------- 1 | Recovery (Urgent): 2 | * Not clear what the pipeline for errors should be 3 | * Find better names for the many modules 4 | * If necessary, tune performance 5 | * What is the licensing situation? 6 | 7 | Error messages (Medium-term): 8 | * Agree on a strategy with other people: what should messages look like? 9 | What should they do: describe the context? suggest common corrections? 10 | Point people to grammar documentation? 11 | * To learn what correct files look like we can probably data-mine public reason 12 | repositories. 13 | * To learn what incorrect files look like, we need some way to collect common 14 | errors!!!! 15 | 16 | Completion (Long-term): 17 | * Introduce merlin.location when there is ambiguity between concrete and 18 | abstract locations 19 | -------------------------------------------------------------------------------- /src/reason-parser/error-handling.md: -------------------------------------------------------------------------------- 1 | Categories of error: 2 | 3 | - Lexer errors, produced by `Reason_lexer` and stored in exception 4 | `Reason_lexer.Error` 5 | - Concrete parsing errors, produced by menhir code when 6 | 7 | -------------------------------------------------------------------------------- /src/reason-parser/merlin_recovery.mli: -------------------------------------------------------------------------------- 1 | module Make 2 | (Parser : MenhirLib.IncrementalEngine.EVERYTHING) 3 | (Recovery : sig 4 | val default_value : Location.t -> 'a Parser.symbol -> 'a 5 | 6 | type action = 7 | | Abort 8 | | R of int 9 | | S : 'a Parser.symbol -> action 10 | | Sub of action list 11 | 12 | type decision = 13 | | Nothing 14 | | One of action list 15 | | Select of (int -> action list) 16 | 17 | val depth : int array 18 | val can_pop : 'a Parser.terminal -> bool 19 | val recover : int -> decision 20 | val guide : 'a Parser.symbol -> bool 21 | val token_of_terminal : 'a Parser.terminal -> 'a -> Parser.token 22 | val nullable : 'a Parser.nonterminal -> bool 23 | end) : sig 24 | type 'a candidate = 25 | { line : int 26 | ; min_col : int 27 | ; max_col : int 28 | ; env : 'a Parser.env 29 | } 30 | 31 | type 'a candidates = 32 | { shifted : Parser.xsymbol option 33 | ; final : 'a option 34 | ; candidates : 'a candidate list 35 | } 36 | 37 | val attempt : 38 | 'a candidates 39 | -> Parser.token * Lexing.position * Lexing.position 40 | -> [> `Accept of 'a | `Fail | `Ok of 'a Parser.checkpoint * 'a Parser.env ] 41 | 42 | val generate : 'a Parser.env -> 'a candidates 43 | end 44 | -------------------------------------------------------------------------------- /src/reason-parser/reason_config.ml: -------------------------------------------------------------------------------- 1 | (** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is 2 | licensed under the MIT license found in the * LICENSE file in the root 3 | directory of this source tree. *) 4 | 5 | let recoverable = ref false 6 | let configure ~r = recoverable := r 7 | -------------------------------------------------------------------------------- /src/reason-parser/reason_lexer.mli: -------------------------------------------------------------------------------- 1 | open Reason_parser 2 | 3 | type t 4 | type 'a positioned = 'a * Lexing.position * Lexing.position 5 | 6 | val init : ?insert_completion_ident:Lexing.position -> Lexing.lexbuf -> t 7 | val token : t -> token positioned 8 | val lexbuf : t -> Lexing.lexbuf 9 | 10 | type comment = string * Location.t 11 | 12 | (* Some docstrings are not accepted by the parser and turned into comments. *) 13 | type invalid_docstrings 14 | 15 | val empty_invalid_docstrings : invalid_docstrings 16 | 17 | val add_invalid_docstring : 18 | string 19 | -> Lexing.position 20 | -> Lexing.position 21 | -> invalid_docstrings 22 | -> invalid_docstrings 23 | 24 | val get_comments : t -> invalid_docstrings -> comment list 25 | -------------------------------------------------------------------------------- /src/reason-parser/reason_multi_parser.mli: -------------------------------------------------------------------------------- 1 | type 'a parser 2 | 3 | val initial : 4 | (Lexing.position -> 'a Reason_parser.MenhirInterpreter.checkpoint) 5 | -> Lexing.position 6 | -> 'a parser 7 | 8 | type 'a step = 9 | | Intermediate of 'a parser 10 | | Success of 'a * Reason_lexer.invalid_docstrings 11 | | Error 12 | 13 | val step : 'a parser -> Reason_parser.token Reason_lexer.positioned -> 'a step 14 | 15 | (* Interface for recovery *) 16 | 17 | val recover : 18 | 'a Reason_parser.MenhirInterpreter.checkpoint 19 | -> Reason_lexer.invalid_docstrings 20 | -> 'a parser 21 | 22 | val recovery_env : 23 | 'a parser 24 | -> 'a Reason_parser.MenhirInterpreter.env * Reason_lexer.invalid_docstrings 25 | -------------------------------------------------------------------------------- /src/reason-parser/reason_parser_def.mli: -------------------------------------------------------------------------------- 1 | open Ppxlib 2 | 3 | type labelled_parameter = 4 | | Term of Asttypes.arg_label * Parsetree.expression option * Parsetree.pattern 5 | | Type of string 6 | 7 | type let_bindings = 8 | { lbs_bindings : Parsetree.value_binding list 9 | ; lbs_rec : Asttypes.rec_flag 10 | ; lbs_extension : (Parsetree.attributes * string Asttypes.loc) option 11 | ; lbs_loc : Location.t 12 | } 13 | -------------------------------------------------------------------------------- /src/reason-parser/reason_pprint_ast.mli: -------------------------------------------------------------------------------- 1 | open Ppxlib 2 | 3 | val configure : 4 | width:int 5 | -> assumeExplicitArity:bool 6 | -> constructorLists:string list 7 | -> unit 8 | 9 | val createFormatter : 10 | unit 11 | -> < case_list : Format.formatter -> Parsetree.case list -> unit 12 | ; core_type : Format.formatter -> Parsetree.core_type -> unit 13 | ; expression : Format.formatter -> Parsetree.expression -> unit 14 | ; pattern : Format.formatter -> Parsetree.pattern -> unit 15 | ; signature : 16 | Reason_comment.t list 17 | -> Format.formatter 18 | -> Parsetree.signature 19 | -> unit 20 | ; structure : 21 | Reason_comment.t list 22 | -> Format.formatter 23 | -> Parsetree.structure 24 | -> unit 25 | ; toplevel_phrase : Format.formatter -> Parsetree.toplevel_phrase -> unit > 26 | -------------------------------------------------------------------------------- /src/reason-parser/reason_recover_parser.mli: -------------------------------------------------------------------------------- 1 | type 'a parser 2 | 3 | val initial : 4 | (Lexing.position -> 'a Reason_parser.MenhirInterpreter.checkpoint) 5 | -> Lexing.position 6 | -> 'a parser 7 | 8 | type 'a step = 9 | | Intermediate of 'a parser 10 | | Success of 'a * Reason_lexer.invalid_docstrings 11 | | Error 12 | 13 | val step : 'a parser -> Reason_parser.token Reason_lexer.positioned -> 'a step 14 | -------------------------------------------------------------------------------- /src/reason-parser/reason_single_parser.mli: -------------------------------------------------------------------------------- 1 | type 'a parser 2 | 3 | val initial : 4 | (Lexing.position -> 'a Reason_parser.MenhirInterpreter.checkpoint) 5 | -> Lexing.position 6 | -> 'a parser 7 | 8 | type 'a step = 9 | | Intermediate of 'a parser 10 | | Success of 'a * Reason_lexer.invalid_docstrings 11 | | Error 12 | 13 | val step : 'a parser -> Reason_parser.token Reason_lexer.positioned -> 'a step 14 | 15 | (* Interface for recovery *) 16 | 17 | val recover : 18 | 'a Reason_parser.MenhirInterpreter.checkpoint 19 | -> Reason_lexer.invalid_docstrings 20 | -> 'a parser 21 | 22 | val recovery_env : 23 | 'a parser 24 | -> 'a Reason_parser.MenhirInterpreter.env * Reason_lexer.invalid_docstrings 25 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/VERSION: -------------------------------------------------------------------------------- 1 | 0.9.8 -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/cmdliner_cline.mli: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2011 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | 6 | (** Command lines. *) 7 | 8 | type t 9 | 10 | val create : 11 | ?peek_opts:bool -> Cmdliner_info.Arg.Set.t -> string list -> 12 | (t, string * t) result 13 | 14 | val opt_arg : t -> Cmdliner_info.Arg.t -> (int * string * (string option)) list 15 | val pos_arg : t -> Cmdliner_info.Arg.t -> string list 16 | val actual_args : t -> Cmdliner_info.Arg.t -> string list 17 | (** Actual command line arguments from the command line *) 18 | 19 | val is_opt : string -> bool 20 | val deprecated_msgs : t -> string list 21 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/cmdliner_cmd.ml: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2022 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | 6 | (* Commands *) 7 | 8 | (* Command info *) 9 | 10 | type info = Cmdliner_info.Cmd.t 11 | let info = Cmdliner_info.Cmd.v 12 | 13 | type 'a t = 14 | | Cmd of info * 'a Cmdliner_term.parser 15 | | Group of info * ('a Cmdliner_term.parser option * 'a t list) 16 | 17 | let get_info = function Cmd (i, _) | Group (i, _) -> i 18 | let children_infos = function 19 | | Cmd _ -> [] | Group (_, (_, cs)) -> List.map get_info cs 20 | 21 | let v i (args, p) = Cmd (Cmdliner_info.Cmd.add_args i args, p) 22 | let group ?default i cmds = 23 | let args, parser = match default with 24 | | None -> None, None | Some (args, p) -> Some args, Some p 25 | in 26 | let children = List.map get_info cmds in 27 | let i = Cmdliner_info.Cmd.with_children i ~args ~children in 28 | Group (i, (parser, cmds)) 29 | 30 | let name c = Cmdliner_info.Cmd.name (get_info c) 31 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/cmdliner_cmd.mli: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2022 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | 6 | (** Commands and their information. *) 7 | 8 | type info = Cmdliner_info.Cmd.t 9 | 10 | val info : 11 | ?deprecated:string -> 12 | ?man_xrefs:Cmdliner_manpage.xref list -> ?man:Cmdliner_manpage.block list -> 13 | ?envs:Cmdliner_info.Env.info list -> ?exits:Cmdliner_info.Exit.info list -> 14 | ?sdocs:string -> ?docs:string -> ?doc:string -> ?version:string -> 15 | string -> info 16 | 17 | type 'a t = 18 | | Cmd of info * 'a Cmdliner_term.parser 19 | | Group of info * ('a Cmdliner_term.parser option * 'a t list) 20 | 21 | val v : info -> 'a Cmdliner_term.t -> 'a t 22 | val group : ?default:'a Cmdliner_term.t -> info -> 'a t list -> 'a t 23 | val name : 'a t -> string 24 | val get_info : 'a t -> info 25 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/cmdliner_docgen.mli: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2011 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | 6 | val pp_man : 7 | errs:Format.formatter -> Cmdliner_manpage.format -> Format.formatter -> 8 | Cmdliner_info.Eval.t -> unit 9 | 10 | val pp_plain_synopsis : 11 | errs:Format.formatter -> Format.formatter -> Cmdliner_info.Eval.t -> unit 12 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/cmdliner_exit.ml: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2011 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/cmdliner_exit.mli: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2011 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/cmdliner_trie.mli: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2011 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | 6 | (** Tries. 7 | 8 | This implementation also maps any non ambiguous prefix of a 9 | key to its value. *) 10 | 11 | type 'a t 12 | 13 | val empty : 'a t 14 | val is_empty : 'a t -> bool 15 | val add : 'a t -> string -> 'a -> [ `New of 'a t | `Replaced of 'a * 'a t ] 16 | val find : 'a t -> string -> [ `Ok of 'a | `Ambiguous | `Not_found ] 17 | val ambiguities : 'a t -> string -> string list 18 | val of_list : (string * 'a) list -> 'a t 19 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name vendored_cmdliner) 3 | (public_name reason.cmdliner) 4 | (flags :standard -w -27-32-35-50)) 5 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/cmdliner/vendored_cmdliner.ml: -------------------------------------------------------------------------------- 1 | (*--------------------------------------------------------------------------- 2 | Copyright (c) 2011 The cmdliner programmers. All rights reserved. 3 | SPDX-License-Identifier: ISC 4 | ---------------------------------------------------------------------------*) 5 | 6 | module Manpage = Cmdliner_manpage 7 | module Term = struct 8 | include Cmdliner_term 9 | include Cmdliner_term_deprecated 10 | end 11 | module Cmd = struct 12 | module Exit = Cmdliner_info.Exit 13 | module Env = Cmdliner_info.Env 14 | include Cmdliner_cmd 15 | include Cmdliner_eval 16 | end 17 | module Arg = Cmdliner_arg 18 | -------------------------------------------------------------------------------- /src/reason-parser/vendor/easy_format/VERSION: -------------------------------------------------------------------------------- 1 | 1.2.0 -------------------------------------------------------------------------------- /src/reason-parser/vendor/easy_format/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ReasonEasyFormat) 3 | (public_name reason.easy_format) 4 | (preprocess 5 | (action 6 | (run %{bin:cppo} -V OCAML:%{ocaml_version} %{input-file}))) 7 | (wrapped false) 8 | (flags 9 | (:standard -w -9-27-32-50))) 10 | -------------------------------------------------------------------------------- /src/refmt/.gitignore: -------------------------------------------------------------------------------- 1 | git_version.ml 2 | -------------------------------------------------------------------------------- /src/refmt/README.md: -------------------------------------------------------------------------------- 1 | # Reason (For Native Compilers) 2 | 3 | Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems. 4 | 5 | This package provides support for using Reason with native OCaml compilers. 6 | 7 | [![Build Status](https://dev.azure.com/reasonml/reason/_apis/build/status/facebook.reason?branchName=master)](https://dev.azure.com/reasonml/reason/_build/latest?definitionId=2?branchName=master) [![Build Status](https://travis-ci.org/facebook/reason.svg?branch=master)](https://travis-ci.org/facebook/reason) [![CircleCI](https://circleci.com/gh/facebook/reason/tree/master.svg?style=svg)](https://circleci.com/gh/facebook/reason/tree/master) 8 | 9 | ## [Native Quick Start With Esy](https://reasonml.github.io/docs/en/quickstart-ocaml) 10 | 11 | ## [Community](https://reasonml.github.io/docs/en/community.html) 12 | 13 | ## [Roadmap & Contribution](https://reasonml.github.io/docs/en/roadmap) 14 | 15 | ### Documentations 16 | 17 | Go to https://github.com/reasonml/reasonml.github.io to contribute to the Reason documentation. 18 | 19 | ### Contributing 20 | 21 | See the [docs folder's `GETTING_STARTED_CONTRIBUTING.md`](../docs/GETTING_STARTED_CONTRIBUTING.md). 22 | -------------------------------------------------------------------------------- /src/refmt/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (public_name refmt) 3 | (package reason) 4 | (modes exe byte) 5 | (modules refmt) 6 | (libraries refmt_lib)) 7 | 8 | (library 9 | (public_name reason.refmt-lib) 10 | (name refmt_lib) 11 | (modules :standard \ refmt) 12 | (libraries reason reason.cmdliner dune-build-info)) 13 | 14 | (rule 15 | (with-stdout-to 16 | git_commit.ml 17 | (progn 18 | (bash "echo let version = \\\"$(git rev-parse --verify HEAD)\\\"") 19 | (bash "echo let short_version = \\\"$(git rev-parse --short HEAD)\\\"")))) 20 | 21 | (rule 22 | (with-stdout-to 23 | refmt.1 24 | (run %{bin:refmt} --help=groff))) 25 | 26 | (install 27 | (section man) 28 | (package reason) 29 | (files refmt.1)) 30 | -------------------------------------------------------------------------------- /src/refmt/eol_convert.ml: -------------------------------------------------------------------------------- 1 | open Eol_detect 2 | 3 | let lf_to_crlf s = 4 | let rec loop sz = 5 | match String.index sz '\n' with 6 | | exception Not_found -> sz 7 | | idx -> 8 | let l = String.sub sz 0 idx ^ "\r\n" in 9 | let length = String.length sz in 10 | l ^ loop (String.sub sz (idx + 1) (length - idx - 1)) 11 | in 12 | loop s 13 | 14 | let get_formatter output_channel eol = 15 | let f = Format.formatter_of_out_channel output_channel in 16 | let out_functions = Format.pp_get_formatter_out_functions f () in 17 | let out_string s p n = 18 | match eol with 19 | | LF -> out_functions.out_string s p n 20 | | CRLF -> 21 | let str = String.sub s p n in 22 | let str = lf_to_crlf str in 23 | out_functions.out_string str 0 (String.length str) 24 | in 25 | let new_functions = { out_functions with out_string } in 26 | Format.pp_set_formatter_out_functions f new_functions; 27 | f 28 | -------------------------------------------------------------------------------- /src/refmt/eol_detect.ml: -------------------------------------------------------------------------------- 1 | type eol = 2 | | LF 3 | | CRLF 4 | 5 | let show eol = match eol with LF -> "lf" | CRLF -> "crlf" 6 | let default_eol = match Sys.win32 with true -> CRLF | _ -> LF 7 | 8 | let get_eol_for_file filename = 9 | let ic = open_in_bin filename in 10 | let rec loop prev = 11 | match input_char ic with 12 | | '\n' -> if prev = '\r' then CRLF else LF 13 | | c -> loop c 14 | in 15 | let eol = try loop ' ' with End_of_file -> default_eol in 16 | close_in ic; 17 | eol 18 | -------------------------------------------------------------------------------- /src/refmt/git_commit.mli: -------------------------------------------------------------------------------- 1 | (* Interface file to ensure git_commit is generated properly with dune *) 2 | 3 | val version : string 4 | val short_version : string 5 | -------------------------------------------------------------------------------- /src/refmt/package.ml: -------------------------------------------------------------------------------- 1 | let version = 2 | match Build_info.V1.version () with 3 | | None -> "n/a" 4 | | Some v -> Build_info.V1.Version.to_string v 5 | 6 | let git_version = Git_commit.version 7 | let git_short_version = Git_commit.short_version 8 | -------------------------------------------------------------------------------- /src/refmt/reason_implementation_printer.mli: -------------------------------------------------------------------------------- 1 | include Printer_maker.PRINTER 2 | -------------------------------------------------------------------------------- /src/refmt/reason_interface_printer.mli: -------------------------------------------------------------------------------- 1 | include Printer_maker.PRINTER 2 | -------------------------------------------------------------------------------- /src/refmttype/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name reason_format_type) 3 | (public_name refmttype) 4 | (package reason) 5 | (libraries reason reason.cmdliner)) 6 | -------------------------------------------------------------------------------- /src/vendored-omp/Makefile: -------------------------------------------------------------------------------- 1 | # This file is part of the migrate-parsetree package. It is released under the 2 | # terms of the LGPL 2.1 license (see LICENSE file). 3 | # Copyright 2017 Frédéric Bour 4 | # 2017 Jérémie Dimino 5 | 6 | INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) 7 | 8 | .PHONY: all 9 | all: 10 | dune build @install 11 | 12 | .PHONY: install 13 | install: 14 | dune install $(INSTALL_ARGS) 15 | 16 | .PHONY: uninstall 17 | uninstall: 18 | dune uninstall $(INSTALL_ARGS) 19 | 20 | .PHONY: reinstall 21 | reinstall: 22 | $(MAKE) uninstall 23 | $(MAKE) install 24 | 25 | .PHONY: test 26 | test: 27 | dune runtest 28 | 29 | .PHONY: all-supported-ocaml-versions 30 | all-supported-ocaml-versions: 31 | dune runtest --workspace dune-workspace.dev 32 | 33 | .PHONY: cinaps 34 | cinaps: 35 | cinaps -styler ocp-indent -i src/migrate_parsetree_versions.ml* 36 | cinaps -styler ocp-indent -i src/migrate_parsetree_4??_4??.ml* 37 | cinaps -styler ocp-indent -i src/migrate_parsetree.ml 38 | 39 | .PHONY: clean 40 | clean: 41 | rm -rf _build *.install 42 | find . -name .merlin -delete 43 | -------------------------------------------------------------------------------- /src/vendored-omp/dune: -------------------------------------------------------------------------------- 1 | ; (install 2 | ; (section doc) 3 | ; (package reason) 4 | ; (files MANUAL.md)) 5 | -------------------------------------------------------------------------------- /src/vendored-omp/dune-project-old: -------------------------------------------------------------------------------- 1 | (lang dune 1.9) 2 | (name ocaml-migrate-parsetree) 3 | (version v1.8.0) 4 | (allow_approximate_merlin) 5 | -------------------------------------------------------------------------------- /src/vendored-omp/dune-workspace.dev: -------------------------------------------------------------------------------- 1 | (lang dune 1.0) 2 | 3 | ;; This file is used by `make all-supported-ocaml-versions` 4 | (context (opam (switch 4.02.3))) 5 | (context (opam (switch 4.03.0))) 6 | (context (opam (switch 4.04.2))) 7 | (context (opam (switch 4.05.0))) 8 | (context (opam (switch 4.06.1))) 9 | (context (opam (switch 4.07.1))) 10 | (context (opam (switch 4.08.1))) 11 | ;; (context (opam (switch ocaml-variants.4.09.0+beta1))) 12 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_define/META: -------------------------------------------------------------------------------- 1 | description = "ocaml-migrate-parsetree example: insert ocaml expressions from commandline" 2 | version = "1.0" 3 | requires(custom_ppx) = "ocaml-migrate-parsetree" 4 | ppx(-custom_ppx,-ppx_driver) = "./ppx_define --as-ppx" 5 | archive(byte,ppx_driver) = "ppx_define.cmo" 6 | archive(native,ppx_driver) = "ppx_define.cmx" 7 | plugin(byte,ppx_driver) = "ppx_define.cma" 8 | plugin(native,ppx_driver) = "ppx_define.cmxs" 9 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_define/Makefile: -------------------------------------------------------------------------------- 1 | PACKAGE=omp_ppx_define 2 | OCAMLC=ocamlfind c 3 | OCAMLOPT=ocamlfind opt 4 | FLAGS=-package ocaml-migrate-parsetree 5 | TARGETS=ppx_define ppx_define.cmo ppx_define.cmx ppx_define.cmxs 6 | 7 | all: build 8 | 9 | clean: 10 | rm -f *.o *.cm* $(TARGETS) 11 | 12 | build: $(TARGETS) 13 | 14 | install: build 15 | ocamlfind install $(PACKAGE) META $(TARGETS) 16 | 17 | uninstall: 18 | ocamlfind remove $(PACKAGE) 19 | 20 | reinstall: 21 | $(MAKE) uninstall 22 | $(MAKE) install 23 | 24 | %.cmo: %.ml 25 | $(OCAMLC) $(FLAGS) -c $^ 26 | 27 | %.cmx: %.ml 28 | $(OCAMLOPT) $(FLAGS) -c $^ 29 | 30 | ppx_define.cmxs: ppx_define.cmx 31 | $(OCAMLOPT) -o $@ -shared $^ 32 | 33 | ppx_define: ppx_define.cmx standalone.ml 34 | $(OCAMLOPT) $(FLAGS) -o $@ -linkpkg $^ 35 | 36 | test: ppx_define 37 | @echo "(* Original file: cat test.ml *)" 38 | @cat test.ml 39 | @echo "(* Substituted file: ./ppx_define -D 'var="hello"' test.ml *)" 40 | @./ppx_define -D 'var="hello"' test.ml 41 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_define/standalone.ml: -------------------------------------------------------------------------------- 1 | open Migrate_parsetree 2 | 3 | (* To run as a standalone binary, run the registered drivers *) 4 | let () = Driver.run_main () 5 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_define/test.ml: -------------------------------------------------------------------------------- 1 | let () = print_endline var 2 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_here/META: -------------------------------------------------------------------------------- 1 | description = "ocaml-migrate-parsetree example: replace __HERE__ by location" 2 | version = "1.0" 3 | requires(custom_ppx) = "ocaml-migrate-parsetree" 4 | ppx(-custom_ppx,-ppx_driver) = "./ppx_here --as-ppx" 5 | archive(byte,ppx_driver) = "ppx_here.cmo" 6 | archive(native,ppx_driver) = "ppx_here.cmx" 7 | plugin(byte,ppx_driver) = "ppx_here.cma" 8 | plugin(native,ppx_driver) = "ppx_here.cmxs" 9 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_here/Makefile: -------------------------------------------------------------------------------- 1 | PACKAGE=omp_ppx_here 2 | OCAMLC=ocamlfind c 3 | OCAMLOPT=ocamlfind opt 4 | FLAGS=-package ocaml-migrate-parsetree 5 | TARGETS=ppx_here ppx_here.cmo ppx_here.cmx ppx_here.cmxs 6 | 7 | all: build 8 | 9 | clean: 10 | rm -f *.o *.cm* $(TARGETS) 11 | 12 | build: $(TARGETS) 13 | 14 | install: build 15 | ocamlfind install $(PACKAGE) META $(TARGETS) 16 | 17 | uninstall: 18 | ocamlfind remove $(PACKAGE) 19 | 20 | reinstall: 21 | $(MAKE) uninstall 22 | $(MAKE) install 23 | 24 | %.cmo: %.ml 25 | $(OCAMLC) $(FLAGS) -c $^ 26 | 27 | %.cmx: %.ml 28 | $(OCAMLOPT) $(FLAGS) -c $^ 29 | 30 | ppx_here.cmxs: ppx_here.cmx 31 | $(OCAMLOPT) -o $@ -shared $^ 32 | 33 | ppx_here: ppx_here.cmx standalone.ml 34 | $(OCAMLOPT) $(FLAGS) -o $@ -linkpkg $^ 35 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_here/ppx_here.ml: -------------------------------------------------------------------------------- 1 | open Migrate_parsetree 2 | 3 | (* Define the rewriter on OCaml 4.05 AST *) 4 | open Ast_405 5 | let ocaml_version = Versions.ocaml_405 6 | 7 | (* Action of the rewriter: replace __HERE__ expression by a tuple ("filename", 8 | line, col) *) 9 | let mapper _config _cookies = 10 | let open Ast_mapper in 11 | let open Ast_helper in 12 | let expr mapper pexp = 13 | match pexp.Parsetree.pexp_desc with 14 | | Parsetree.Pexp_ident {Location.txt = Longident.Lident "__HERE__"; loc} -> 15 | let {Lexing. pos_fname; pos_lnum; pos_cnum; pos_bol} = 16 | loc.Location.loc_start in 17 | let loc = {loc with Location.loc_ghost = true} in 18 | let fname = Exp.constant ~loc (Const.string pos_fname) in 19 | let line = Exp.constant ~loc (Const.int pos_lnum) in 20 | let col = Exp.constant ~loc (Const.int (pos_cnum - pos_bol)) in 21 | {pexp with Parsetree.pexp_desc = 22 | Parsetree.Pexp_tuple [fname; line; col]} 23 | | _ -> default_mapper.expr mapper pexp 24 | in 25 | {default_mapper with expr} 26 | 27 | (* Register the rewriter in the driver *) 28 | let () = 29 | Driver.register ~name:"ppx_here" ocaml_version mapper 30 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_here/standalone.ml: -------------------------------------------------------------------------------- 1 | open Migrate_parsetree 2 | 3 | (* To run as a standalone binary, run the registered drivers *) 4 | let () = Driver.run_main () 5 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_parse/META: -------------------------------------------------------------------------------- 1 | description = "Parse strings into fragment of the AST" 2 | version = "1.0" 3 | requires(custom_ppx) = "ocaml-migrate-parsetree" 4 | ppx(-custom_ppx,-ppx_driver) = "./ppx_parse --as-ppx" 5 | archive(byte,ppx_driver) = "ppx_parse.cmo" 6 | archive(native,ppx_driver) = "ppx_parse.cmx" 7 | plugin(byte,ppx_driver) = "ppx_parse.cma" 8 | plugin(native,ppx_driver) = "ppx_parse.cmxs" 9 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_parse/Makefile: -------------------------------------------------------------------------------- 1 | PACKAGE=ppx_parse 2 | OCAMLC=ocamlfind c 3 | OCAMLOPT=ocamlfind opt 4 | FLAGS=-package ocaml-migrate-parsetree 5 | TARGETS=ppx_parse ppx_parse.cmo ppx_parse.cmx ppx_parse.cmxs 6 | 7 | all: build 8 | 9 | clean: 10 | rm -f *.o *.cm* $(TARGETS) 11 | 12 | build: $(TARGETS) 13 | 14 | install: build 15 | ocamlfind install $(PACKAGE) META $(TARGETS) 16 | 17 | uninstall: 18 | ocamlfind remove $(PACKAGE) 19 | 20 | reinstall: 21 | $(MAKE) uninstall 22 | $(MAKE) install 23 | 24 | %.cmo: %.ml 25 | $(OCAMLC) $(FLAGS) -c $^ 26 | 27 | %.cmx: %.ml 28 | $(OCAMLOPT) $(FLAGS) -c $^ 29 | 30 | ppx_parse.cmxs: ppx_parse.cmx 31 | $(OCAMLOPT) -o $@ -shared $^ 32 | 33 | ppx_parse: ppx_parse.cmx standalone.ml 34 | $(OCAMLOPT) $(FLAGS) -o $@ -linkpkg $^ 35 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_parse/ppx_parse.ml: -------------------------------------------------------------------------------- 1 | open Migrate_parsetree 2 | 3 | (* Define the rewriter on OCaml 4.04 AST *) 4 | open Ast_404 5 | let ocaml_version = Versions.ocaml_404 6 | 7 | let from_current = Versions.migrate Versions.ocaml_current ocaml_version 8 | 9 | let prepare_lexbuf pos source = 10 | let lexbuf = Lexing.from_string source in 11 | lexbuf.Lexing.lex_curr_p <- pos; 12 | lexbuf 13 | 14 | let prepare_for_parsing pexp = 15 | let open Parsetree in 16 | match pexp.pexp_desc with 17 | | Pexp_constant (Pconst_string (source, Some "quote")) -> 18 | let pos = 19 | let pos = pexp.pexp_loc.Location.loc_start in 20 | let pos_cnum = pos.Lexing.pos_cnum + String.length "{quote|" in 21 | {pos with Lexing.pos_cnum} 22 | in 23 | Some (prepare_lexbuf pos source) 24 | | _ -> None 25 | 26 | let mapper _config _cookies = 27 | let open Ast_mapper in 28 | let open Ast_helper in 29 | let expr mapper pexp = 30 | let pexp = default_mapper.expr mapper pexp in 31 | match prepare_for_parsing pexp with 32 | | Some lexbuf -> 33 | from_current.Versions.copy_expression (Parse.expression lexbuf) 34 | | None -> pexp 35 | in 36 | {default_mapper with expr} 37 | 38 | (* Register the rewriter in the driver *) 39 | let () = 40 | Driver.register ~name:"ppx_parse" ocaml_version mapper 41 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_parse/standalone.ml: -------------------------------------------------------------------------------- 1 | open Migrate_parsetree 2 | 3 | (* To run as a standalone binary, run the registered drivers *) 4 | let () = Driver.run_main () 5 | -------------------------------------------------------------------------------- /src/vendored-omp/examples/omp_ppx_parse/test.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | {quote| 3 | let x = 5 in 4 | () 5 | |quote} 6 | -------------------------------------------------------------------------------- /src/vendored-omp/ocaml-migrate-parsetree.backup-opam: -------------------------------------------------------------------------------- 1 | version: "1.8.0" 2 | opam-version: "2.0" 3 | maintainer: "frederic.bour@lakaban.net" 4 | authors: [ 5 | "Frédéric Bour " 6 | "Jérémie Dimino " 7 | ] 8 | license: "LGPL-2.1 with OCaml linking exception" 9 | homepage: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree" 10 | bug-reports: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/issues" 11 | dev-repo: "git+https://github.com/ocaml-ppx/ocaml-migrate-parsetree.git" 12 | doc: "https://ocaml-ppx.github.io/ocaml-migrate-parsetree/" 13 | tags: [ "syntax" "org:ocamllabs" ] 14 | build: [ 15 | ["dune" "build" "-p" name "-j" jobs] 16 | ] 17 | depends: [ 18 | "result" 19 | "ppx_derivers" 20 | "dune" {>= "1.9.0"} 21 | "ocaml" {>= "4.02.3"} 22 | ] 23 | synopsis: "Convert OCaml parsetrees between different versions" 24 | description: """ 25 | Convert OCaml parsetrees between different versions 26 | 27 | This library converts parsetrees, outcometree and ast mappers between 28 | different OCaml versions. High-level functions help making PPX 29 | rewriters independent of a compiler version. 30 | """ -------------------------------------------------------------------------------- /src/vendored-omp/src/compiler-functions/ge_406_and_lt_408.ml: -------------------------------------------------------------------------------- 1 | let error_of_exn exn = 2 | match Location.error_of_exn exn with 3 | | Some (`Ok exn) -> Some exn 4 | | Some `Already_displayed -> None 5 | | None -> None 6 | 7 | let get_load_paths () = 8 | !Config.load_path 9 | 10 | let load_path_init l = 11 | Config.load_path := l 12 | 13 | let get_unboxed_types () = 14 | !Clflags.unboxed_types 15 | 16 | let set_unboxed_types b = 17 | Clflags.unboxed_types := b 18 | 19 | let may_map = Misc.may_map 20 | 21 | let bad_docstring t = Warnings.Bad_docstring t 22 | -------------------------------------------------------------------------------- /src/vendored-omp/src/compiler-functions/ge_408_and_lt_410.ml: -------------------------------------------------------------------------------- 1 | let error_of_exn exn = 2 | match Location.error_of_exn exn with 3 | | Some (`Ok exn) -> Some exn 4 | | Some `Already_displayed -> None 5 | | None -> None 6 | 7 | let get_load_paths () = 8 | Load_path.get_paths () 9 | 10 | let load_path_init l = 11 | Load_path.init l 12 | 13 | let get_unboxed_types () = 14 | !Clflags.unboxed_types 15 | 16 | let set_unboxed_types b = 17 | Clflags.unboxed_types := b 18 | 19 | let may_map = Misc.may_map 20 | 21 | let bad_docstring t = Warnings.Bad_docstring t 22 | -------------------------------------------------------------------------------- /src/vendored-omp/src/compiler-functions/ge_410_and_lt_412.ml: -------------------------------------------------------------------------------- 1 | let error_of_exn exn = 2 | match Location.error_of_exn exn with 3 | | Some (`Ok exn) -> Some exn 4 | | Some `Already_displayed -> None 5 | | None -> None 6 | 7 | let get_load_paths () = 8 | Load_path.get_paths () 9 | 10 | let load_path_init l = 11 | Load_path.init l 12 | 13 | let get_unboxed_types () = 14 | !Clflags.unboxed_types 15 | 16 | let set_unboxed_types b = 17 | Clflags.unboxed_types := b 18 | 19 | let may_map = Option.map 20 | 21 | let bad_docstring t = Warnings.Bad_docstring t 22 | -------------------------------------------------------------------------------- /src/vendored-omp/src/compiler-functions/ge_412.ml: -------------------------------------------------------------------------------- 1 | let error_of_exn exn = 2 | match Location.error_of_exn exn with 3 | | Some (`Ok exn) -> Some exn 4 | | Some `Already_displayed -> None 5 | | None -> None 6 | 7 | let get_load_paths () = 8 | Load_path.get_paths () 9 | 10 | let load_path_init l = 11 | Load_path.init l 12 | 13 | let get_unboxed_types () = 14 | !Clflags.unboxed_types 15 | 16 | let set_unboxed_types b = 17 | Clflags.unboxed_types := b 18 | 19 | let may_map = Option.map 20 | 21 | let bad_docstring t = Warnings.Unexpected_docstring t 22 | -------------------------------------------------------------------------------- /src/vendored-omp/src/compiler-functions/ge_50.ml: -------------------------------------------------------------------------------- 1 | let error_of_exn exn = 2 | match Location.error_of_exn exn with 3 | | Some (`Ok exn) -> Some exn 4 | | Some `Already_displayed -> None 5 | | None -> None 6 | 7 | let get_load_paths () = 8 | Load_path.get_paths () 9 | 10 | let load_path_init l = 11 | let auto_include find_in_dir fn = 12 | if !Clflags.no_std_include then 13 | raise Not_found 14 | else 15 | let alert = Location.auto_include_alert in 16 | Load_path.auto_include_otherlibs alert find_in_dir fn 17 | in 18 | Load_path.init ~auto_include l 19 | 20 | let get_unboxed_types () = 21 | !Clflags.unboxed_types 22 | 23 | let set_unboxed_types b = 24 | Clflags.unboxed_types := b 25 | 26 | let may_map = Option.map 27 | 28 | let bad_docstring t = Warnings.Unexpected_docstring t 29 | -------------------------------------------------------------------------------- /src/vendored-omp/src/compiler-functions/ge_52.ml: -------------------------------------------------------------------------------- 1 | let error_of_exn exn = 2 | match Location.error_of_exn exn with 3 | | Some (`Ok exn) -> Some exn 4 | | Some `Already_displayed -> None 5 | | None -> None 6 | 7 | let get_load_paths () = 8 | Load_path.get_paths () 9 | 10 | let load_path_init l = 11 | let auto_include find_in_dir fn = 12 | if !Clflags.no_std_include then 13 | raise Not_found 14 | else 15 | let alert = Location.auto_include_alert in 16 | Load_path.auto_include_otherlibs alert find_in_dir fn 17 | in 18 | Load_path.init ~auto_include ~visible:l ~hidden:[] 19 | 20 | let get_unboxed_types () = 21 | !Clflags.unboxed_types 22 | 23 | let set_unboxed_types b = 24 | Clflags.unboxed_types := b 25 | 26 | let may_map = Option.map 27 | 28 | let bad_docstring t = Warnings.Unexpected_docstring t 29 | -------------------------------------------------------------------------------- /src/vendored-omp/src/compiler-functions/lt_406.ml: -------------------------------------------------------------------------------- 1 | let error_of_exn = Location.error_of_exn 2 | 3 | let get_load_paths () = 4 | !Config.load_path 5 | 6 | let load_path_init l = 7 | Config.load_path := l 8 | 9 | let get_unboxed_types () = 10 | false 11 | 12 | let set_unboxed_types _b = 13 | () 14 | 15 | let may_map = Misc.may_map 16 | 17 | let bad_docstring t = Warnings.Bad_docstring t 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_402_403.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_402_403_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_403_402.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_403_402_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_403_404.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_403_404_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_404_403.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_404_403_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_404_405.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_404_405_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_405_404.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_405_404_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_405_406.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_405_406_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_406_405.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_406_405_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_406_407.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_406_407_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_407_406.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_407_406_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_407_408.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_407_408_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_408_407.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_408_407_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_408_409.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_408_409_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_409_408.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_409_408_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_409_410.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_409_410_migrate 17 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_410_409.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_410_409_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_410_411.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_410_411_migrate 17 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_411_410.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_411_410_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_411_412.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_411_412_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_412_411.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_412_411_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_412_413.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_412_413_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_413_412.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_413_412_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_413_414.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_413_414_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_414_413.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_414_413_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_414_500.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_414_500_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_500_414.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_500_414_migrate 17 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_500_51.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_500_51_migrate 17 | 18 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_51_500.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml Migrate Parsetree *) 4 | (* *) 5 | (* Frédéric Bour *) 6 | (* *) 7 | (* Copyright 2017 Institut National de Recherche en Informatique et *) 8 | (* en Automatique (INRIA). *) 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 | include Migrate_parsetree_51_500_migrate 17 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_51_52.ml: -------------------------------------------------------------------------------- 1 | 2 | include Migrate_parsetree_51_52_migrate 3 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_52_51.ml: -------------------------------------------------------------------------------- 1 | 2 | include Migrate_parsetree_52_51_migrate 3 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_52_53.ml: -------------------------------------------------------------------------------- 1 | include Migrate_parsetree_52_53_migrate 2 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_53_52.ml: -------------------------------------------------------------------------------- 1 | include Migrate_parsetree_53_52_migrate 2 | -------------------------------------------------------------------------------- /src/vendored-omp/src/migrate_parsetree_driver_main.ml: -------------------------------------------------------------------------------- 1 | let () = Reason_omp.Driver.run_main () 2 | -------------------------------------------------------------------------------- /src/vendored-omp/src/stdlib0.ml: -------------------------------------------------------------------------------- 1 | module Int = struct 2 | let to_string = string_of_int 3 | end 4 | 5 | module Option = struct 6 | let map f o = 7 | match o with 8 | | None -> None 9 | | Some v -> Some (f v) 10 | end 11 | -------------------------------------------------------------------------------- /src/vendored-omp/tools/add_special_comments.mli: -------------------------------------------------------------------------------- 1 | (* empty *) 2 | -------------------------------------------------------------------------------- /src/vendored-omp/tools/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name add_special_comments) 3 | (modules add_special_comments) 4 | (libraries compiler-libs.common compiler-libs.bytecomp) 5 | (flags :standard -w -3) 6 | (enabled_if 7 | (>= %{ocaml_version} 4.13))) 8 | 9 | (executables 10 | (names pp) 11 | (modules pp pp_rewrite) 12 | (libraries compiler-libs.common compiler-libs.bytecomp) 13 | (flags :standard -w -3)) 14 | 15 | (ocamllex pp_rewrite) 16 | 17 | (executable 18 | (name gencopy) 19 | (enabled_if 20 | (>= %{ocaml_version} 5.2)) 21 | (modules gencopy) 22 | (libraries compiler-libs.common compiler-libs.bytecomp) 23 | (flags :standard -w -3)) 24 | -------------------------------------------------------------------------------- /src/vendored-omp/tools/pp.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | match Sys.argv with 3 | | [|_; ocaml_version; fname|] -> 4 | let is_current = 5 | (Filename.basename fname = Printf.sprintf "ast_%s.ml" ocaml_version) 6 | in 7 | let ic = open_in_bin fname in 8 | Printf.printf "# 1 %S\n" fname; 9 | Pp_rewrite.rewrite is_current ocaml_version (Lexing.from_channel ic) 10 | | _ -> 11 | Printf.eprintf "%s: \n" 12 | Sys.executable_name; 13 | exit 2 14 | -------------------------------------------------------------------------------- /src/vendored-omp/tools/pp.mli: -------------------------------------------------------------------------------- 1 | (* empty *) 2 | -------------------------------------------------------------------------------- /src/vendored-omp/tools/pp_rewrite.mli: -------------------------------------------------------------------------------- 1 | val rewrite : bool -> string -> Lexing.lexbuf -> unit 2 | -------------------------------------------------------------------------------- /test/4.06/attributes.t: -------------------------------------------------------------------------------- 1 | $ cat > input.re < /* Pexp_letexception with attributes */ 3 | > let () = { 4 | > [@attribute] exception E; 5 | > raise(E) 6 | > }; 7 | > 8 | > /** Different payloads **/ 9 | > 10 | > /* Empty signature */ 11 | > 12 | > [@haha: ] 13 | > let x = 5; 14 | > 15 | > /* signature_item */ 16 | > [@haha: let x : option(int)] 17 | > let x = 5; 18 | > 19 | > /* Signature */ 20 | > [@haha: type t; let x : option(t)] 21 | > let x = 5; 22 | > EOF 23 | 24 | Format basic 25 | $ refmt --print re ./input.re > ./formatted.re 26 | 27 | Print the formatted file 28 | $ cat ./formatted.re 29 | /* Pexp_letexception with attributes */ 30 | let () = { 31 | [@attribute] 32 | exception E; 33 | raise(E); 34 | }; 35 | 36 | /** Different payloads **/ 37 | 38 | /* Empty signature */ 39 | 40 | [@haha:] 41 | let x = 5; 42 | 43 | /* signature_item */ 44 | [@haha: let x: option(int)] 45 | let x = 5; 46 | 47 | /* Signature */ 48 | [@haha: type t; let x: option(t)] 49 | let x = 5; 50 | 51 | Type-check basics 52 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 53 | 54 | Format the formatted file back 55 | $ refmt --print re ./formatted.re > ./formatted_back.re 56 | 57 | Ensure idempotency: first format and second format are the same 58 | $ diff formatted.re formatted_back.re 59 | -------------------------------------------------------------------------------- /test/4.06/dune: -------------------------------------------------------------------------------- 1 | (cram 2 | (enabled_if 3 | (or 4 | (= %{ocaml_version} 4.06.0) 5 | (= %{ocaml_version} 4.06.1)))) 6 | -------------------------------------------------------------------------------- /test/4.06/error-comments.t: -------------------------------------------------------------------------------- 1 | Format ./input.re 2 | $ cat >input.re < /* this is an unterminated comment 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 0-2: 8 | Error: Comment not terminated 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/error-lowercase_module.t: -------------------------------------------------------------------------------- 1 | Print error for lowercase module 2 | $ cat >input.re < module lowercase = {}; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 7-16: 8 | Error: Module names must start with an uppercase letter. 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/error-lowercase_module_rec.t: -------------------------------------------------------------------------------- 1 | Print error for lowercase module 2 | $ cat >input.re < module rec lowercase = {}; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-20: 8 | Error: Module names must start with an uppercase letter. 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/error-reservedField.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < let x = {< type >}; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-15: 8 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/error-reservedRecord.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < let foo = { foo: "bar", type: "qux" }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 24-28: 8 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/error-reservedRecordPunned.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < let foo = { ...other, type }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 22-26: 8 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/error-reservedRecordType.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < type x = { type: string }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-15: 8 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 9 | [1] 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/4.06/error-reservedRecordTypePunned.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < type x = { type }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-15: 8 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/error-syntaxError.t: -------------------------------------------------------------------------------- 1 | Force error for try catch 2 | $ cat >input.re < try (bad); 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 9-10: 8 | Error: Syntax error 9 | [1] 10 | -------------------------------------------------------------------------------- /test/4.06/typecheck-module-and-class.t: -------------------------------------------------------------------------------- 1 | $ cat > input.ml < module EM = struct 3 | > (** Exception *) 4 | > exception E of int * int 5 | > end 6 | > 7 | > (* Pcl_open *) 8 | > class x = let open EM in object (self) end 9 | > 10 | > module OM = struct 11 | > type t 12 | > end 13 | > 14 | > class y = let open EM in let open OM in object (self) end 15 | > 16 | > module type S = sig 17 | > type t = private .. 18 | > type t += Foo 19 | > end 20 | > EOF 21 | 22 | Format basic 23 | $ refmt --print re ./input.ml > ./formatted.re 24 | 25 | Type-check basics 26 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 27 | 28 | Format the formatted file back 29 | $ refmt --print re ./formatted.re > ./formatted_back.re 30 | 31 | Ensure idempotency: first format and second format are the same 32 | $ diff formatted.re formatted_back.re 33 | -------------------------------------------------------------------------------- /test/4.08/dune: -------------------------------------------------------------------------------- 1 | (cram 2 | (enabled_if 3 | (or 4 | (= %{ocaml_version} 4.08.0) 5 | (= %{ocaml_version} 4.08.1) 6 | (= %{ocaml_version} 4.08.2)))) 7 | -------------------------------------------------------------------------------- /test/4.08/error-comments.t: -------------------------------------------------------------------------------- 1 | Format ./input.re 2 | $ cat >input.re < /* this is an unterminated comment 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 0-2: 8 | 1 | /* this is an unterminated comment 9 | ^^ 10 | Error: Comment not terminated 11 | 12 | [1] 13 | -------------------------------------------------------------------------------- /test/4.08/error-lowercase_module.t: -------------------------------------------------------------------------------- 1 | Print error for lowercase module 2 | $ cat >input.re < module lowercase = {}; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 7-16: 8 | 1 | module lowercase = {}; 9 | ^^^^^^^^^ 10 | Error: Module names must start with an uppercase letter. 11 | 12 | [1] 13 | -------------------------------------------------------------------------------- /test/4.08/error-lowercase_module_rec.t: -------------------------------------------------------------------------------- 1 | Print error for lowercase module 2 | $ cat >input.re < module rec lowercase = {}; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-20: 8 | 1 | module rec lowercase = {}; 9 | ^^^^^^^^^ 10 | Error: Module names must start with an uppercase letter. 11 | 12 | [1] 13 | -------------------------------------------------------------------------------- /test/4.08/error-reservedField.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < let x = {< type >}; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-15: 8 | 1 | let x = {< type >}; 9 | ^^^^ 10 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 11 | 12 | [1] 13 | -------------------------------------------------------------------------------- /test/4.08/error-reservedRecord.t: -------------------------------------------------------------------------------- 1 | Force error for type ./input.re 2 | $ cat >input.re < let foo = { foo: "bar", type: "qux" }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 24-28: 8 | 1 | let foo = { foo: "bar", type: "qux" }; 9 | ^^^^ 10 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 11 | 12 | [1] 13 | -------------------------------------------------------------------------------- /test/4.08/error-reservedRecordPunned.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < let foo = { ...other, type }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 22-26: 8 | 1 | let foo = { ...other, type }; 9 | ^^^^ 10 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 11 | 12 | [1] 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/4.08/error-reservedRecordType.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < type x = { type: string }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-15: 8 | 1 | type x = { type: string }; 9 | ^^^^ 10 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 11 | 12 | [1] 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/4.08/error-reservedRecordTypePunned.t: -------------------------------------------------------------------------------- 1 | Print error for type reserved keyword 2 | $ cat >input.re < type x = { type }; 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 11-15: 8 | 1 | type x = { type }; 9 | ^^^^ 10 | Error: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead 11 | 12 | [1] 13 | -------------------------------------------------------------------------------- /test/4.08/error-syntaxError.t: -------------------------------------------------------------------------------- 1 | Force error for type ./input.re 2 | $ cat >input.re < try (bad); 4 | > EOF 5 | 6 | $ refmt ./input.re 7 | File "./input.re", line 1, characters 9-10: 8 | 1 | try (bad); 9 | ^ 10 | Error: Syntax error 11 | 12 | [1] 13 | -------------------------------------------------------------------------------- /test/4.08/mlSyntax.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.ml > ./formatted.re 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 6 | File "formatted.re", line 71, characters 8-23: 7 | 71 | let _ = Pervasives.(==); 8 | ^^^^^^^^^^^^^^^ 9 | Alert deprecated: module Stdlib.Pervasives 10 | Use Stdlib instead. 11 | 12 | If you need to stay compatible with OCaml < 4.07, you can use the 13 | stdlib-shims library: https://github.com/ocaml/stdlib-shims 14 | 15 | Format the formatted file back 16 | $ refmt --print re ./formatted.re > ./formatted_back.re 17 | 18 | Ensure idempotency: first format and second format are the same 19 | $ diff formatted.re formatted_back.re 20 | -------------------------------------------------------------------------------- /test/4.08/typecheck-features.t: -------------------------------------------------------------------------------- 1 | $ cat > input.mli < module X : sig 3 | > type t 4 | > end 5 | > 6 | > module M := X 7 | > 8 | > module N := X [@@attr] 9 | > 10 | > type y = int 11 | > 12 | > type z = int 13 | > 14 | > type t = int 15 | > 16 | > type x := y 17 | > 18 | > type y := z [@@attr1] 19 | > and w := t [@@attr2] 20 | > 21 | > type x' = | and y' = | 22 | > EOF 23 | 24 | Format basic 25 | $ refmt --print re ./input.mli > ./formatted.rei 26 | 27 | Type-check basics 28 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -intf formatted.rei 29 | 30 | Format the formatted file back 31 | $ refmt --print re ./formatted.rei > ./formatted_back.rei 32 | 33 | Ensure idempotency: first format and second format are the same 34 | $ diff formatted.rei formatted_back.rei 35 | -------------------------------------------------------------------------------- /test/4.10/dune: -------------------------------------------------------------------------------- 1 | ; Disable these tests in windows since their output don't match, and we 2 | ; want to ensure the output works in other systems 3 | 4 | (cram 5 | (enabled_if 6 | (and 7 | (or 8 | (= %{system} "macosx") 9 | (= %{system} "linux")) 10 | (or 11 | (= %{ocaml_version} 4.10.0) 12 | (= %{ocaml_version} 4.10.1) 13 | (= %{ocaml_version} 4.10.2) 14 | (= %{ocaml_version} 4.10.3))))) 15 | -------------------------------------------------------------------------------- /test/4.10/local-openings.t/input.ml: -------------------------------------------------------------------------------- 1 | module Foo = struct 2 | type t = { name: string } 3 | end 4 | 5 | let foo Foo.{name} = () 6 | 7 | let f = function 8 | | Foo.{name} -> () 9 | | _ -> () 10 | 11 | let x = { Foo.name = "Reason" } 12 | let Foo.{name} = x 13 | 14 | let Foo.{name}, _ = x, () 15 | -------------------------------------------------------------------------------- /test/4.10/local-openings.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.ml > ./formatted.re 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 6 | File "formatted.re", line 10, characters 2-5: 7 | 10 | | _ => (); 8 | ^^^ 9 | Warning 11: this match case is unused. 10 | 11 | Format the formatted file back 12 | $ refmt --print re ./formatted.re > ./formatted_back.re 13 | 14 | Ensure idempotency: first format and second format are the same 15 | $ diff formatted.re formatted_back.re 16 | -------------------------------------------------------------------------------- /test/4.10/typecheck-let-ops.t: -------------------------------------------------------------------------------- 1 | $ cat > input.ml < open struct 3 | > type t = string 4 | > end 5 | > 6 | > let (let+) x f = List.map f x 7 | > 8 | > let (and+) = List.map2 (fun x y -> x,y) 9 | > 10 | > let x = 11 | > let+ x = [2] 12 | > and+ y = [3] 13 | > in 14 | > x, y 15 | > 16 | > let y = 17 | > let+ x = [2] in 18 | > x 19 | > EOF 20 | 21 | Format basic 22 | $ refmt --print re ./input.ml > ./formatted.re 23 | 24 | Type-check basics 25 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 26 | 27 | Format the formatted file back 28 | $ refmt --print re ./formatted.re > ./formatted_back.re 29 | 30 | Ensure idempotency: first format and second format are the same 31 | $ diff formatted.re formatted_back.re 32 | -------------------------------------------------------------------------------- /test/4.12/dune: -------------------------------------------------------------------------------- 1 | ; Disable these tests in windows since their output don't match, and we 2 | ; want to ensure the output works in other systems 3 | 4 | (cram 5 | (enabled_if 6 | (and 7 | (or 8 | (= %{system} "macosx") 9 | (= %{system} "linux")) 10 | (or 11 | (= %{ocaml_version} 4.12.0) 12 | (= %{ocaml_version} 4.12.1))))) 13 | -------------------------------------------------------------------------------- /test/4.12/local-openings.t/input.ml: -------------------------------------------------------------------------------- 1 | module Foo = struct 2 | type t = { name: string } 3 | end 4 | 5 | let foo Foo.{name} = () 6 | 7 | let f = function 8 | | Foo.{name} -> () 9 | | _ -> () 10 | 11 | let x = { Foo.name = "Reason" } 12 | let Foo.{name} = x 13 | 14 | let Foo.{name}, _ = x, () 15 | -------------------------------------------------------------------------------- /test/4.12/local-openings.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.ml > ./formatted.re 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 6 | File "formatted.re", line 10, characters 2-5: 7 | 10 | | _ => (); 8 | ^^^ 9 | Warning 11 [redundant-case]: this match case is unused. 10 | 11 | Format the formatted file back 12 | $ refmt --print re ./formatted.re > ./formatted_back.re 13 | 14 | Ensure idempotency: first format and second format are the same 15 | $ diff formatted.re formatted_back.re 16 | -------------------------------------------------------------------------------- /test/4.12/typecheck-let-ops.t: -------------------------------------------------------------------------------- 1 | $ cat > input.ml < open struct 3 | > type t = string 4 | > end 5 | > 6 | > let (let+) x f = List.map f x 7 | > 8 | > let (and+) = List.map2 (fun x y -> x,y) 9 | > 10 | > let x = 11 | > let+ x = [2] 12 | > and+ y = [3] 13 | > in 14 | > x, y 15 | > 16 | > let y = 17 | > let+ x = [2] in 18 | > x 19 | > EOF 20 | 21 | Format basic 22 | $ refmt --print re ./input.ml > ./formatted.re 23 | 24 | Type-check basics 25 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 26 | 27 | Format the formatted file back 28 | $ refmt --print re ./formatted.re > ./formatted_back.re 29 | 30 | Ensure idempotency: first format and second format are the same 31 | $ diff formatted.re formatted_back.re 32 | -------------------------------------------------------------------------------- /test/arityConversion.t/arity.txt: -------------------------------------------------------------------------------- 1 | And 2 | TupleConstructor 3 | Or 4 | M.TupleConstructorInModule 5 | TupleConstructor2 6 | .TupleConstructor3 7 | M.TupleConstructor3 8 | -------------------------------------------------------------------------------- /test/arityConversion.t/input.ml: -------------------------------------------------------------------------------- 1 | Some (1, 2, 3) 2 | 3 | type bcd = TupleConstructor of (int * int) | MultiArgumentsConstructor of int * int 4 | 5 | let a = TupleConstructor(1, 2) 6 | let b = MultiArgumentsConstructor(1, 2) 7 | 8 | module Test = struct 9 | type a = | And of (int * int) | Or of (int * int) 10 | end;; 11 | 12 | let _ = Test.And (1, 2) 13 | let _ = Test.Or (1, 2) 14 | let _ = Some 1;; 15 | 16 | Test.And (1, 2);; 17 | Test.Or (1, 2);; 18 | Some 1;; 19 | 20 | module M = struct 21 | type t = TupleConstructorInModule of (int * int) 22 | type t2 = TupleConstructor2 of (int * int) 23 | type t3 = TupleConstructor3 of (int * int) 24 | end 25 | 26 | type t2 = TupleConstructor2 of (int * int) 27 | type t3 = TupleConstructor3 of (int * int) 28 | 29 | let _ = M.TupleConstructorInModule (1,2) 30 | 31 | let _ = M.TupleConstructor2 (1,2) 32 | let _ = TupleConstructor2 (1,2) 33 | 34 | let _ = M.TupleConstructor3 (1,2) 35 | let _ = TupleConstructor3 (1,2);; 36 | 37 | M.TupleConstructorInModule (1,2);; 38 | 39 | M.TupleConstructor2 (1,2);; 40 | TupleConstructor2 (1,2);; 41 | 42 | M.TupleConstructor3 (1,2);; 43 | TupleConstructor3 (1,2);; 44 | -------------------------------------------------------------------------------- /test/arityConversion.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --heuristics-file ./arity.txt --print re ./input.ml > ./formatted.re 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 6 | 7 | Format the formatted file back 8 | $ refmt --print re ./formatted.re > ./formatted_back.re 9 | 10 | Ensure idempotency: first format and second format are the same 11 | $ diff formatted.re formatted_back.re 12 | -------------------------------------------------------------------------------- /test/assert.t/input.re: -------------------------------------------------------------------------------- 1 | switch(true) { 2 | | true => () 3 | | false => assert(false) 4 | | _ => assert false 5 | }; 6 | 7 | let root = { 8 | let root = Doc.rootNode(doc); 9 | assert (root.type_ == "expression"); 10 | assert (Node.namedChildCount(root) == 1); 11 | assert (Node.childCount(root) == 1); 12 | assert (Point.toString(root.startPoint) == "(Point.t {:row 0 :column 0})"); 13 | assert (Point.toString(root.endPoint) == "(Point.t {:row 0 :column 9})"); 14 | root; 15 | }; 16 | 17 | assert(theTruth()); 18 | -------------------------------------------------------------------------------- /test/assert.t/run.t: -------------------------------------------------------------------------------- 1 | Format assertions 2 | $ refmt ./input.re 3 | switch (true) { 4 | | true => () 5 | | false => assert(false) 6 | | _ => assert(false) 7 | }; 8 | 9 | let root = { 10 | let root = Doc.rootNode(doc); 11 | assert(root.type_ == "expression"); 12 | assert(Node.namedChildCount(root) == 1); 13 | assert(Node.childCount(root) == 1); 14 | assert( 15 | Point.toString(root.startPoint) 16 | == "(Point.t {:row 0 :column 0})", 17 | ); 18 | assert( 19 | Point.toString(root.endPoint) 20 | == "(Point.t {:row 0 :column 9})", 21 | ); 22 | root; 23 | }; 24 | 25 | assert(theTruth()); 26 | -------------------------------------------------------------------------------- /test/attributes-rei.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.rei > ./formatted.rei 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf formatted.rei 6 | 7 | Format the formatted file back 8 | $ refmt --print re ./formatted.rei > ./formatted_back.rei 9 | 10 | Ensure idempotency: first format and second format are the same 11 | $ diff formatted.rei formatted_back.rei 12 | -------------------------------------------------------------------------------- /test/backportSyntax.t/input.re: -------------------------------------------------------------------------------- 1 | 2 | let (let.opt) = (x, f) => switch x { | None => None | Some(x) => f(x) }; 3 | let (let.&opt) = (x, f) => switch x { | None => None | Some(x) => Some(f(x)) }; 4 | let (and.opt) = (a, b) => switch (a, b) { | (Some(a), Some(b)) => Some((a, b)) | _ => None }; 5 | 6 | let x = { 7 | let.opt a = Some(1); 8 | let.opt b = Some(2) 9 | and.opt c = Some(3) 10 | and.opt d = Some(4); 11 | Some((a, b, c, d)) 12 | } 13 | let y = { 14 | let.opt a = Some(1) 15 | and.opt b = None 16 | and.opt c = Some(4); 17 | Some((a, b, c)) 18 | } 19 | assert(x == Some((1,2,3,4))); 20 | assert(y == None); 21 | print_endline("Success") 22 | -------------------------------------------------------------------------------- /test/backportSyntax.t/run.t: -------------------------------------------------------------------------------- 1 | $ refmt ./input.re --print binary > ./output.bin 2 | 3 | $ ocamlc -impl ./output.bin -o ./out 4 | 5 | $ ./out 6 | Success 7 | -------------------------------------------------------------------------------- /test/bigarray.t/input.re: -------------------------------------------------------------------------------- 1 | my_big_array3.{reallyLongStringThatWillDefinitelyBreakLine}; 2 | 3 | my_big_array3.{reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine}; 4 | 5 | my_big_array3.{reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine}; 6 | 7 | my_big_array3.{reallyLongString, reallyLongString, reallyLongString, reallyLongString, reallyLongString}; 8 | 9 | my_big_array3.{reallyLongStringThatWillDefinitelyBreakLine} = 3.0; 10 | 11 | my_big_array3.{reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine} = 3.0; 12 | 13 | my_big_array3.{reallyLongString, reallyLongString, reallyLongString, reallyLongString, reallyLongString} = 3.0; 14 | -------------------------------------------------------------------------------- /test/bigarray.t/run.t: -------------------------------------------------------------------------------- 1 | Format bigarray 2 | $ refmt ./input.re 3 | my_big_array3.{ 4 | reallyLongStringThatWillDefinitelyBreakLine 5 | }; 6 | 7 | my_big_array3.{ 8 | reallyLongStringThatWillDefinitelyBreakLine, 9 | reallyLongStringThatWillDefinitelyBreakLine 10 | }; 11 | 12 | my_big_array3.{ 13 | reallyLongStringThatWillDefinitelyBreakLine, 14 | reallyLongStringThatWillDefinitelyBreakLine, 15 | reallyLongStringThatWillDefinitelyBreakLine 16 | }; 17 | 18 | my_big_array3.{ 19 | reallyLongString, 20 | reallyLongString, 21 | reallyLongString, 22 | reallyLongString, 23 | reallyLongString 24 | }; 25 | 26 | my_big_array3.{ 27 | reallyLongStringThatWillDefinitelyBreakLine 28 | } = 3.0; 29 | 30 | my_big_array3.{ 31 | reallyLongStringThatWillDefinitelyBreakLine, 32 | reallyLongStringThatWillDefinitelyBreakLine 33 | } = 3.0; 34 | 35 | my_big_array3.{ 36 | reallyLongString, 37 | reallyLongString, 38 | reallyLongString, 39 | reallyLongString, 40 | reallyLongString 41 | } = 3.0; 42 | -------------------------------------------------------------------------------- /test/bigarraySyntax.t/input.re: -------------------------------------------------------------------------------- 1 | /* https://github.com/facebook/reason/issues/2038 */ 2 | let my_big_array1 = 3 | Bigarray.Array1.create(Bigarray.float32, Bigarray.c_layout, 20); 4 | 5 | my_big_array1.{1}; 6 | 7 | my_big_array1.{1} = 1.0; 8 | 9 | let my_big_array2 = 10 | Bigarray.Array2.create(Bigarray.float32, Bigarray.c_layout, 20, 20); 11 | 12 | my_big_array2.{1, 2}; 13 | 14 | my_big_array2.{1, 2} = 1.0; 15 | 16 | let my_big_array3 = 17 | Bigarray.Array3.create(Bigarray.float32, Bigarray.c_layout, 20, 20, 20); 18 | 19 | my_big_array3.{1, 2, 3}; 20 | 21 | my_big_array3.{1, 2, 3} = 1.0; 22 | 23 | let reallyLongStringThatWillDefinitelyBreakLine = 0; 24 | 25 | my_big_array3.{reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine}; 26 | 27 | my_big_array3.{reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine, reallyLongStringThatWillDefinitelyBreakLine} = 3.0; 28 | -------------------------------------------------------------------------------- /test/class.t/input.re: -------------------------------------------------------------------------------- 1 | class aClass1(x) { 2 | /* one value parameter x */ 3 | pub a1 = 0; 4 | pub a2() = 0; 5 | pub a3(x,y) = x + y; 6 | pub a4(x,y) { 7 | let result = x + y; 8 | print_endline(" x + y = " ++ string_of_int(x) ++ " + " ++ string_of_int(y) ++ " = " ++ string_of_int(result)); 9 | result 10 | }; 11 | }; 12 | class aClass2(x) { 13 | }; 14 | class aClass3(x: (int => int)) { 15 | }; 16 | class aClass4(x: (int => int => int)) { 17 | }; 18 | class aClass5(x: (int => (int => int))) { 19 | }; 20 | class aClass6(x: ((int => int) => int)) { 21 | }; 22 | class aClass7(x: ((int, int) => int)) { 23 | }; 24 | 25 | class labeledClass1(~x) { 26 | }; 27 | class labeledClass2(~x: ((~y:int) => int)) { 28 | }; 29 | class labeledClass3(~x: ((~y:int) => int => int)) { 30 | }; 31 | class labeledClass4(~x: ((~y:int) => (int => int))) { 32 | }; 33 | class labeledClass5(~x: (((~y:int) => int) => int)) { 34 | }; 35 | class labeledClass6(~x: ((~y:(int, int)) => int)) { 36 | }; 37 | -------------------------------------------------------------------------------- /test/class.t/run.t: -------------------------------------------------------------------------------- 1 | See the typed tree from ./input.re 2 | $ cat ./input.re | ../lib/outcometreePrinter.exe 3 | class aClass1 : 4 | ('a) => 5 | { 6 | pub a1: int; 7 | pub a2: unit => int; 8 | pub a3: (int, int) => int; 9 | pub a4: (int, int) => int 10 | }; 11 | class aClass2 : ('a) => { }; 12 | class aClass3 : (int, int) => { }; 13 | class aClass4 : (int, int, int) => { }; 14 | class aClass5 : (int, int, int) => { }; 15 | class aClass6 : (int => int, int) => { }; 16 | class aClass7 : (int, int, int) => { }; 17 | class labeledClass1 : ('a) => { }; 18 | class labeledClass2 : (~x: int, int) => { }; 19 | class labeledClass3 : (~x: int, int, int) => { }; 20 | class labeledClass4 : (~x: int, int, int) => { }; 21 | class labeledClass5 : ((~y: int) => int, int) => { }; 22 | class labeledClass6 : (~x: (int, int), int) => { }; 23 | -------------------------------------------------------------------------------- /test/class_types.t/input.re: -------------------------------------------------------------------------------- 1 | class type _module ('provider_impl) = { 2 | 3 | }; 4 | type t; 5 | class type bzz = { 6 | inherit _module(t) 7 | }; 8 | 9 | class type t = { as 'a; 10 | constraint 'a = #s 11 | }; 12 | 13 | /* https://github.com/facebook/reason/issues/2037 */ 14 | class type xt = { as 'a }; 15 | 16 | class x = { 17 | as self 18 | }; 19 | 20 | class type classWithNoArgType { 21 | pub x : int; 22 | pub y : int 23 | }; 24 | 25 | class classWithNoArg { 26 | pub x = 0; 27 | pub y = 0 28 | }; 29 | 30 | class type t = { 31 | open M; 32 | as 'a; 33 | }; 34 | 35 | class type t = { 36 | open M; 37 | }; 38 | -------------------------------------------------------------------------------- /test/class_types.t/run.t: -------------------------------------------------------------------------------- 1 | Format class and class type 2 | $ refmt ./input.re 3 | class type _module ('provider_impl) = {}; 4 | type t; 5 | class type bzz = { 6 | inherit _module(t); 7 | }; 8 | 9 | class type t = { 10 | as 'a; 11 | constraint 'a = #s; 12 | }; 13 | 14 | /* https://github.com/facebook/reason/issues/2037 */ 15 | class type xt = { 16 | as 'a; 17 | }; 18 | 19 | class x = { 20 | as self; 21 | }; 22 | 23 | class type classWithNoArgType = { 24 | pub x: int; 25 | pub y: int; 26 | }; 27 | 28 | class classWithNoArg = { 29 | pub x = 0; 30 | pub y = 0; 31 | }; 32 | 33 | class type t = { 34 | open M; 35 | as 'a; 36 | }; 37 | 38 | class type t = { 39 | open M; 40 | }; 41 | -------------------------------------------------------------------------------- /test/comments-ml.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.re > ./formatted.re 3 | refmt: FILENAMES… arguments: no './input.re' file 4 | Usage: refmt [OPTION]… [FILENAMES]… 5 | Try 'refmt --help' for more information. 6 | [1] 7 | 8 | Type-check basics 9 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 10 | 11 | Format the formatted file back 12 | $ refmt --print re ./formatted.re > ./formatted_back.re 13 | 14 | Ensure idempotency: first format and second format are the same 15 | $ diff formatted.re formatted_back.re 16 | 0a1 17 | > 18 | [1] 19 | -------------------------------------------------------------------------------- /test/comments-mli.t/input.mli: -------------------------------------------------------------------------------- 1 | (* **** comment *) 2 | (*** comment *) 3 | (** docstring *) 4 | (* comment *) 5 | (** docstring *) 6 | (*** comment *) 7 | (**** comment *) 8 | (***** comment *) 9 | 10 | (** *) 11 | (*** *) 12 | (**** *) 13 | 14 | (***) 15 | (****) 16 | 17 | 18 | 19 | (** (** comment *) *) 20 | (** (*** comment *) *) 21 | 22 | (* (** comment *) *) 23 | (* (*** comment *) *) 24 | (* *(*** comment *) *) 25 | 26 | (* comment **) 27 | (* comment ***) 28 | (* comment ****) 29 | (* comment *****) 30 | 31 | (** 32 | * Multiline 33 | *) 34 | 35 | (** Multiline 36 | * 37 | *) 38 | 39 | (** 40 | ** 41 | *) 42 | -------------------------------------------------------------------------------- /test/comments-mli.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.mli > ./formatted.rei 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -intf formatted.rei 6 | 7 | Format the formatted file back 8 | $ refmt --print re ./formatted.rei > ./formatted_back.rei 9 | 10 | Ensure idempotency: first format and second format are the same 11 | $ diff formatted.rei formatted_back.rei 12 | -------------------------------------------------------------------------------- /test/dune: -------------------------------------------------------------------------------- 1 | (env 2 | (_ 3 | (env-vars 4 | (REFMT_PRINT_WIDTH 50)))) 5 | 6 | (cram 7 | (applies_to * \ lib rtopIntegration) 8 | (package reason) 9 | (deps 10 | %{bin:ocamlc} 11 | %{bin:refmt} 12 | ./lib/outcometreePrinter.exe 13 | ./lib/fdLeak.exe)) 14 | 15 | (cram 16 | (applies_to rtopIntegration) 17 | (package rtop) 18 | (deps %{bin:ocamlc} %{bin:rtop})) 19 | -------------------------------------------------------------------------------- /test/emptyFileComment.t/input.re: -------------------------------------------------------------------------------- 1 | // file with just a single line comment 2 | -------------------------------------------------------------------------------- /test/emptyFileComment.t/run.t: -------------------------------------------------------------------------------- 1 | Format empty file comment 2 | $ refmt ./input.re 3 | // file with just a single line comment 4 | -------------------------------------------------------------------------------- /test/escapesInStrings.t/input.re: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 2 | 3 | /* 4 | let str = "@[.... some formatting ....@\n\010@."; 5 | */ 6 | 7 | let str = "@[.... some formatting ....@\n\010@."; 8 | let str = {abcd|@[.... some formatting ....@\n\010@.|abcd}; 9 | 10 | let utf8_string = "😁"; 11 | 12 | let keep_representation = "\n 13 | \t . this should be on a new line\ 14 | ^ this should be aligned with the . 15 | "; 16 | -------------------------------------------------------------------------------- /test/escapesInStrings.t/run.t: -------------------------------------------------------------------------------- 1 | Format escapes in strings 2 | $ refmt ./input.re 3 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 4 | 5 | /* 6 | let str = "@[.... some formatting ....@\n\010@."; 7 | */ 8 | 9 | let str = "@[.... some formatting ....@\n\010@."; 10 | let str = {abcd|@[.... some formatting ....@\n\010@.|abcd}; 11 | 12 | let utf8_string = "😁"; 13 | 14 | let keep_representation = "\n 15 | \t . this should be on a new line\ 16 | ^ this should be aligned with the . 17 | "; 18 | -------------------------------------------------------------------------------- /test/extension-exprs.t/input.re: -------------------------------------------------------------------------------- 1 | /* Extension with pexp_apply */ 2 | 3 | [%defer 4 | cleanup(); 5 | ]; 6 | 7 | /* Extension with comment with pexp_apply */ 8 | 9 | [%defer 10 | /* 2. comment attached to expr in extension */ 11 | cleanup(); 12 | ]; 13 | 14 | /* Let sequence + extension with pexp_apply */ 15 | 16 | let () = { 17 | /* random let binding */ 18 | let x = 1; 19 | /* 1. comment attached to extension */ 20 | [%defer cleanup()]; 21 | /* 3. comment attached to next expr */ 22 | something_else(); 23 | }; 24 | 25 | /* Let sequence + extension with comment with pexp_apply */ 26 | 27 | let () = { 28 | /* random let binding */ 29 | let x = 1; 30 | /* 1. comment attached to extension */ 31 | [%defer 32 | /* 2. comment attached to expr in extension */ 33 | cleanup() 34 | ]; 35 | /* 3. comment attached to next expr */ 36 | something_else(); 37 | }; 38 | -------------------------------------------------------------------------------- /test/extension-exprs.t/run.t: -------------------------------------------------------------------------------- 1 | 2 | Format extensions 3 | $ refmt ./input.re 4 | /* Extension with pexp_apply */ 5 | 6 | [%defer cleanup()]; 7 | 8 | /* Extension with comment with pexp_apply */ 9 | 10 | [%defer 11 | /* 2. comment attached to expr in extension */ 12 | cleanup() 13 | ]; 14 | 15 | /* Let sequence + extension with pexp_apply */ 16 | 17 | let () = { 18 | /* random let binding */ 19 | let x = 1; 20 | /* 1. comment attached to extension */ 21 | [%defer cleanup()]; 22 | /* 3. comment attached to next expr */ 23 | something_else(); 24 | }; 25 | 26 | /* Let sequence + extension with comment with pexp_apply */ 27 | 28 | let () = { 29 | /* random let binding */ 30 | let x = 1; 31 | /* 1. comment attached to extension */ 32 | [%defer 33 | /* 2. comment attached to expr in extension */ 34 | cleanup() 35 | ]; 36 | /* 3. comment attached to next expr */ 37 | something_else(); 38 | }; 39 | -------------------------------------------------------------------------------- /test/extension-str-in-module.t: -------------------------------------------------------------------------------- 1 | Format extensions in modules 2 | 3 | $ refmt < [%%toplevelExtension "payload"]; 5 | > module X = { 6 | > /* No payload */ 7 | > [%%someExtension]; 8 | > [%%someExtension "payload"]; 9 | > }; 10 | > EOF 11 | [%%toplevelExtension "payload"]; 12 | module X = { 13 | /* No payload */ 14 | [%%someExtension]; 15 | [%%someExtension "payload"]; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /test/externals.t/input.re: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests external formatting. 3 | */ 4 | external foo : type_ = "%caml_something_or_other"; 5 | 6 | external multilineStringExtern : int => int = {| 7 | Did you know you can put whatver you want inside 8 | of an extern? Good luck with the linker though! 9 | |}; 10 | 11 | module Nested = { 12 | external multilineStringExtern : int => int = {| 13 | Did you know you can put whatver you want inside 14 | of an extern? Good luck with the linker though! 15 | |}; 16 | external multilineStringExternWithTag : int => int = {js| 17 | Did you know you can put whatver you want inside 18 | of an extern? Good luck with the linker though! 19 | |js}; 20 | external multilineStringExtern : int => int = " 21 | And this has a newline in it, so will be formatted with { | | } style string"; 22 | external containsQuote : int => int = "This has a quote in it \" so will be formatted as { | | } style string"; 23 | external noIndentation : int => int = {| 24 | Did you know you can put whatver you want inside 25 | of an extern? Good luck with the linker though! 26 | |}; 27 | }; 28 | -------------------------------------------------------------------------------- /test/externals.t/run.t: -------------------------------------------------------------------------------- 1 | Format externals 2 | $ refmt ./input.re 3 | /** 4 | * Tests external formatting. 5 | */ 6 | external foo: type_ = "%caml_something_or_other"; 7 | 8 | external multilineStringExtern: int => int = 9 | {| 10 | Did you know you can put whatver you want inside 11 | of an extern? Good luck with the linker though! 12 | |}; 13 | 14 | module Nested = { 15 | external multilineStringExtern: int => int = 16 | {| 17 | Did you know you can put whatver you want inside 18 | of an extern? Good luck with the linker though! 19 | |}; 20 | external multilineStringExternWithTag: 21 | int => int = 22 | {| 23 | Did you know you can put whatver you want inside 24 | of an extern? Good luck with the linker though! 25 | |}; 26 | external multilineStringExtern: int => int = 27 | {| 28 | And this has a newline in it, so will be formatted with { | | } style string|}; 29 | external containsQuote: int => int = 30 | {|This has a quote in it " so will be formatted as { | | } style string|}; 31 | external noIndentation: int => int = 32 | {| 33 | Did you know you can put whatver you want inside 34 | of an extern? Good luck with the linker though! 35 | |}; 36 | }; 37 | -------------------------------------------------------------------------------- /test/fdLeak.t/input.re: -------------------------------------------------------------------------------- 1 | 2 | let () = 3 | let x = 1 in 4 | Format.eprintf "X: %d@." x 5 | -------------------------------------------------------------------------------- /test/fdLeak.t/run.t: -------------------------------------------------------------------------------- 1 | 2 | $ ulimit -n 24 3 | $ ../lib/fdLeak.exe 4 | EOL: done 5 | -------------------------------------------------------------------------------- /test/fixme.t/input.re: -------------------------------------------------------------------------------- 1 | /** 2 | * Problem: In thise example, the comment should have a space after it. 3 | */ 4 | let store_attributes(proc_attributes) { 5 | let should_write = 6 | /* only overwrite defined procedures */proc_attributes.ProcAttributes.is_defined || 7 | not (DB.file_exists(attributes_file)); 8 | should_write; 9 | }; 10 | -------------------------------------------------------------------------------- /test/fixme.t/run.t: -------------------------------------------------------------------------------- 1 | Format fixme 2 | $ refmt ./input.re 3 | /** 4 | * Problem: In thise example, the comment should have a space after it. 5 | */ 6 | let store_attributes = proc_attributes => { 7 | let should_write = 8 | /* only overwrite defined procedures */ proc_attributes.ProcAttributes.is_defined 9 | || not(DB.file_exists(attributes_file)); 10 | should_write; 11 | }; 12 | -------------------------------------------------------------------------------- /test/generics.t/input.re: -------------------------------------------------------------------------------- 1 | type t = A { a : int } | B; 2 | 3 | let f = fun 4 | | B => 0 5 | | A { a } => a; 6 | 7 | type nonrec u('a) = Box('a); 8 | 9 | type expr('a) = 10 | | Val {value: 'a} :expr('a) 11 | | Add {left: expr(int), right: expr(int)} :expr(int) 12 | | Is0 {test: expr(int)} :expr(bool) 13 | | If {pred: expr(bool), true_branch: expr('a), false_branch: expr('a)} :expr('a); 14 | 15 | let rec eval: type a. (expr(a)) => a = 16 | fun(e) => 17 | switch (e) { 18 | | Is0 {test} => eval(test) == 0 19 | | Val {value} => value 20 | | Add {left, right} => eval(left) + eval(right) 21 | | If {pred, true_branch, false_branch} => 22 | if (eval(pred)) { 23 | eval(true_branch) 24 | } else { 25 | eval(false_branch) 26 | } 27 | }; 28 | 29 | type hlist = 30 | | [] : hlist; 31 | 32 | let foo (type a, type b) = 5; 33 | -------------------------------------------------------------------------------- /test/generics.t/run.t: -------------------------------------------------------------------------------- 1 | Format features from OCaml 4.03 2 | $ refmt ./input.re 3 | type t = 4 | | A({a: int}) 5 | | B; 6 | 7 | let f = 8 | fun 9 | | B => 0 10 | | A({a}) => a; 11 | 12 | type nonrec u('a) = 13 | | Box('a); 14 | 15 | type expr('a) = 16 | | Val({value: 'a}): expr('a) 17 | | Add({ 18 | left: expr(int), 19 | right: expr(int), 20 | }) 21 | : expr(int) 22 | | Is0({test: expr(int)}): expr(bool) 23 | | If({ 24 | pred: expr(bool), 25 | true_branch: expr('a), 26 | false_branch: expr('a), 27 | }) 28 | : expr('a); 29 | 30 | let rec eval: type a. expr(a) => a = e => 31 | switch (e) { 32 | | Is0({test}) => eval(test) == 0 33 | | Val({value}) => value 34 | | Add({left, right}) => 35 | eval(left) + eval(right) 36 | | If({pred, true_branch, false_branch}) => 37 | if (eval(pred)) { 38 | eval(true_branch); 39 | } else { 40 | eval(false_branch); 41 | } 42 | }; 43 | 44 | type hlist = 45 | | []: hlist; 46 | 47 | let foo = (type a, type b) => 5; 48 | -------------------------------------------------------------------------------- /test/inlineRecord.t/input.re: -------------------------------------------------------------------------------- 1 | type t0 = T0 { t0 : int }; 2 | type t1 = 3 | | A { x : int } 4 | | B 5 | | C { c1 : string, c2 : string }; 6 | 7 | /* GADT */ 8 | type t2(_) = 9 | | D { x : int } : t2(int) 10 | | E { f : int => int } : t2(int => int) 11 | | F(unit) : t2(unit); 12 | -------------------------------------------------------------------------------- /test/inlineRecord.t/run.t: -------------------------------------------------------------------------------- 1 | See the typed tree from ./input.re 2 | $ cat ./input.re | ../lib/outcometreePrinter.exe 3 | type t0 = T0({ t0: int, }); 4 | type t1 = A({ x: int, }) | B | C({ c1: string, c2: string, }); 5 | type t2(_) = 6 | D({ x: int, }): t2(int) 7 | | E({ f: int => int, }): t2(int => int) 8 | | F(unit): t2(unit); 9 | -------------------------------------------------------------------------------- /test/jsx_functor.t/input.re: -------------------------------------------------------------------------------- 1 | type elt = Text(string) | Group(list(elt)); 2 | 3 | module X = { 4 | let createElement(~children=[], ()) { 5 | Text("x"); 6 | }; 7 | }; 8 | 9 | module Y = { 10 | let createElement(~children=[], ()) { 11 | Text("y"); 12 | }; 13 | }; 14 | 15 | module M(X: (module type of X), Y: (module type of Y)) = { 16 | let createElement(~name="M", ~id=0, ~children=[], ()) { 17 | Group([ 18 | Text(name), 19 | Text(string_of_int(id)), 20 | , 21 | 22 | ] @ children); 23 | }; 24 | }; 25 | 26 | let _ = Group([ 27 | , 28 | 29 | Text("A") 30 | , 31 | 32 | 33 | ]) 34 | -------------------------------------------------------------------------------- /test/jsx_functor.t/run.t: -------------------------------------------------------------------------------- 1 | Format JSX functors 2 | $ refmt ./input.re 3 | type elt = 4 | | Text(string) 5 | | Group(list(elt)); 6 | 7 | module X = { 8 | let createElement = (~children=[], ()) => { 9 | Text("x"); 10 | }; 11 | }; 12 | 13 | module Y = { 14 | let createElement = (~children=[], ()) => { 15 | Text("y"); 16 | }; 17 | }; 18 | 19 | module M = 20 | ( 21 | X: (module type of X), 22 | Y: (module type of Y), 23 | ) => { 24 | let createElement = 25 | (~name="M", ~id=0, ~children=[], ()) => { 26 | Group( 27 | [ 28 | Text(name), 29 | Text(string_of_int(id)), 30 | , 31 | , 32 | ] 33 | @ children, 34 | ); 35 | }; 36 | }; 37 | 38 | let _ = 39 | Group([ 40 | , 41 | {Text("A")} , 42 | , 43 | ]); 44 | -------------------------------------------------------------------------------- /test/knownMlIssues.t/input.ml: -------------------------------------------------------------------------------- 1 | (* [x] fixed *) 2 | type t2 = 3 | int * int (* attributed to entire type not binding *) 4 | 5 | type color = 6 | | Red of int (* After red *) 7 | | Black of int (* After black *) 8 | | Green of int (* Does not remain here *) 9 | 10 | 11 | let blahCurriedX x = 12 | function 13 | | Red 10 14 | | Black 20 15 | | Green 10 -> 1 (* After or pattern green *) 16 | | Red x -> 0 (* After red *) 17 | | Black x -> 0 (* After black *) 18 | | Green x -> 0 (* After second green *) 19 | (* On next line after blahCurriedX def *) 20 | 21 | 22 | (* EOL comments wrap because other elements break first (in this example 23 | "mutable" causes breaks. We either need: 24 | 1. To prevent wrapping of anything inside of eol comments attachments. 25 | 2. Losslessly wrap eol comments. 26 | *) 27 | (* This example illustrates the above issue, but isn't een idempotent due to the issue. *) 28 | (* type cfg = { *) 29 | (* node_id : int ref; *) 30 | (* node_list : int list ref; *) 31 | (* name_pdesc_tbl : (int, (int, int) Hashtbl.t) Hashtbl.t; (** Map proc name to procdesc *) *) 32 | (* mutable priority_set : (int, int) Hashtbl.t (** set of function names to be analyzed first *) *) 33 | (* } *) 34 | (* *) 35 | (* *) 36 | -------------------------------------------------------------------------------- /test/knownMlIssues.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.ml > ./formatted.re 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 6 | 7 | Format the formatted file back 8 | $ refmt --print re ./formatted.re > ./formatted_back.re 9 | 10 | Ensure idempotency: first format and second format are the same 11 | $ diff formatted.re formatted_back.re 12 | -------------------------------------------------------------------------------- /test/knownReIssues.t/input.re: -------------------------------------------------------------------------------- 1 | /** 2 | Issue 940: https://github.com/facebook/reason/issues/940 3 | The parens in the exception match case with an alias, 4 | are required for correct parsing: 5 | i.e. (Sys_error _ as exc) instead of Sys_error _ as exc 6 | The latter doesn't type-check with Error: Unbound value exc. 7 | Warning 11 (unused match case) is also triggered. 8 | */ 9 | let f () = raise(Sys_error("error")); 10 | 11 | switch (f ()) { 12 | | x => () 13 | | exception (Sys_error(_) as exc) => raise(exc) 14 | }; 15 | 16 | exception Foo(string); 17 | 18 | let g () = raise(Foo("bar errors")); 19 | 20 | switch (g ()) { 21 | | x => () 22 | | exception Foo(f) => raise (Foo(f)) 23 | }; 24 | -------------------------------------------------------------------------------- /test/knownReIssues.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.re > ./formatted.re 3 | 4 | Print the formatted file 5 | $ cat ./formatted.re 6 | /** 7 | Issue 940: https://github.com/facebook/reason/issues/940 8 | The parens in the exception match case with an alias, 9 | are required for correct parsing: 10 | i.e. (Sys_error _ as exc) instead of Sys_error _ as exc 11 | The latter doesn't type-check with Error: Unbound value exc. 12 | Warning 11 (unused match case) is also triggered. 13 | */ 14 | let f = () => raise(Sys_error("error")); 15 | 16 | switch (f()) { 17 | | x => () 18 | | exception (Sys_error(_) as exc) => raise(exc) 19 | }; 20 | 21 | exception Foo(string); 22 | 23 | let g = () => raise(Foo("bar errors")); 24 | 25 | switch (g()) { 26 | | x => () 27 | | exception (Foo(f)) => raise(Foo(f)) 28 | }; 29 | 30 | Type-check basics 31 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 32 | 33 | Format the formatted file back 34 | $ refmt --print re ./formatted.re > ./formatted_back.re 35 | 36 | Ensure idempotency: first format and second format are the same 37 | $ diff formatted.re formatted_back.re 38 | -------------------------------------------------------------------------------- /test/lazy.t/input.re: -------------------------------------------------------------------------------- 1 | let myComputation = lazy { 2 | let tmp = 10; 3 | let tmp2 = 20; 4 | tmp + tmp2; 5 | }; 6 | 7 | type myRecord = {myRecordField: int}; 8 | 9 | let operateOnLazyValue (lazy {myRecordField}) { 10 | let tmp = myRecordField; 11 | tmp + tmp; 12 | }; 13 | 14 | let result = operateOnLazyValue (lazy {myRecordField: 100}); 15 | 16 | type box('a) = Box('a); 17 | 18 | let lazy thisIsActuallyAPatternMatch = lazy (200); 19 | let tmp: int = thisIsActuallyAPatternMatch; 20 | let (lazy (Box(i)), x) = (lazy (Box(200)), 100); 21 | let tmp: int = i; 22 | 23 | let myComputation = lazy (200); 24 | 25 | let reallyLoooooooooooooongIdentifierThatSpansMoreThan50Cols = 200; 26 | 27 | let foo = lazy(reallyLoooooooooooooongIdentifierThatSpansMoreThan50Cols) 28 | -------------------------------------------------------------------------------- /test/letop.t/input.re: -------------------------------------------------------------------------------- 1 | let (let.opt) = (x, f) => switch x { | None => None | Some(x) => f(x) }; 2 | let (let.&opt) = (x, f) => switch x { | None => None | Some(x) => Some(f(x)) }; 3 | 4 | let z = { 5 | let.opt a = Some(2); 6 | let.&opt b = Some(5); 7 | a + b 8 | } 9 | 10 | let (let./\/) = (x, f) => switch x { | None => None | Some(x) => f(x) }; 11 | let (let.&/\*) = (x, f) => switch x { | None => None | Some(x) => Some(f(x)) }; 12 | 13 | /* Test syntax that could potentially conflict with comments */ 14 | let z = { 15 | let./\/ a = Some(2); 16 | let.&/\* b = Some(5); 17 | a + b 18 | } 19 | 20 | let _ = { 21 | let.opt _ = Some("a"); 22 | 23 | let.opt _ = Some("c"); 24 | 25 | // hello 26 | 27 | None; 28 | }; 29 | 30 | // test that the type annotation prints with parenthesis 31 | let _ = { 32 | let.opt (x : string) as _y = Some ("a"); 33 | None 34 | }; 35 | 36 | let x = { 37 | [@foo] 38 | let.opt _ = Some("foo"); 39 | None 40 | }; 41 | 42 | let x = { 43 | /** 44 | * A doc comment 45 | */ 46 | let.opt _ = Some("foo"); 47 | None 48 | }; 49 | -------------------------------------------------------------------------------- /test/lib/dune: -------------------------------------------------------------------------------- 1 | (rule 2 | (targets outcometreePrinter.ml) 3 | (deps outcometreePrinter.cppo.ml) 4 | (action 5 | (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) 6 | 7 | (executable 8 | (name outcometreePrinter) 9 | (libraries reason) 10 | (modules outcometreePrinter)) 11 | 12 | (executable 13 | (name fdLeak) 14 | (modules fdLeak) 15 | (libraries reason.refmt-lib)) 16 | -------------------------------------------------------------------------------- /test/lib/fdLeak.ml: -------------------------------------------------------------------------------- 1 | open Refmt_lib 2 | 3 | let () = 4 | let files = List.init 25 (fun i -> i) in 5 | let input_file = "./input.re" in 6 | List.iter 7 | (fun _file -> Eol_detect.get_eol_for_file input_file |> ignore) 8 | files; 9 | Format.eprintf "EOL: done@." 10 | -------------------------------------------------------------------------------- /test/mlFunctions.t/input.ml: -------------------------------------------------------------------------------- 1 | (* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. *) 2 | 3 | let x = 4 | ignore (fun y -> 5 | let y = 4 in 6 | y) 7 | 8 | -------------------------------------------------------------------------------- /test/mlFunctions.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | 3 | $ refmt ./input.ml | tee formatted.re 4 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 5 | 6 | let x = 7 | ignore(y => { 8 | let y = 4; 9 | y; 10 | }); 11 | 12 | Format the formatted file back 13 | $ refmt ./formatted.re | tee formatted_back.re 14 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 15 | 16 | let x = 17 | ignore(y => { 18 | let y = 4; 19 | y; 20 | }); 21 | 22 | Ensure idempotency: first format and second format are the same 23 | $ diff formatted.re formatted_back.re 24 | -------------------------------------------------------------------------------- /test/mlVariants.t/input.ml: -------------------------------------------------------------------------------- 1 | (* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. *) 2 | 3 | type polyVariantsInMl = [ 4 | | `IntTuple of (int * int) 5 | | `StillAnIntTuple of (int * int) 6 | ] 7 | 8 | 9 | 10 | let intTuple = `IntTuple (1, 2) 11 | let stillAnIntTuple = `StillAnIntTuple (4, 5) 12 | let sumThem = function 13 | | `IntTuple (x, y) -> x + y 14 | | `StillAnIntTuple (a, b) -> a + b 15 | 16 | type nonrec t = A of int | B of bool 17 | 18 | type s = [ `Poly ] 19 | 20 | let x = (`Poly: s) 21 | 22 | (* There's a bug in ocaml 4.06 resulting in an extra Pexp_constraint on the `Poly, 23 | * duplicating the core_type. 24 | * https://caml.inria.fr/mantis/view.php?id=7758 25 | * https://caml.inria.fr/mantis/view.php?id=7344 *) 26 | let x : s = `Poly 27 | -------------------------------------------------------------------------------- /test/mlVariants.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.ml > ./formatted.re 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -impl formatted.re 6 | 7 | Format the formatted file back 8 | $ refmt --print re ./formatted.re > ./formatted_back.re 9 | 10 | Ensure idempotency: first format and second format are the same 11 | $ diff formatted.re formatted_back.re 12 | -------------------------------------------------------------------------------- /test/mutation.t/input.re: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 2 | 3 | /** 4 | * Testing mutations. 5 | */ 6 | let holdsAUnit = ref(); 7 | 8 | let holdsABool = ref(false); 9 | 10 | let holdsAnInt = ref(0); 11 | 12 | let holdsAHoldsABool = ref(ref(true)); 13 | 14 | let () = holdsAUnit := holdsABool := false; 15 | 16 | /* Should be parsed as: */ 17 | /* And so they should both be printed the same */ 18 | let () = holdsAUnit := (holdsABool := false); 19 | 20 | /* 21 | * The following: 22 | * 23 | * something = x := e 24 | * 25 | * Should be parsed as: 26 | * 27 | * something = (x := e) 28 | */ 29 | holdsAUnit.contents = holdsAnInt := 0; 30 | 31 | holdsABool.contents = holdsAnInt.contents == 100; 32 | 33 | let numberToSwitchOn = 100; 34 | 35 | switch (numberToSwitchOn) { 36 | | -3 37 | | -2 38 | | -1 => () 39 | | 0 => holdsAUnit.contents = () 40 | | 1 => holdsAUnit.contents = holdsAnInt := 0 41 | | 2 => true ? holdsAUnit.contents = () : holdsABool.contents ? () : () 42 | | 3 => true ? holdsAUnit := () : holdsABool.contents ? () : () 43 | | 4 => true ? holdsAnInt := 40 : () 44 | | 5 => holdsAnInt := 40 45 | | _ => () 46 | }; 47 | 48 | let mutativeFunction = fun | Some(x) => holdsAUnit.contents = () 49 | | None => holdsAUnit := (); 50 | -------------------------------------------------------------------------------- /test/object.t/input.re: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 2 | 3 | type t = {.}; 4 | 5 | type t = { 6 | . 7 | u: int, 8 | v: int 9 | }; 10 | 11 | type t = {.. u: int}; 12 | 13 | type t = {.. u: int}; 14 | 15 | type t = { 16 | .. 17 | }; 18 | 19 | type t = {..}; 20 | 21 | let (<..>)(a,b) = a + b; 22 | let five = 2 <..> 3; 23 | 24 | type closedObjSugar = Js.t({. foo: bar, baz: int}); 25 | 26 | type openObjSugar = Js.t({.. x: int, y: int}); 27 | 28 | type x = Js.t({.}); 29 | 30 | type y = Js.t({..}); 31 | 32 | /* #1595: always break object rows (>= 2) for readability */ 33 | type o = { 34 | . 35 | a: int, 36 | b: int 37 | }; 38 | 39 | type o2 = { 40 | .. 41 | a: int, 42 | b: int 43 | }; 44 | 45 | let obj = {as _; [@foo] val a = 1}; 46 | 47 | /* Oinherit (https://github.com/ocaml/ocaml/pull/1118) */ 48 | type t1 = { 49 | . 50 | n: string, 51 | ...t, 52 | }; 53 | 54 | type t1 = { 55 | .. 56 | n: string, 57 | ...t, 58 | }; 59 | 60 | type g1 = { 61 | . 62 | n: string, 63 | ...t, 64 | ...y, 65 | }; 66 | 67 | type g2 = { 68 | . 69 | n: string, 70 | ...t, 71 | ...y, 72 | }; 73 | 74 | type m1 = { 75 | . 76 | ...M.t, 77 | }; 78 | type m2('a) = { 79 | . 80 | n: string, 81 | ...M.t('a), 82 | }; 83 | -------------------------------------------------------------------------------- /test/pervasive.t/input.mli: -------------------------------------------------------------------------------- 1 | val ( = ) : 'a -> 'a -> bool 2 | 3 | val ( <> ) : 'a -> 'a -> bool 4 | 5 | val not : bool -> bool -------------------------------------------------------------------------------- /test/pervasive.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.mli > ./formatted.rei 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -intf formatted.rei 6 | 7 | Format the formatted file back 8 | $ refmt --print re ./formatted.rei > ./formatted_back.rei 9 | 10 | Ensure idempotency: first format and second format are the same 11 | $ diff formatted.rei formatted_back.rei 12 | -------------------------------------------------------------------------------- /test/print-width-env.t: -------------------------------------------------------------------------------- 1 | Create a file with a long line 2 | $ cat >test.re < let initialState = uiStateFromValidated(~ownership=RemoteData.NotAsked, ~limits=initialLimits, SiteAuditSettings.default); 4 | > EOF 5 | 6 | Set the print width to 120 characters via env "REFMT_PRINT_WIDTH" 7 | $ REFMT_PRINT_WIDTH=120 refmt test.re 8 | let initialState = 9 | uiStateFromValidated(~ownership=RemoteData.NotAsked, ~limits=initialLimits, SiteAuditSettings.default); 10 | 11 | Set the print width to 80 characters via env "REFMT_PRINT_WIDTH" 12 | $ REFMT_PRINT_WIDTH=80 refmt test.re 13 | let initialState = 14 | uiStateFromValidated( 15 | ~ownership=RemoteData.NotAsked, 16 | ~limits=initialLimits, 17 | SiteAuditSettings.default, 18 | ); 19 | -------------------------------------------------------------------------------- /test/raw-identifiers.t/input.re: -------------------------------------------------------------------------------- 1 | 2 | let \#let = 2; 3 | let \#let = \#let 4 | and \#and = \#let; 5 | 6 | /* labeled arguments */ 7 | let \#let = (~\#let) => { 8 | \#let; 9 | }; 10 | 11 | let \#let = (~\#let: \#let = \#let) => { 12 | \#let; 13 | }; 14 | 15 | /* Types */ 16 | type \#type = \#type; 17 | 18 | module type \#module = \#module; 19 | 20 | class \#class = \#class; 21 | 22 | class type \#class = \#class; 23 | 24 | type x = [ | `\#module ] 25 | type y = [ | \#module ] 26 | let x = `\#module 27 | 28 | external \#external: unit => unit = "external"; 29 | 30 | type \#rec = { 31 | \#type: \#type, 32 | \#module: module_ 33 | }; 34 | 35 | let \#rec = { 36 | \#type: \#type, 37 | \#module: module_ 38 | } 39 | 40 | let true = x => x; 41 | 42 | let \#true = x => x; 43 | 44 | -------------------------------------------------------------------------------- /test/raw-identifiers.t/run.t: -------------------------------------------------------------------------------- 1 | Test raw identifiers in Reason syntax 2 | 3 | $ refmt ./input.re | tee input2.re 4 | let \#let = 2; 5 | let \#let = \#let 6 | and \#and = \#let; 7 | 8 | /* labeled arguments */ 9 | let \#let = (~\#let) => { 10 | \#let; 11 | }; 12 | 13 | let \#let = (~\#let: \#let=\#let) => { 14 | \#let; 15 | }; 16 | 17 | /* Types */ 18 | type \#type = \#type; 19 | 20 | module type \#module = \#module; 21 | 22 | class \#class = class \#class; 23 | 24 | class type \#class = \#class; 25 | 26 | type x = [ | `\#module]; 27 | type y = [ \#module]; 28 | let x = `\#module; 29 | 30 | external \#external: unit => unit = "external"; 31 | 32 | type \#rec = { 33 | \#type, 34 | \#module: module_, 35 | }; 36 | 37 | let \#rec = { 38 | \#type, 39 | \#module: module_, 40 | }; 41 | 42 | let true = x => x; 43 | 44 | let \#true = x => x; 45 | 46 | Check idempotency 47 | 48 | $ refmt ./input2.re > out.re 49 | 50 | -------------------------------------------------------------------------------- /test/reasonComments-rei.t/input.rei: -------------------------------------------------------------------------------- 1 | module JustString : { 2 | include Map.S; /* Comment eol include */ 3 | }; 4 | -------------------------------------------------------------------------------- /test/reasonComments-rei.t/run.t: -------------------------------------------------------------------------------- 1 | Format basic 2 | $ refmt --print re ./input.rei > ./formatted.rei 3 | 4 | Type-check basics 5 | $ ocamlc -c -pp 'refmt --print binary' -intf-suffix .rei -intf formatted.rei 6 | 7 | Format the formatted file back 8 | $ refmt --print re ./formatted.rei > ./formatted_back.rei 9 | 10 | Ensure idempotency: first format and second format are the same 11 | $ diff formatted.rei formatted_back.rei 12 | -------------------------------------------------------------------------------- /test/rtopIntegration.t: -------------------------------------------------------------------------------- 1 | Context: https://github.com/reasonml/reason/pull/674 2 | 3 | We can't directly call `rtop -stdin` because it circumvents what we're trying to 4 | test. See rtop.sh for the reason. We want to make sure utop's reason 5 | integration is legit, 6 | 7 | `utop -stdin` wouldn't work because it somehow processes the code before 8 | invoking the reason plugin, so `echo someReasonCode | utop -stdin` would 9 | always error. 10 | 11 | Given the above, we're gonna test that utop integration works by piping code 12 | into it and asserting the existence of some output. 13 | 14 | $ echo "let f = a => a;" | rtop | grep -o "let f: 'a => 'a = ;" 15 | let f: 'a => 'a = ; 16 | 17 | $ echo "let f = (a) => 1 + \"hi\";" | rtop | grep -o "has type" 18 | has type 19 | -------------------------------------------------------------------------------- /test/sharpop.t/input.re: -------------------------------------------------------------------------------- 1 | foo#=bar[0]; 2 | 3 | foo##bar[0] = 3; 4 | 5 | foo##bar[0]##baz[1] = 3; 6 | 7 | foo##bar[0]##baz[1]; 8 | 9 | foo##bar#=bar[0]; 10 | 11 | foo##bar##baz #= bar##baz[0]; 12 | 13 | foo[bar + 1]; 14 | 15 | foo.[bar + 1]; 16 | 17 | foo.{bar + 1}; 18 | 19 | foo.[bar + 1] = 1; 20 | 21 | foo.{bar + 1} = 1; 22 | 23 | foo[bar + 1] = 1; 24 | -------------------------------------------------------------------------------- /test/sharpop.t/run.t: -------------------------------------------------------------------------------- 1 | Format sharp operator 2 | $ refmt ./input.re 3 | foo #= bar[0]; 4 | 5 | foo##bar[0] = 3; 6 | 7 | foo##bar[0]##baz[1] = 3; 8 | 9 | foo##bar[0]##baz[1]; 10 | 11 | foo##bar #= bar[0]; 12 | 13 | foo##bar##baz #= bar##baz[0]; 14 | 15 | foo[bar + 1]; 16 | 17 | foo.[bar + 1]; 18 | 19 | foo.{bar + 1}; 20 | 21 | foo.[bar + 1] = 1; 22 | 23 | foo.{bar + 1} = 1; 24 | 25 | foo[bar + 1] = 1; 26 | -------------------------------------------------------------------------------- /test/singleLineCommentEof.t/input.re: -------------------------------------------------------------------------------- 1 | // let x = 1 2 | -------------------------------------------------------------------------------- /test/singleLineCommentEof.t/run.t: -------------------------------------------------------------------------------- 1 | Format single line comment at the end of the file 2 | $ refmt ./input.re 3 | // let x = 1 4 | -------------------------------------------------------------------------------- /test/testUtils.t/input.re: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 2 | 3 | let printSection(s) { 4 | print_string("\n"); 5 | print_string(s); 6 | print_string("\n---------------------\n"); 7 | }; 8 | 9 | let printLn(s) = print_string(s ++ "\n"); 10 | -------------------------------------------------------------------------------- /test/testUtils.t/run.t: -------------------------------------------------------------------------------- 1 | Format test utils 2 | $ refmt ./input.re 3 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 4 | 5 | let printSection = s => { 6 | print_string("\n"); 7 | print_string(s); 8 | print_string("\n---------------------\n"); 9 | }; 10 | 11 | let printLn = s => print_string(s ++ "\n"); 12 | -------------------------------------------------------------------------------- /test/trailing.t/input.re: -------------------------------------------------------------------------------- 1 | 2 | let x = { 3 | "obj": obj, 4 | }; 5 | 6 | let x = { 7 | "key", 8 | "keyTwo", 9 | }; 10 | 11 | let x = { 12 | ...x, 13 | "key", 14 | }; 15 | 16 | let x = { 17 | ...x, 18 | "key", 19 | "keyTwo", 20 | }; 21 | 22 | type t = {. 23 | "x": int, 24 | }; 25 | 26 | type t('a) = {.. 27 | "x": int, 28 | } as 'a; 29 | 30 | type t = {. 31 | "x": (int, int), 32 | }; 33 | 34 | type t('a) = {.. 35 | "x": (int, int), 36 | } as 'a; 37 | 38 | 39 | let x = { 40 | "obj": 0, 41 | }; 42 | 43 | let x = { 44 | "key": 0, 45 | "keyTwo": 1, 46 | }; 47 | 48 | let x = { 49 | ...x, 50 | "key": 0, 51 | }; 52 | 53 | let x = { 54 | ...x, 55 | "key": 0, 56 | "keyTwo": 1, 57 | }; 58 | 59 | type t = {. 60 | "x": int, 61 | }; 62 | 63 | type t('a) = {.. 64 | "x": int, 65 | } as 'a; 66 | 67 | type t = {. 68 | "x": (int, int), 69 | }; 70 | 71 | type t('a) = {.. 72 | "x": (int, int), 73 | } as 'a; 74 | -------------------------------------------------------------------------------- /test/trailing.t/run.t: -------------------------------------------------------------------------------- 1 | Format trailing 2 | $ refmt ./input.re 3 | let x = {"obj": obj}; 4 | 5 | let x = { 6 | "key": key, 7 | "keyTwo": keyTwo, 8 | }; 9 | 10 | let x = { 11 | ...x, 12 | "key": key, 13 | }; 14 | 15 | let x = { 16 | ...x, 17 | "key": key, 18 | "keyTwo": keyTwo, 19 | }; 20 | 21 | type t = {. "x": int}; 22 | 23 | type t('a) = {.. "x": int} as 'a; 24 | 25 | type t = {. "x": (int, int)}; 26 | 27 | type t('a) = {.. "x": (int, int)} as 'a; 28 | 29 | let x = {"obj": 0}; 30 | 31 | let x = { 32 | "key": 0, 33 | "keyTwo": 1, 34 | }; 35 | 36 | let x = { 37 | ...x, 38 | "key": 0, 39 | }; 40 | 41 | let x = { 42 | ...x, 43 | "key": 0, 44 | "keyTwo": 1, 45 | }; 46 | 47 | type t = {. "x": int}; 48 | 49 | type t('a) = {.. "x": int} as 'a; 50 | 51 | type t = {. "x": (int, int)}; 52 | 53 | type t('a) = {.. "x": (int, int)} as 'a; 54 | -------------------------------------------------------------------------------- /test/trailingSpaces.t/input.re: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 2 | 3 | module M = Something.Create { 4 | type resource1 = MyModule.MySubmodule.t; 5 | type resource2 = MyModule.MySubmodule.t; 6 | }; 7 | -------------------------------------------------------------------------------- /test/trailingSpaces.t/run.t: -------------------------------------------------------------------------------- 1 | Format trailing spaces 2 | $ refmt ./input.re 3 | /* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ 4 | 5 | module M = 6 | Something.Create({ 7 | type resource1 = MyModule.MySubmodule.t; 8 | type resource2 = MyModule.MySubmodule.t; 9 | }); 10 | -------------------------------------------------------------------------------- /test/uchar-esc.t/input.re: -------------------------------------------------------------------------------- 1 | 2 | 3 | let x = "\u{1F42B}"; 4 | let y = "\u{0}"; 5 | let y = "\u{00}"; 6 | let y = "\u{000}"; 7 | let y = "\u{000000}"; 8 | let y = "\u{0000E9}"; 9 | let y = "\u{10FFFF}"; 10 | 11 | let x = "\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}"; 12 | let () = Format.eprintf ("x: %s@.", x); 13 | 14 | // in a comment 15 | /* "\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}" */ 16 | -------------------------------------------------------------------------------- /test/uchar-esc.t/run.t: -------------------------------------------------------------------------------- 1 | Test uchar escape lexing 2 | 3 | $ refmt ./input.re 4 | let x = "\u{1F42B}"; 5 | let y = "\u{0}"; 6 | let y = "\u{00}"; 7 | let y = "\u{000}"; 8 | let y = "\u{000000}"; 9 | let y = "\u{0000E9}"; 10 | let y = "\u{10FFFF}"; 11 | 12 | let x = "\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}"; 13 | let () = Format.eprintf("x: %s@.", x); 14 | 15 | // in a comment 16 | /* "\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}\u{1F42B}" */ 17 | 18 | check internal translation 19 | 20 | $ ocamlc -dsource -pp 'refmt --print binary' -intf-suffix .rei -impl input.re -o test 21 | let x = "\240\159\144\171" 22 | let y = "\000" 23 | let y = "\000" 24 | let y = "\000" 25 | let y = "\000" 26 | let y = "\195\169" 27 | let y = "\244\143\191\191" 28 | let x = 29 | "\240\159\144\171\240\159\144\171\240\159\144\171\240\159\144\171\240\159\144\171\240\159\144\171" 30 | let () = Format.eprintf "x: %s@." x 31 | 32 | $ ./test 33 | x: 🐫🐫🐫🐫🐫🐫 34 | -------------------------------------------------------------------------------- /test/version.t: -------------------------------------------------------------------------------- 1 | Ensures refmt --version prints the right version 2 | $ refmt --version | cut -d '@' -f 1 | cut -d '-' -f 1 | awk '{$1=$1;print}' 3 | Reason 3.16.0 4 | --------------------------------------------------------------------------------