diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be86931765..41ad99329f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,8 @@ jobs: # Do not pin odoc to not break Mdx installation opam-pin: false ocaml-version: ${{ matrix.ocaml-version }} + opam-local-packages: | + odoc.opam - name: Install dependencies run: opam install -y --deps-only -t ./odoc.opam diff --git a/esy.lock/.gitattributes b/esy.lock/.gitattributes deleted file mode 100644 index e0b4e26c5a..0000000000 --- a/esy.lock/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ - -# Set eol to LF so files aren't converted to CRLF-eol on Windows. -* text eol=lf linguist-generated diff --git a/esy.lock/.gitignore b/esy.lock/.gitignore deleted file mode 100644 index a221be227e..0000000000 --- a/esy.lock/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -# Reset any possible .gitignore, we want all esy.lock to be un-ignored. -!* diff --git a/esy.lock/index.json b/esy.lock/index.json deleted file mode 100644 index 22692a904e..0000000000 --- a/esy.lock/index.json +++ /dev/null @@ -1,1044 +0,0 @@ -{ - "checksum": "54a2ca2738bd3f24d15cb7a71b92c9e3", - "root": "odoc@link-dev:./package.json", - "node": { - "odoc@link-dev:./package.json": { - "id": "odoc@link-dev:./package.json", - "name": "odoc", - "version": "link-dev:./package.json", - "source": { - "type": "link-dev", - "path": ".", - "manifest": "package.json" - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/tyxml@opam:4.3.0@c1da25f1", - "@opam/sexplib0@opam:v0.14.0@ddeb6438", - "@opam/result@opam:1.4@dc720aef", - "@opam/ocamlfind-secondary@opam:1.8.1@1afa38b2", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/markup@github:aantron/markup.ml:markup.opam#9f8e77@d41d8cd9", - "@opam/lambdasoup@opam:0.7.1@4ede102f", - "@opam/fpath@opam:0.7.2@3fd2da53", "@opam/dune@opam:2.7.1@baccb77f", - "@opam/cppo@opam:1.6.5@f8ff4f1a", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@opam/bisect_ppx@opam:2.4.1@dfb4bc5f", - "@opam/astring@opam:0.8.3@1e8f8178", - "@opam/alcotest@opam:0.8.5@4bc922ed" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/merlin@opam:3.3.9@e0b69f63" - ] - }, - "ocaml@4.6.1003@d41d8cd9": { - "id": "ocaml@4.6.1003@d41d8cd9", - "name": "ocaml", - "version": "4.6.1003", - "source": { - "type": "install", - "source": [ - "archive:https://registry.npmjs.org/ocaml/-/ocaml-4.6.1003.tgz#sha1:6a391e80b4d1859bdb1943fd3ef6221c7f0a9a49" - ] - }, - "overrides": [], - "dependencies": [], - "devDependencies": [] - }, - "esy-m4@github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7@d41d8cd9": { - "id": - "esy-m4@github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7@d41d8cd9", - "name": "esy-m4", - "version": - "github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7", - "source": { - "type": "install", - "source": [ - "github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7" - ] - }, - "overrides": [], - "dependencies": [], - "devDependencies": [] - }, - "@opam/yojson@opam:1.7.0@7056d985": { - "id": "@opam/yojson@opam:1.7.0@7056d985", - "name": "@opam/yojson", - "version": "opam:1.7.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/b8/b89d39ca3f8c532abe5f547ad3b8f84d#md5:b89d39ca3f8c532abe5f547ad3b8f84d", - "archive:https://github.com/ocaml-community/yojson/releases/download/1.7.0/yojson-1.7.0.tbz#md5:b89d39ca3f8c532abe5f547ad3b8f84d" - ], - "opam": { - "name": "yojson", - "version": "1.7.0", - "path": "esy.lock/opam/yojson.1.7.0" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:2.7.1@baccb77f", "@opam/cppo@opam:1.6.5@f8ff4f1a", - "@opam/biniou@opam:1.2.1@d7570399", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:2.7.1@baccb77f", "@opam/biniou@opam:1.2.1@d7570399" - ] - }, - "@opam/uutf@opam:1.0.2@4440868f": { - "id": "@opam/uutf@opam:1.0.2@4440868f", - "name": "@opam/uutf", - "version": "opam:1.0.2", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/a7/a7c542405a39630c689a82bd7ef2292c#md5:a7c542405a39630c689a82bd7ef2292c", - "archive:http://erratique.ch/software/uutf/releases/uutf-1.0.2.tbz#md5:a7c542405a39630c689a82bd7ef2292c" - ], - "opam": { - "name": "uutf", - "version": "1.0.2", - "path": "esy.lock/opam/uutf.1.0.2" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/uchar@opam:0.0.2@c8218eea", - "@opam/topkg@opam:1.0.3@e4e10f1c", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/uchar@opam:0.0.2@c8218eea" - ] - }, - "@opam/uuidm@opam:0.9.7@bf725775": { - "id": "@opam/uuidm@opam:0.9.7@bf725775", - "name": "@opam/uuidm", - "version": "opam:0.9.7", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/54/54658248e3981d8c05237d0a4277ccd3#md5:54658248e3981d8c05237d0a4277ccd3", - "archive:https://erratique.ch/software/uuidm/releases/uuidm-0.9.7.tbz#md5:54658248e3981d8c05237d0a4277ccd3" - ], - "opam": { - "name": "uuidm", - "version": "0.9.7", - "path": "esy.lock/opam/uuidm.0.9.7" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/topkg@opam:1.0.3@e4e10f1c", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ "ocaml@4.6.1003@d41d8cd9" ] - }, - "@opam/uchar@opam:0.0.2@c8218eea": { - "id": "@opam/uchar@opam:0.0.2@c8218eea", - "name": "@opam/uchar", - "version": "opam:0.0.2", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/c9/c9ba2c738d264c420c642f7bb1cf4a36#md5:c9ba2c738d264c420c642f7bb1cf4a36", - "archive:https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz#md5:c9ba2c738d264c420c642f7bb1cf4a36" - ], - "opam": { - "name": "uchar", - "version": "0.0.2", - "path": "esy.lock/opam/uchar.0.0.2" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ "ocaml@4.6.1003@d41d8cd9" ] - }, - "@opam/tyxml@opam:4.3.0@c1da25f1": { - "id": "@opam/tyxml@opam:4.3.0@c1da25f1", - "name": "@opam/tyxml", - "version": "opam:4.3.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/fd/fd834a567f813bf447cab5f4c3a723e2#md5:fd834a567f813bf447cab5f4c3a723e2", - "archive:https://github.com/ocsigen/tyxml/releases/download/4.3.0/tyxml-4.3.0.tbz#md5:fd834a567f813bf447cab5f4c3a723e2" - ], - "opam": { - "name": "tyxml", - "version": "4.3.0", - "path": "esy.lock/opam/tyxml.4.3.0" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/uutf@opam:1.0.2@4440868f", - "@opam/seq@opam:0.2.2@e9144e45", "@opam/re@opam:1.9.0@d4d5e13d", - "@opam/dune@opam:2.7.1@baccb77f", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/uutf@opam:1.0.2@4440868f", - "@opam/seq@opam:0.2.2@e9144e45", "@opam/re@opam:1.9.0@d4d5e13d", - "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/topkg@opam:1.0.3@e4e10f1c": { - "id": "@opam/topkg@opam:1.0.3@e4e10f1c", - "name": "@opam/topkg", - "version": "opam:1.0.3", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/e2/e285f7a296d77ee7d831ba9a6bfb396f#md5:e285f7a296d77ee7d831ba9a6bfb396f", - "archive:http://erratique.ch/software/topkg/releases/topkg-1.0.3.tbz#md5:e285f7a296d77ee7d831ba9a6bfb396f" - ], - "opam": { - "name": "topkg", - "version": "1.0.3", - "path": "esy.lock/opam/topkg.1.0.3" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/ocamlbuild@opam:0.14.0@6ac75d03" - ] - }, - "@opam/stdlib-shims@opam:0.3.0@0d088929": { - "id": "@opam/stdlib-shims@opam:0.3.0@0d088929", - "name": "@opam/stdlib-shims", - "version": "opam:0.3.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/sha256/ba/babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a#sha256:babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a", - "archive:https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz#sha256:babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a" - ], - "opam": { - "name": "stdlib-shims", - "version": "0.3.0", - "path": "esy.lock/opam/stdlib-shims.0.3.0" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/sexplib0@opam:v0.14.0@ddeb6438": { - "id": "@opam/sexplib0@opam:v0.14.0@ddeb6438", - "name": "@opam/sexplib0", - "version": "opam:v0.14.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/37/37aff0af8f8f6f759249475684aebdc4#md5:37aff0af8f8f6f759249475684aebdc4", - "archive:https://ocaml.janestreet.com/ocaml-core/v0.14/files/sexplib0-v0.14.0.tar.gz#md5:37aff0af8f8f6f759249475684aebdc4" - ], - "opam": { - "name": "sexplib0", - "version": "v0.14.0", - "path": "esy.lock/opam/sexplib0.v0.14.0" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/seq@opam:0.2.2@e9144e45": { - "id": "@opam/seq@opam:0.2.2@e9144e45", - "name": "@opam/seq", - "version": "opam:0.2.2", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/90/9033e02283aa3bde9f97f24e632902e3#md5:9033e02283aa3bde9f97f24e632902e3", - "archive:https://github.com/c-cube/seq/archive/0.2.2.tar.gz#md5:9033e02283aa3bde9f97f24e632902e3" - ], - "opam": { - "name": "seq", - "version": "0.2.2", - "path": "esy.lock/opam/seq.0.2.2" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/result@opam:1.4@dc720aef": { - "id": "@opam/result@opam:1.4@dc720aef", - "name": "@opam/result", - "version": "opam:1.4", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/d3/d3162dbc501a2af65c8c71e0866541da#md5:d3162dbc501a2af65c8c71e0866541da", - "archive:https://github.com/janestreet/result/archive/1.4.tar.gz#md5:d3162dbc501a2af65c8c71e0866541da" - ], - "opam": { - "name": "result", - "version": "1.4", - "path": "esy.lock/opam/result.1.4" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/re@opam:1.9.0@d4d5e13d": { - "id": "@opam/re@opam:1.9.0@d4d5e13d", - "name": "@opam/re", - "version": "opam:1.9.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/bd/bddaed4f386a22cace7850c9c7dac296#md5:bddaed4f386a22cace7850c9c7dac296", - "archive:https://github.com/ocaml/ocaml-re/releases/download/1.9.0/re-1.9.0.tbz#md5:bddaed4f386a22cace7850c9c7dac296" - ], - "opam": { - "name": "re", - "version": "1.9.0", - "path": "esy.lock/opam/re.1.9.0" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/seq@opam:0.2.2@e9144e45", - "@opam/dune@opam:2.7.1@baccb77f", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/seq@opam:0.2.2@e9144e45", - "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414": { - "id": "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414", - "name": "@opam/ppx_tools_versioned", - "version": "opam:5.4.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/3e/3e809a11cae99f57c051d3d0100311f6#md5:3e809a11cae99f57c051d3d0100311f6", - "archive:https://github.com/ocaml-ppx/ppx_tools_versioned/archive/5.4.0.tar.gz#md5:3e809a11cae99f57c051d3d0100311f6" - ], - "opam": { - "name": "ppx_tools_versioned", - "version": "5.4.0", - "path": "esy.lock/opam/ppx_tools_versioned.5.4.0" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/ocaml-migrate-parsetree@opam:1.8.0@caf9847c", - "@opam/dune@opam:2.7.1@baccb77f", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/ocaml-migrate-parsetree@opam:1.8.0@caf9847c", - "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/ppx_derivers@opam:1.2.1@ecf0aa45": { - "id": "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", - "name": "@opam/ppx_derivers", - "version": "opam:1.2.1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/5d/5dc2bf130c1db3c731fe0fffc5648b41#md5:5dc2bf130c1db3c731fe0fffc5648b41", - "archive:https://github.com/ocaml-ppx/ppx_derivers/archive/1.2.1.tar.gz#md5:5dc2bf130c1db3c731fe0fffc5648b41" - ], - "opam": { - "name": "ppx_derivers", - "version": "1.2.1", - "path": "esy.lock/opam/ppx_derivers.1.2.1" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/ocamlfind-secondary@opam:1.8.1@1afa38b2": { - "id": "@opam/ocamlfind-secondary@opam:1.8.1@1afa38b2", - "name": "@opam/ocamlfind-secondary", - "version": "opam:1.8.1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/18/18ca650982c15536616dea0e422cbd8c#md5:18ca650982c15536616dea0e422cbd8c", - "archive:http://download2.camlcity.org/download/findlib-1.8.1.tar.gz#md5:18ca650982c15536616dea0e422cbd8c", - "archive:http://download.camlcity.org/download/findlib-1.8.1.tar.gz#md5:18ca650982c15536616dea0e422cbd8c" - ], - "opam": { - "name": "ocamlfind-secondary", - "version": "1.8.1", - "path": "esy.lock/opam/ocamlfind-secondary.1.8.1" - } - }, - "overrides": [ - { - "opamoverride": - "esy.lock/overrides/opam__s__ocamlfind_secondary_opam__c__1.8.1_opam_override" - } - ], - "dependencies": [ - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocaml-secondary-compiler@opam:4.08.1-1@85df5d8f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocaml-secondary-compiler@opam:4.08.1-1@85df5d8f" - ] - }, - "@opam/ocamlfind@opam:1.8.1@b7dc3072": { - "id": "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "name": "@opam/ocamlfind", - "version": "opam:1.8.1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/18/18ca650982c15536616dea0e422cbd8c#md5:18ca650982c15536616dea0e422cbd8c", - "archive:http://download2.camlcity.org/download/findlib-1.8.1.tar.gz#md5:18ca650982c15536616dea0e422cbd8c", - "archive:http://download.camlcity.org/download/findlib-1.8.1.tar.gz#md5:18ca650982c15536616dea0e422cbd8c" - ], - "opam": { - "name": "ocamlfind", - "version": "1.8.1", - "path": "esy.lock/opam/ocamlfind.1.8.1" - } - }, - "overrides": [ - { - "opamoverride": - "esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override" - } - ], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/conf-m4@opam:1@196bf219", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ "ocaml@4.6.1003@d41d8cd9" ] - }, - "@opam/ocamlbuild@opam:0.14.0@6ac75d03": { - "id": "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "name": "@opam/ocamlbuild", - "version": "opam:0.14.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/sha256/87/87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78#sha256:87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78", - "archive:https://github.com/ocaml/ocamlbuild/archive/0.14.0.tar.gz#sha256:87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78" - ], - "opam": { - "name": "ocamlbuild", - "version": "0.14.0", - "path": "esy.lock/opam/ocamlbuild.0.14.0" - } - }, - "overrides": [ - { - "opamoverride": - "esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override" - } - ], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ "ocaml@4.6.1003@d41d8cd9" ] - }, - "@opam/ocaml-secondary-compiler@opam:4.08.1-1@85df5d8f": { - "id": "@opam/ocaml-secondary-compiler@opam:4.08.1-1@85df5d8f", - "name": "@opam/ocaml-secondary-compiler", - "version": "opam:4.08.1-1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/72/723b6bfe8cf5abcbccc6911143f71055#md5:723b6bfe8cf5abcbccc6911143f71055", - "archive:https://github.com/ocaml/ocaml/archive/4.08.1.tar.gz#md5:723b6bfe8cf5abcbccc6911143f71055" - ], - "opam": { - "name": "ocaml-secondary-compiler", - "version": "4.08.1-1", - "path": "esy.lock/opam/ocaml-secondary-compiler.4.08.1-1" - } - }, - "overrides": [ - { - "opamoverride": - "esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override" - } - ], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ "ocaml@4.6.1003@d41d8cd9" ] - }, - "@opam/ocaml-migrate-parsetree@opam:1.8.0@caf9847c": { - "id": "@opam/ocaml-migrate-parsetree@opam:1.8.0@caf9847c", - "name": "@opam/ocaml-migrate-parsetree", - "version": "opam:1.8.0", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/sha256/b1/b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5#sha256:b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5", - "archive:https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v1.8.0/ocaml-migrate-parsetree-v1.8.0.tbz#sha256:b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5" - ], - "opam": { - "name": "ocaml-migrate-parsetree", - "version": "1.8.0", - "path": "esy.lock/opam/ocaml-migrate-parsetree.1.8.0" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/result@opam:1.4@dc720aef", - "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", - "@opam/dune@opam:2.7.1@baccb77f", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/result@opam:1.4@dc720aef", - "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", - "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/merlin@opam:3.3.9@e0b69f63": { - "id": "@opam/merlin@opam:3.3.9@e0b69f63", - "name": "@opam/merlin", - "version": "opam:3.3.9", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/sha256/a3/a3170f1a993d810d552a21a4baa328dff0fe9ac9bf4b8aa6ba3f179a9240cf02#sha256:a3170f1a993d810d552a21a4baa328dff0fe9ac9bf4b8aa6ba3f179a9240cf02", - "archive:https://github.com/ocaml/merlin/releases/download/v3.3.9/merlin-v3.3.9.tbz#sha256:a3170f1a993d810d552a21a4baa328dff0fe9ac9bf4b8aa6ba3f179a9240cf02" - ], - "opam": { - "name": "merlin", - "version": "3.3.9", - "path": "esy.lock/opam/merlin.3.3.9" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/dune@opam:2.7.1@baccb77f", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/markup@github:aantron/markup.ml:markup.opam#9f8e77@d41d8cd9": { - "id": - "@opam/markup@github:aantron/markup.ml:markup.opam#9f8e77@d41d8cd9", - "name": "@opam/markup", - "version": "github:aantron/markup.ml:markup.opam#9f8e77", - "source": { - "type": "install", - "source": [ "github:aantron/markup.ml:markup.opam#9f8e77" ] - }, - "overrides": [], - "dependencies": [ - "@opam/uutf@opam:1.0.2@4440868f", "@opam/uchar@opam:0.0.2@c8218eea", - "@opam/dune@opam:2.7.1@baccb77f", - "@opam/bisect_ppx@opam:2.4.1@dfb4bc5f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "@opam/uutf@opam:1.0.2@4440868f", "@opam/uchar@opam:0.0.2@c8218eea", - "@opam/bisect_ppx@opam:2.4.1@dfb4bc5f" - ] - }, - "@opam/lambdasoup@opam:0.7.1@4ede102f": { - "id": "@opam/lambdasoup@opam:0.7.1@4ede102f", - "name": "@opam/lambdasoup", - "version": "opam:0.7.1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/da/da9884ec354960d0c76e4bb834042fb8#md5:da9884ec354960d0c76e4bb834042fb8", - "archive:https://github.com/aantron/lambdasoup/archive/0.7.1.tar.gz#md5:da9884ec354960d0c76e4bb834042fb8" - ], - "opam": { - "name": "lambdasoup", - "version": "0.7.1", - "path": "esy.lock/opam/lambdasoup.0.7.1" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/markup@github:aantron/markup.ml:markup.opam#9f8e77@d41d8cd9", - "@opam/dune@opam:2.7.1@baccb77f", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/markup@github:aantron/markup.ml:markup.opam#9f8e77@d41d8cd9", - "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/jbuilder@opam:1.0+beta20.2@053ddcf2": { - "id": "@opam/jbuilder@opam:1.0+beta20.2@053ddcf2", - "name": "@opam/jbuilder", - "version": "opam:1.0+beta20.2", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/fb/fbe8c3b1facb206cac3fb8932b5dd5d9#md5:fbe8c3b1facb206cac3fb8932b5dd5d9", - "archive:https://github.com/ocaml/dune/releases/download/1.0%2Bbeta20.2/jbuilder-1.0+beta20.2.tbz#md5:fbe8c3b1facb206cac3fb8932b5dd5d9" - ], - "opam": { - "name": "jbuilder", - "version": "1.0+beta20.2", - "path": "esy.lock/opam/jbuilder.1.0+beta20.2" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ "ocaml@4.6.1003@d41d8cd9" ] - }, - "@opam/fpath@opam:0.7.2@3fd2da53": { - "id": "@opam/fpath@opam:0.7.2@3fd2da53", - "name": "@opam/fpath", - "version": "opam:0.7.2", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/52/52c7ecb0bf180088336f3c645875fa41#md5:52c7ecb0bf180088336f3c645875fa41", - "archive:http://erratique.ch/software/fpath/releases/fpath-0.7.2.tbz#md5:52c7ecb0bf180088336f3c645875fa41" - ], - "opam": { - "name": "fpath", - "version": "0.7.2", - "path": "esy.lock/opam/fpath.0.7.2" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/topkg@opam:1.0.3@e4e10f1c", - "@opam/result@opam:1.4@dc720aef", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@opam/astring@opam:0.8.3@1e8f8178", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/result@opam:1.4@dc720aef", - "@opam/astring@opam:0.8.3@1e8f8178" - ] - }, - "@opam/fmt@opam:0.8.9@e0843a5b": { - "id": "@opam/fmt@opam:0.8.9@e0843a5b", - "name": "@opam/fmt", - "version": "opam:0.8.9", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/40/4001b51cde90ea4fd99a4a5033ecf411#md5:4001b51cde90ea4fd99a4a5033ecf411", - "archive:https://erratique.ch/software/fmt/releases/fmt-0.8.9.tbz#md5:4001b51cde90ea4fd99a4a5033ecf411" - ], - "opam": { - "name": "fmt", - "version": "0.8.9", - "path": "esy.lock/opam/fmt.0.8.9" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/topkg@opam:1.0.3@e4e10f1c", - "@opam/stdlib-shims@opam:0.3.0@0d088929", - "@opam/seq@opam:0.2.2@e9144e45", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@opam/base-unix@opam:base@87d0b2eb", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/stdlib-shims@opam:0.3.0@0d088929", - "@opam/seq@opam:0.2.2@e9144e45" - ] - }, - "@opam/easy-format@opam:1.3.2@0484b3c4": { - "id": "@opam/easy-format@opam:1.3.2@0484b3c4", - "name": "@opam/easy-format", - "version": "opam:1.3.2", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/sha256/34/3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926#sha256:3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926", - "archive:https://github.com/mjambon/easy-format/releases/download/1.3.2/easy-format-1.3.2.tbz#sha256:3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926" - ], - "opam": { - "name": "easy-format", - "version": "1.3.2", - "path": "esy.lock/opam/easy-format.1.3.2" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/dune@opam:2.7.1@baccb77f": { - "id": "@opam/dune@opam:2.7.1@baccb77f", - "name": "@opam/dune", - "version": "opam:2.7.1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/sha256/c3/c3528f2f8b3a2e3fe18e166fc823e6caeee8b7c78ade6b6fe4d2fa978070925d#sha256:c3528f2f8b3a2e3fe18e166fc823e6caeee8b7c78ade6b6fe4d2fa978070925d", - "archive:https://github.com/ocaml/dune/releases/download/2.7.1/dune-2.7.1.tbz#sha256:c3528f2f8b3a2e3fe18e166fc823e6caeee8b7c78ade6b6fe4d2fa978070925d" - ], - "opam": { - "name": "dune", - "version": "2.7.1", - "path": "esy.lock/opam/dune.2.7.1" - } - }, - "overrides": [ - { - "opamoverride": - "esy.lock/overrides/opam__s__dune_opam__c__2.7.1_opam_override" - } - ], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/ocamlfind-secondary@opam:1.8.1@1afa38b2", - "@opam/base-unix@opam:base@87d0b2eb", - "@opam/base-threads@opam:base@36803084", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/ocamlfind-secondary@opam:1.8.1@1afa38b2", - "@opam/base-unix@opam:base@87d0b2eb", - "@opam/base-threads@opam:base@36803084" - ] - }, - "@opam/cppo@opam:1.6.5@f8ff4f1a": { - "id": "@opam/cppo@opam:1.6.5@f8ff4f1a", - "name": "@opam/cppo", - "version": "opam:1.6.5", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/1c/1cd25741d31417995b0973fe0b6f6c82#md5:1cd25741d31417995b0973fe0b6f6c82", - "archive:https://github.com/mjambon/cppo/archive/v1.6.5.tar.gz#md5:1cd25741d31417995b0973fe0b6f6c82" - ], - "opam": { - "name": "cppo", - "version": "1.6.5", - "path": "esy.lock/opam/cppo.1.6.5" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/jbuilder@opam:1.0+beta20.2@053ddcf2", - "@opam/base-unix@opam:base@87d0b2eb", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/jbuilder@opam:1.0+beta20.2@053ddcf2", - "@opam/base-unix@opam:base@87d0b2eb" - ] - }, - "@opam/conf-m4@opam:1@196bf219": { - "id": "@opam/conf-m4@opam:1@196bf219", - "name": "@opam/conf-m4", - "version": "opam:1", - "source": { - "type": "install", - "source": [ "no-source:" ], - "opam": { - "name": "conf-m4", - "version": "1", - "path": "esy.lock/opam/conf-m4.1" - } - }, - "overrides": [ - { - "opamoverride": - "esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override" - } - ], - "dependencies": [ - "esy-m4@github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7@d41d8cd9", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [] - }, - "@opam/cmdliner@opam:1.0.2@1c17346c": { - "id": "@opam/cmdliner@opam:1.0.2@1c17346c", - "name": "@opam/cmdliner", - "version": "opam:1.0.2", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/ab/ab2f0130e88e8dcd723ac6154c98a881#md5:ab2f0130e88e8dcd723ac6154c98a881", - "archive:http://erratique.ch/software/cmdliner/releases/cmdliner-1.0.2.tbz#md5:ab2f0130e88e8dcd723ac6154c98a881" - ], - "opam": { - "name": "cmdliner", - "version": "1.0.2", - "path": "esy.lock/opam/cmdliner.1.0.2" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/topkg@opam:1.0.3@e4e10f1c", - "@opam/result@opam:1.4@dc720aef", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/result@opam:1.4@dc720aef" - ] - }, - "@opam/bisect_ppx@opam:2.4.1@dfb4bc5f": { - "id": "@opam/bisect_ppx@opam:2.4.1@dfb4bc5f", - "name": "@opam/bisect_ppx", - "version": "opam:2.4.1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/95/9551a49de6b80aa7caf20ec693387c86#md5:9551a49de6b80aa7caf20ec693387c86", - "archive:https://github.com/aantron/bisect_ppx/archive/2.4.1.tar.gz#md5:9551a49de6b80aa7caf20ec693387c86" - ], - "opam": { - "name": "bisect_ppx", - "version": "2.4.1", - "path": "esy.lock/opam/bisect_ppx.2.4.1" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414", - "@opam/ocaml-migrate-parsetree@opam:1.8.0@caf9847c", - "@opam/dune@opam:2.7.1@baccb77f", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@opam/base-unix@opam:base@87d0b2eb", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", - "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414", - "@opam/ocaml-migrate-parsetree@opam:1.8.0@caf9847c", - "@opam/dune@opam:2.7.1@baccb77f", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@opam/base-unix@opam:base@87d0b2eb" - ] - }, - "@opam/biniou@opam:1.2.1@d7570399": { - "id": "@opam/biniou@opam:1.2.1@d7570399", - "name": "@opam/biniou", - "version": "opam:1.2.1", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/sha256/35/35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335#sha256:35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335", - "archive:https://github.com/mjambon/biniou/releases/download/1.2.1/biniou-1.2.1.tbz#sha256:35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335" - ], - "opam": { - "name": "biniou", - "version": "1.2.1", - "path": "esy.lock/opam/biniou.1.2.1" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:2.7.1@baccb77f", "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:2.7.1@baccb77f" - ] - }, - "@opam/base-unix@opam:base@87d0b2eb": { - "id": "@opam/base-unix@opam:base@87d0b2eb", - "name": "@opam/base-unix", - "version": "opam:base", - "source": { - "type": "install", - "source": [ "no-source:" ], - "opam": { - "name": "base-unix", - "version": "base", - "path": "esy.lock/opam/base-unix.base" - } - }, - "overrides": [], - "dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], - "devDependencies": [] - }, - "@opam/base-threads@opam:base@36803084": { - "id": "@opam/base-threads@opam:base@36803084", - "name": "@opam/base-threads", - "version": "opam:base", - "source": { - "type": "install", - "source": [ "no-source:" ], - "opam": { - "name": "base-threads", - "version": "base", - "path": "esy.lock/opam/base-threads.base" - } - }, - "overrides": [], - "dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], - "devDependencies": [] - }, - "@opam/base-bytes@opam:base@19d0c2ff": { - "id": "@opam/base-bytes@opam:base@19d0c2ff", - "name": "@opam/base-bytes", - "version": "opam:base", - "source": { - "type": "install", - "source": [ "no-source:" ], - "opam": { - "name": "base-bytes", - "version": "base", - "path": "esy.lock/opam/base-bytes.base" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@b7dc3072" - ] - }, - "@opam/astring@opam:0.8.3@1e8f8178": { - "id": "@opam/astring@opam:0.8.3@1e8f8178", - "name": "@opam/astring", - "version": "opam:0.8.3", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/c5/c5bf6352b9ac27fbeab342740f4fa870#md5:c5bf6352b9ac27fbeab342740f4fa870", - "archive:http://erratique.ch/software/astring/releases/astring-0.8.3.tbz#md5:c5bf6352b9ac27fbeab342740f4fa870" - ], - "opam": { - "name": "astring", - "version": "0.8.3", - "path": "esy.lock/opam/astring.0.8.3" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/topkg@opam:1.0.3@e4e10f1c", - "@opam/ocamlfind@opam:1.8.1@b7dc3072", - "@opam/ocamlbuild@opam:0.14.0@6ac75d03", - "@opam/base-bytes@opam:base@19d0c2ff", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/base-bytes@opam:base@19d0c2ff" - ] - }, - "@opam/alcotest@opam:0.8.5@4bc922ed": { - "id": "@opam/alcotest@opam:0.8.5@4bc922ed", - "name": "@opam/alcotest", - "version": "opam:0.8.5", - "source": { - "type": "install", - "source": [ - "archive:https://opam.ocaml.org/cache/md5/2d/2db36741c413ab93391ecc1f983aa804#md5:2db36741c413ab93391ecc1f983aa804", - "archive:https://github.com/mirage/alcotest/releases/download/0.8.5/alcotest-0.8.5.tbz#md5:2db36741c413ab93391ecc1f983aa804" - ], - "opam": { - "name": "alcotest", - "version": "0.8.5", - "path": "esy.lock/opam/alcotest.0.8.5" - } - }, - "overrides": [], - "dependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/uuidm@opam:0.9.7@bf725775", - "@opam/result@opam:1.4@dc720aef", "@opam/fmt@opam:0.8.9@e0843a5b", - "@opam/dune@opam:2.7.1@baccb77f", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@opam/astring@opam:0.8.3@1e8f8178", - "@esy-ocaml/substs@0.0.1@d41d8cd9" - ], - "devDependencies": [ - "ocaml@4.6.1003@d41d8cd9", "@opam/uuidm@opam:0.9.7@bf725775", - "@opam/result@opam:1.4@dc720aef", "@opam/fmt@opam:0.8.9@e0843a5b", - "@opam/dune@opam:2.7.1@baccb77f", - "@opam/cmdliner@opam:1.0.2@1c17346c", - "@opam/astring@opam:0.8.3@1e8f8178" - ] - }, - "@esy-ocaml/substs@0.0.1@d41d8cd9": { - "id": "@esy-ocaml/substs@0.0.1@d41d8cd9", - "name": "@esy-ocaml/substs", - "version": "0.0.1", - "source": { - "type": "install", - "source": [ - "archive:https://registry.npmjs.org/@esy-ocaml/substs/-/substs-0.0.1.tgz#sha1:59ebdbbaedcda123fc7ed8fb2b302b7d819e9a46" - ] - }, - "overrides": [], - "dependencies": [], - "devDependencies": [] - } - } -} \ No newline at end of file diff --git a/esy.lock/opam/alcotest.0.8.5/opam b/esy.lock/opam/alcotest.0.8.5/opam deleted file mode 100644 index 6b52889c2d..0000000000 --- a/esy.lock/opam/alcotest.0.8.5/opam +++ /dev/null @@ -1,43 +0,0 @@ -opam-version: "2.0" -maintainer: "thomas@gazagnaire.org" -authors: "Thomas Gazagnaire" -homepage: "https://github.com/mirage/alcotest/" -dev-repo: "git+https://github.com/mirage/alcotest.git" -bug-reports: "https://github.com/mirage/alcotest/issues/" -license: "ISC" -doc: "https://mirage.github.io/alcotest/" - -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} -] - -depends: [ - "dune" {>= "1.1.0"} - "ocaml" {>= "4.02.3"} - "fmt" {>= "0.8.0"} - "astring" - "result" {< "1.5"} - "cmdliner" - "uuidm" -] - -synopsis: "Alcotest is a lightweight and colourful test framework" - -description: """ -Alcotest exposes simple interface to perform unit tests. It exposes -a simple TESTABLE module type, a check function to assert test -predicates and a run function to perform a list of unit -> unit -test callbacks. - -Alcotest provides a quiet and colorful output where only faulty runs -are fully displayed at the end of the run (with the full logs ready to -inspect), with a simple (yet expressive) query language to select the -tests to run. -""" -url { - src: - "https://github.com/mirage/alcotest/releases/download/0.8.5/alcotest-0.8.5.tbz" - checksum: "md5=2db36741c413ab93391ecc1f983aa804" -} diff --git a/esy.lock/opam/astring.0.8.3/opam b/esy.lock/opam/astring.0.8.3/opam deleted file mode 100644 index 3c0d191f8b..0000000000 --- a/esy.lock/opam/astring.0.8.3/opam +++ /dev/null @@ -1,38 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: ["Daniel Bünzli "] -homepage: "http://erratique.ch/software/astring" -doc: "http://erratique.ch/software/astring/doc" -dev-repo: "git+http://erratique.ch/repos/astring.git" -bug-reports: "https://github.com/dbuenzli/astring/issues" -tags: [ "string" "org:erratique" ] -license: "ISC" -depends: [ - "ocaml" {>= "4.01.0" & < "4.12.0"} - "ocamlfind" {build} - "ocamlbuild" {build} - "topkg" {build} - "base-bytes" -] -build: [[ - "ocaml" "pkg/pkg.ml" "build" - "--pinned" "%{pinned}%" ]] -synopsis: "Alternative String module for OCaml" -description: """ -Astring exposes an alternative `String` module for OCaml. This module -tries to balance minimality and expressiveness for basic, index-free, -string processing and provides types and functions for substrings, -string sets and string maps. - -Remaining compatible with the OCaml `String` module is a non-goal. The -`String` module exposed by Astring has exception safe functions, -removes deprecated and rarely used functions, alters some signatures -and names, adds a few missing functions and fully exploits OCaml's -newfound string immutability. - -Astring depends only on the OCaml standard library. It is distributed -under the ISC license.""" -url { - src: "http://erratique.ch/software/astring/releases/astring-0.8.3.tbz" - checksum: "md5=c5bf6352b9ac27fbeab342740f4fa870" -} diff --git a/esy.lock/opam/base-bytes.base/opam b/esy.lock/opam/base-bytes.base/opam deleted file mode 100644 index f1cae506c6..0000000000 --- a/esy.lock/opam/base-bytes.base/opam +++ /dev/null @@ -1,9 +0,0 @@ -opam-version: "2.0" -maintainer: " " -authors: " " -homepage: " " -depends: [ - "ocaml" {>= "4.02.0"} - "ocamlfind" {>= "1.5.3"} -] -synopsis: "Bytes library distributed with the OCaml compiler" diff --git a/esy.lock/opam/base-threads.base/opam b/esy.lock/opam/base-threads.base/opam deleted file mode 100644 index 914ff50ceb..0000000000 --- a/esy.lock/opam/base-threads.base/opam +++ /dev/null @@ -1,6 +0,0 @@ -opam-version: "2.0" -maintainer: "https://github.com/ocaml/opam-repository/issues" -description: """ -Threads library distributed with the OCaml compiler -""" - diff --git a/esy.lock/opam/base-unix.base/opam b/esy.lock/opam/base-unix.base/opam deleted file mode 100644 index b973540bcb..0000000000 --- a/esy.lock/opam/base-unix.base/opam +++ /dev/null @@ -1,6 +0,0 @@ -opam-version: "2.0" -maintainer: "https://github.com/ocaml/opam-repository/issues" -description: """ -Unix library distributed with the OCaml compiler -""" - diff --git a/esy.lock/opam/biniou.1.2.1/opam b/esy.lock/opam/biniou.1.2.1/opam deleted file mode 100644 index b706b4251a..0000000000 --- a/esy.lock/opam/biniou.1.2.1/opam +++ /dev/null @@ -1,45 +0,0 @@ -opam-version: "2.0" -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} - ["dune" "build" "-p" name "@doc"] {with-doc} -] -maintainer: ["martin@mjambon.com"] -authors: ["Martin Jambon"] -bug-reports: "https://github.com/mjambon/biniou/issues" -homepage: "https://github.com/mjambon/biniou" -doc: "https://mjambon.github.io/biniou/" -license: "BSD-3-Clause" -dev-repo: "git+https://github.com/mjambon/biniou.git" -synopsis: - "Binary data format designed for speed, safety, ease of use and backward compatibility as protocols evolve" -description: """ - -Biniou (pronounced "be new") is a binary data format designed for speed, safety, -ease of use and backward compatibility as protocols evolve. Biniou is vastly -equivalent to JSON in terms of functionality but allows implementations several -times faster (4 times faster than yojson), with 25-35% space savings. - -Biniou data can be decoded into human-readable form without knowledge of type -definitions except for field and variant names which are represented by 31-bit -hashes. A program named bdump is provided for routine visualization of biniou -data files. - -The program atdgen is used to derive OCaml-Biniou serializers and deserializers -from type definitions. - -Biniou format specification: mjambon.github.io/atdgen-doc/biniou-format.txt""" -depends: [ - "easy-format" - "dune" {>= "1.10"} - "ocaml" {>= "4.02.3"} -] -url { - src: - "https://github.com/mjambon/biniou/releases/download/1.2.1/biniou-1.2.1.tbz" - checksum: [ - "sha256=35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335" - "sha512=82670cc77bf3e869ee26e5fbe5a5affa45a22bc8b6c4bd7e85473912780e0111baca59b34a2c14feae3543ce6e239d7fddaeab24b686a65bfe642cdb91d27ebf" - ] -} diff --git a/esy.lock/opam/bisect_ppx.2.4.1/opam b/esy.lock/opam/bisect_ppx.2.4.1/opam deleted file mode 100644 index 981cc68db0..0000000000 --- a/esy.lock/opam/bisect_ppx.2.4.1/opam +++ /dev/null @@ -1,55 +0,0 @@ -opam-version: "2.0" - -synopsis: "Code coverage for OCaml" -version: "2.4.1" -license: "MIT" -homepage: "https://github.com/aantron/bisect_ppx" -doc: "https://github.com/aantron/bisect_ppx" -bug-reports: "https://github.com/aantron/bisect_ppx/issues" - -dev-repo: "git+https://github.com/aantron/bisect_ppx.git" -authors: [ - "Xavier Clerc " - "Leonid Rozenberg " - "Anton Bachin " -] -maintainer: [ - "Anton Bachin " - "Leonid Rozenberg " -] - -depends: [ - "base-unix" - "cmdliner" {>= "1.0.0"} - "dune" - "ocaml" {>= "4.02.0"} - "ocaml" {with-test & < "4.12"} - "ocaml-migrate-parsetree" {>= "1.7.0" & < "2.0.0"} - "ppx_tools_versioned" {>= "5.4.0"} - - "ocamlfind" {with-test} - "ounit2" {with-test} -] - -build: [ - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} -] - -post-messages: [ - "Bisect_ppx 2.0.0 has deprecated some command-line options. See - https://github.com/aantron/bisect_ppx/releases/tag/2.0.0" -] - -description: "Bisect_ppx helps you test thoroughly. It is a small preprocessor -that inserts instrumentation at places in your code, such as if-then-else and -match expressions. After you run tests, Bisect_ppx gives a nice HTML report -showing which places were visited and which were missed. - -Usage is simple - add package bisect_ppx when building tests, run your tests, -then run the Bisect_ppx report tool on the generated visitation files." - -url { - src: "https://github.com/aantron/bisect_ppx/archive/2.4.1.tar.gz" - checksum: "md5=9551a49de6b80aa7caf20ec693387c86" -} diff --git a/esy.lock/opam/cmdliner.1.0.2/opam b/esy.lock/opam/cmdliner.1.0.2/opam deleted file mode 100644 index e53d593ef4..0000000000 --- a/esy.lock/opam/cmdliner.1.0.2/opam +++ /dev/null @@ -1,39 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: ["Daniel Bünzli "] -homepage: "http://erratique.ch/software/cmdliner" -doc: "http://erratique.ch/software/cmdliner/doc/Cmdliner" -dev-repo: "git+http://erratique.ch/repos/cmdliner.git" -bug-reports: "https://github.com/dbuenzli/cmdliner/issues" -tags: [ "cli" "system" "declarative" "org:erratique" ] -license: "ISC" -depends: [ - "ocaml" {>= "4.01.0"} - "ocamlfind" {build} - "ocamlbuild" {build} - "topkg" {>= "0.8.1" & build} - "result" {< "1.5"} -] -build: [[ - "ocaml" "pkg/pkg.ml" "build" - "--pinned" "%{pinned}%" -]] -synopsis: "Declarative definition of command line interfaces for OCaml" -description: """ -Cmdliner allows the declarative definition of command line interfaces -for OCaml. - -It provides a simple and compositional mechanism to convert command -line arguments to OCaml values and pass them to your functions. The -module automatically handles syntax errors, help messages and UNIX man -page generation. It supports programs with single or multiple commands -and respects most of the [POSIX][1] and [GNU][2] conventions. - -Cmdliner has no dependencies and is distributed under the ISC license. - -[1]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html -[2]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html""" -url { - src: "http://erratique.ch/software/cmdliner/releases/cmdliner-1.0.2.tbz" - checksum: "md5=ab2f0130e88e8dcd723ac6154c98a881" -} diff --git a/esy.lock/opam/conf-m4.1/opam b/esy.lock/opam/conf-m4.1/opam deleted file mode 100644 index c6feb2a746..0000000000 --- a/esy.lock/opam/conf-m4.1/opam +++ /dev/null @@ -1,22 +0,0 @@ -opam-version: "2.0" -maintainer: "tim@gfxmonk.net" -homepage: "http://www.gnu.org/software/m4/m4.html" -bug-reports: "https://github.com/ocaml/opam-repository/issues" -authors: "GNU Project" -license: "GPL-3.0-only" -build: [["sh" "-exc" "echo | m4"]] -depexts: [ - ["m4"] {os-family = "debian"} - ["m4"] {os-distribution = "fedora"} - ["m4"] {os-distribution = "rhel"} - ["m4"] {os-distribution = "centos"} - ["m4"] {os-distribution = "alpine"} - ["m4"] {os-distribution = "nixos"} - ["m4"] {os-family = "suse"} - ["m4"] {os-distribution = "ol"} - ["m4"] {os-distribution = "arch"} -] -synopsis: "Virtual package relying on m4" -description: - "This package can only install if the m4 binary is installed on the system." -flags: conf diff --git a/esy.lock/opam/cppo.1.6.5/opam b/esy.lock/opam/cppo.1.6.5/opam deleted file mode 100644 index 6130ff3426..0000000000 --- a/esy.lock/opam/cppo.1.6.5/opam +++ /dev/null @@ -1,23 +0,0 @@ -opam-version: "2.0" -maintainer: "martin@mjambon.com" -authors: ["Martin Jambon"] -homepage: "https://github.com/mjambon/cppo" -dev-repo: "git+https://github.com/mjambon/cppo.git" -bug-reports: "https://github.com/mjambon/cppo/issues" -license: "BSD-3-Clause" - -build: [ - ["jbuilder" "subst" "-p" name] {pinned} - ["jbuilder" "build" "-p" name "-j" jobs] - ["jbuilder" "runtest" "-p" name] {with-test} -] -depends: [ - "ocaml" - "jbuilder" {>= "1.0+beta17"} - "base-unix" -] -synopsis: "Equivalent of the C preprocessor for OCaml programs" -url { - src: "https://github.com/mjambon/cppo/archive/v1.6.5.tar.gz" - checksum: "md5=1cd25741d31417995b0973fe0b6f6c82" -} diff --git a/esy.lock/opam/dune.2.7.1/opam b/esy.lock/opam/dune.2.7.1/opam deleted file mode 100644 index 3b175872c1..0000000000 --- a/esy.lock/opam/dune.2.7.1/opam +++ /dev/null @@ -1,56 +0,0 @@ -opam-version: "2.0" -synopsis: "Fast, portable, and opinionated build system" -description: """ - -dune is a build system that was designed to simplify the release of -Jane Street packages. It reads metadata from "dune" files following a -very simple s-expression syntax. - -dune is fast, has very low-overhead, and supports parallel builds on -all platforms. It has no system dependencies; all you need to build -dune or packages using dune is OCaml. You don't need make or bash -as long as the packages themselves don't use bash explicitly. - -dune supports multi-package development by simply dropping multiple -repositories into the same directory. - -It also supports multi-context builds, such as building against -several opam roots/switches simultaneously. This helps maintaining -packages across several versions of OCaml and gives cross-compilation -for free. -""" -maintainer: ["Jane Street Group, LLC "] -authors: ["Jane Street Group, LLC "] -license: "MIT" -homepage: "https://github.com/ocaml/dune" -doc: "https://dune.readthedocs.io/" -bug-reports: "https://github.com/ocaml/dune/issues" -conflicts: [ - "dune-configurator" {< "2.3.0"} - "odoc" {< "1.3.0"} - "dune-release" {< "1.3.0"} - "js_of_ocaml-compiler" {< "3.6.0"} - "jbuilder" {= "transition"} -] -dev-repo: "git+https://github.com/ocaml/dune.git" -build: [ - # opam 2 sets OPAM_SWITCH_PREFIX, so we don't need a hardcoded path - ["ocaml" "configure.ml" "--libdir" lib] {opam-version < "2"} - ["ocaml" "bootstrap.ml" "-j" jobs] - ["./dune.exe" "build" "-p" name "--profile" "dune-bootstrap" "-j" jobs] -] -depends: [ - # Please keep the lower bound in sync with .github/workflows/workflow.yml, - # dune-project and min_ocaml_version in bootstrap.ml - ("ocaml" {>= "4.08" & < "4.12"} | ("ocaml" {< "4.08~~"} & "ocamlfind-secondary")) - "base-unix" - "base-threads" -] -x-commit-hash: "5472766b2448308a7160dfd0fca1ec711e124a5c" -url { - src: "https://github.com/ocaml/dune/releases/download/2.7.1/dune-2.7.1.tbz" - checksum: [ - "sha256=c3528f2f8b3a2e3fe18e166fc823e6caeee8b7c78ade6b6fe4d2fa978070925d" - "sha512=2b4b311824471dac8196181d7c7267f96b1b73f35341b72019f169cf6d42a19254e90bdfba2d3ecb138ad318e2e2431dd0ec6c38d9efe1da382ec95f5d9e959b" - ] -} diff --git a/esy.lock/opam/easy-format.1.3.2/opam b/esy.lock/opam/easy-format.1.3.2/opam deleted file mode 100644 index 138d0fb23e..0000000000 --- a/esy.lock/opam/easy-format.1.3.2/opam +++ /dev/null @@ -1,46 +0,0 @@ -opam-version: "2.0" -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} - ["dune" "build" "-p" name "@doc"] {with-doc} -] -maintainer: ["martin@mjambon.com" "rudi.grinberg@gmail.com"] -authors: ["Martin Jambon"] -bug-reports: "https://github.com/mjambon/easy-format/issues" -homepage: "https://github.com/mjambon/easy-format" -doc: "https://mjambon.github.io/easy-format/" -license: "BSD-3-Clause" -dev-repo: "git+https://github.com/mjambon/easy-format.git" -synopsis: - "High-level and functional interface to the Format module of the OCaml standard library" -description: """ - -This module offers a high-level and functional interface to the Format module of -the OCaml standard library. It is a pretty-printing facility, i.e. it takes as -input some code represented as a tree and formats this code into the most -visually satisfying result, breaking and indenting lines of code where -appropriate. - -Input data must be first modelled and converted into a tree using 3 kinds of -nodes: - -* atoms -* lists -* labelled nodes - -Atoms represent any text that is guaranteed to be printed as-is. Lists can model -any sequence of items such as arrays of data or lists of definitions that are -labelled with something like "int main", "let x =" or "x:".""" -depends: [ - "dune" {>= "1.10"} - "ocaml" {>= "4.02.3"} -] -url { - src: - "https://github.com/mjambon/easy-format/releases/download/1.3.2/easy-format-1.3.2.tbz" - checksum: [ - "sha256=3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926" - "sha512=e39377a2ff020ceb9ac29e8515a89d9bdbc91dfcfa871c4e3baafa56753fac2896768e5d9822a050dc1e2ade43c8967afb69391a386c0a8ecd4e1f774e236135" - ] -} diff --git a/esy.lock/opam/fmt.0.8.9/opam b/esy.lock/opam/fmt.0.8.9/opam deleted file mode 100644 index 6751a891f6..0000000000 --- a/esy.lock/opam/fmt.0.8.9/opam +++ /dev/null @@ -1,44 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: [ "The fmt programmers" ] -homepage: "https://erratique.ch/software/fmt" -doc: "https://erratique.ch/software/fmt" -dev-repo: "git+https://erratique.ch/repos/fmt.git" -bug-reports: "https://github.com/dbuenzli/fmt/issues" -tags: [ "string" "format" "pretty-print" "org:erratique" ] -license: "ISC" -depends: [ - "ocaml" {>= "4.05.0"} - "ocamlfind" {build} - "ocamlbuild" {build} - "topkg" {build & >= "0.9.0"} - # Can be removed once ocaml >= 4.07 - "seq" - "stdlib-shims" -] -depopts: [ "base-unix" "cmdliner" ] -conflicts: [ "cmdliner" {< "0.9.8"} ] -build: [[ - "ocaml" "pkg/pkg.ml" "build" - "--dev-pkg" "%{pinned}%" - "--with-base-unix" "%{base-unix:installed}%" - "--with-cmdliner" "%{cmdliner:installed}%" ]] - -synopsis: """OCaml Format pretty-printer combinators""" -description: """\ - -Fmt exposes combinators to devise `Format` pretty-printing functions. - -Fmt depends only on the OCaml standard library. The optional `Fmt_tty` -library that allows to setup formatters for terminal color output -depends on the Unix library. The optional `Fmt_cli` library that -provides command line support for Fmt depends on [`Cmdliner`][cmdliner]. - -Fmt is distributed under the ISC license. - -[cmdliner]: http://erratique.ch/software/cmdliner -""" -url { -archive: "https://erratique.ch/software/fmt/releases/fmt-0.8.9.tbz" -checksum: "4001b51cde90ea4fd99a4a5033ecf411" -} diff --git a/esy.lock/opam/fpath.0.7.2/opam b/esy.lock/opam/fpath.0.7.2/opam deleted file mode 100644 index f90f49ff02..0000000000 --- a/esy.lock/opam/fpath.0.7.2/opam +++ /dev/null @@ -1,34 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: ["Daniel Bünzli "] -homepage: "http://erratique.ch/software/fpath" -doc: "http://erratique.ch/software/fpath/doc" -dev-repo: "git+http://erratique.ch/repos/fpath.git" -bug-reports: "https://github.com/dbuenzli/fpath/issues" -tags: [ "file" "system" "path" "org:erratique" ] -license: "ISC" -depends: [ - "ocaml" {>= "4.01.0" & < "4.12"} - "ocamlfind" {build} - "ocamlbuild" {build} - "topkg" {build & >= "0.9.0"} - "result" - "astring" -] -build: [[ - "ocaml" "pkg/pkg.ml" "build" - "--dev-pkg" "%{pinned}%" ]] -synopsis: "File system paths for OCaml" -description: """ -Fpath is an OCaml module for handling file system paths with POSIX or -Windows conventions. Fpath processes paths without accessing the file -system and is independent from any system library. - -Fpath depends on [Astring][astring] and is distributed under the ISC -license. - -[astring]: http://erratique.ch/software/astring""" -url { - src: "http://erratique.ch/software/fpath/releases/fpath-0.7.2.tbz" - checksum: "md5=52c7ecb0bf180088336f3c645875fa41" -} diff --git a/esy.lock/opam/jbuilder.1.0+beta20.2/opam b/esy.lock/opam/jbuilder.1.0+beta20.2/opam deleted file mode 100644 index 2e411c9e17..0000000000 --- a/esy.lock/opam/jbuilder.1.0+beta20.2/opam +++ /dev/null @@ -1,39 +0,0 @@ -opam-version: "2.0" -maintainer: "opensource@janestreet.com" -authors: ["Jane Street Group, LLC "] -homepage: "https://github.com/ocaml/dune" -bug-reports: "https://github.com/ocaml/dune/issues" -dev-repo: "git+https://github.com/ocaml/dune.git" -license: "Apache-2.0" -build: [ - ["ocaml" "configure.ml" "--libdir" lib] - ["ocaml" "bootstrap.ml"] - ["./boot.exe" "--subst"] {pinned} - ["./boot.exe" "-j" jobs] -] -synopsis: "Fast, portable and opinionated build system" -description: """ -jbuilder is a build system that was designed to simplify the release -of Jane Street packages. It reads metadata from "jbuild" files -following a very simple s-expression syntax. - -jbuilder is fast, it has very low-overhead and support parallel builds -on all platforms. It has no system dependencies, all you need to build -jbuilder and packages using jbuilder is OCaml. You don't need or make -or bash as long as the packages themselves don't use bash explicitely. - -jbuilder supports multi-package development by simply dropping multiple -repositories into the same directory. - -It also supports multi-context builds, such as building against -several opam roots/switches simultaneously. This helps maintaining -packages across several versions of OCaml and gives cross-compilation -for free.""" -depends: [ - "ocaml" {>= "4.02.3"} -] -url { - src: - "https://github.com/ocaml/dune/releases/download/1.0%2Bbeta20.2/jbuilder-1.0+beta20.2.tbz" - checksum: "md5=fbe8c3b1facb206cac3fb8932b5dd5d9" -} diff --git a/esy.lock/opam/lambdasoup.0.7.1/opam b/esy.lock/opam/lambdasoup.0.7.1/opam deleted file mode 100644 index 3dd3328236..0000000000 --- a/esy.lock/opam/lambdasoup.0.7.1/opam +++ /dev/null @@ -1,46 +0,0 @@ -opam-version: "2.0" - -synopsis: "Easy functional HTML scraping and manipulation with CSS selectors" - -version: "0.7.1" -license: "MIT" -homepage: "https://github.com/aantron/lambdasoup" -doc: "https://aantron.github.io/lambdasoup" -bug-reports: "https://github.com/aantron/lambdasoup/issues" - -authors: "Anton Bachin " -maintainer: "Anton Bachin " -dev-repo: "git+https://github.com/aantron/lambdasoup.git" - -depends: [ - # As a consequence of depending on Dune, Lambda Soup requires OCaml 4.02.3. - "dune" - "markup" {>= "0.7.1"} - "ocaml" {>= "4.02.0"} - - "bisect_ppx" {dev & >= "2.0.0"} - "ounit" {with-test} -] - -build: [ - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} -] - -description: """ -Lambda Soup is an HTML scraping library inspired by Python's Beautiful Soup. It -provides lazy traversals from HTML nodes to their parents, children, siblings, -etc., and to nodes matching CSS selectors. The traversals can be manipulated -using standard functional combinators such as fold, filter, and map. - -The DOM tree is mutable. You can use Lambda Soup for automatic HTML rewriting in -scripts. Lambda Soup rewrites its own ocamldoc page this way. - -A major goal of Lambda Soup is to be easy to use, including in interactive -sessions, and to have a minimal learning curve. It is a very simple library. -""" - -url { - src: "https://github.com/aantron/lambdasoup/archive/0.7.1.tar.gz" - checksum: "md5=da9884ec354960d0c76e4bb834042fb8" -} diff --git a/esy.lock/opam/merlin.3.3.9/opam b/esy.lock/opam/merlin.3.3.9/opam deleted file mode 100644 index a4fab62051..0000000000 --- a/esy.lock/opam/merlin.3.3.9/opam +++ /dev/null @@ -1,71 +0,0 @@ -opam-version: "2.0" -maintainer: "defree@gmail.com" -authors: "The Merlin team" -homepage: "https://github.com/ocaml/merlin" -bug-reports: "https://github.com/ocaml/merlin/issues" -dev-repo: "git+https://github.com/ocaml/merlin.git" -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" "1"] {with-test & os != "macos" & ocaml:version >= "4.03"} -] -depends: [ - "ocaml" {>= "4.02.3" & < "4.12"} - "dune" {>= "1.8.0"} - "ocamlfind" {>= "1.5.2"} - "yojson" {>= "1.6.0"} - "mdx" {with-test & >= "1.3.0"} - "conf-jq" {with-test} -] -synopsis: - "Editor helper, provides completion, typing and source browsing in Vim and Emacs" -description: - "Merlin is an assistant for editing OCaml code. It aims to provide the features available in modern IDEs: error reporting, auto completion, source browsing and much more." -post-messages: [ - "merlin installed. - -Quick setup for VIM -------------------- -Append this to your .vimrc to add merlin to vim's runtime-path: - let g:opamshare = substitute(system('opam config var share'),'\\n$','','''') - execute \"set rtp+=\" . g:opamshare . \"/merlin/vim\" - -Also run the following line in vim to index the documentation: - :execute \"helptags \" . g:opamshare . \"/merlin/vim/doc\" - -Quick setup for EMACS -------------------- -Add opam emacs directory to your load-path by appending this to your .emacs: - (let ((opam-share (ignore-errors (car (process-lines \"opam\" \"config\" \"var\" \"share\"))))) - (when (and opam-share (file-directory-p opam-share)) - ;; Register Merlin - (add-to-list 'load-path (expand-file-name \"emacs/site-lisp\" opam-share)) - (autoload 'merlin-mode \"merlin\" nil t nil) - ;; Automatically start it in OCaml buffers - (add-hook 'tuareg-mode-hook 'merlin-mode t) - (add-hook 'caml-mode-hook 'merlin-mode t) - ;; Use opam switch to lookup ocamlmerlin binary - (setq merlin-command 'opam))) - -Take a look at https://github.com/ocaml/merlin for more information - -Quick setup with opam-user-setup --------------------------------- - -Opam-user-setup support Merlin. - - $ opam user-setup install - -should take care of basic setup. -See https://github.com/OCamlPro/opam-user-setup -" - {success & !user-setup:installed} -] -url { - src: - "https://github.com/ocaml/merlin/releases/download/v3.3.9/merlin-v3.3.9.tbz" - checksum: [ - "sha256=a3170f1a993d810d552a21a4baa328dff0fe9ac9bf4b8aa6ba3f179a9240cf02" - "sha512=63034766c7dc7de21e3ce8624ed760a9d76b79cacbee8c17ecef2c62df00438ebd84f43a0d558cf8d9c4a800dac99e4b2f25c324f363a590cc294e46420f46aa" - ] -} diff --git a/esy.lock/opam/ocaml-migrate-parsetree.1.8.0/opam b/esy.lock/opam/ocaml-migrate-parsetree.1.8.0/opam deleted file mode 100644 index 84f1fae4a4..0000000000 --- a/esy.lock/opam/ocaml-migrate-parsetree.1.8.0/opam +++ /dev/null @@ -1,38 +0,0 @@ -opam-version: "2.0" -maintainer: "frederic.bour@lakaban.net" -authors: [ - "Frédéric Bour " - "Jérémie Dimino " -] -license: "LGPL-2.1 with OCaml linking exception" -homepage: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree" -bug-reports: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/issues" -dev-repo: "git+https://github.com/ocaml-ppx/ocaml-migrate-parsetree.git" -doc: "https://ocaml-ppx.github.io/ocaml-migrate-parsetree/" -tags: [ "syntax" "org:ocamllabs" ] -build: [ - ["dune" "build" "-p" name "-j" jobs] -] -depends: [ - "result" - "ppx_derivers" - "dune" {>= "1.9.0"} - "ocaml" {>= "4.02.3" & < "4.13"} -] -synopsis: "Convert OCaml parsetrees between different versions" -description: """ -Convert OCaml parsetrees between different versions - -This library converts parsetrees, outcometree and ast mappers between -different OCaml versions. High-level functions help making PPX -rewriters independent of a compiler version. -""" -x-commit-hash: "1d72648812bb235d1576f483cacdf546e25c03d8" -url { - src: - "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v1.8.0/ocaml-migrate-parsetree-v1.8.0.tbz" - checksum: [ - "sha256=b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5" - "sha512=c14ffacbba9fda34243b3e8310ce49414415b530bbd982eaa6c1891517c5a9a6a35887afa7d6f15f7f94e225a7f15cc25417fd3337e685d4a7d6ee160e50e66e" - ] -} diff --git a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/0001-Don-t-build-manpages-for-stdlib-docs.patch b/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/0001-Don-t-build-manpages-for-stdlib-docs.patch deleted file mode 100644 index cda19dd2d7..0000000000 --- a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/0001-Don-t-build-manpages-for-stdlib-docs.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0cf3c6ad7ce2a2b2806faceccfb0a9321da5e22a Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Fri, 26 Jul 2019 12:12:19 +0100 -Subject: [PATCH] Don't build manpages for stdlib docs ---- - ocamldoc/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile -index b109815071..e31e441f61 100644 ---- a/ocamldoc/Makefile -+++ b/ocamldoc/Makefile -@@ -170,7 +170,7 @@ LIBCMIFILES = $(LIBCMOFILES:.cmo=.cmi) - - - .PHONY: all --all: lib exe generators manpages -+all: lib exe generators - - manpages: generators - --- -2.20.1 - diff --git a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/0001-Fix-failure-to-install-tools-links.patch b/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/0001-Fix-failure-to-install-tools-links.patch deleted file mode 100644 index 41f5f77048..0000000000 --- a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/0001-Fix-failure-to-install-tools-links.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 705739fa54260b7a0e6cbba0b5a99e52c79f9c09 Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Tue, 6 Aug 2019 09:23:06 +0100 -Subject: [PATCH] Fix failure to install tools links - -In --disable-installing-bytecode-programs mode, the .opt version of the -tools is installed, but the symlink for the tool itself is not created. ---- - tools/Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tools/Makefile b/tools/Makefile -index 530dd37f34..1b3014a3ab 100644 ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -197,6 +197,7 @@ else - do \ - if test -f "$$i".opt; then \ - $(INSTALL_PROG) "$$i.opt" "$(INSTALL_BINDIR)/$$i.opt$(EXE)"; \ -+ (cd "$(INSTALL_BINDIR)/" && $(LN) "$$i.opt$(EXE)" "$$i$(EXE)"); \ - fi; \ - done - endif --- -2.20.1 - diff --git a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/fix-gcc10.patch b/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/fix-gcc10.patch deleted file mode 100644 index e37b5e883c..0000000000 --- a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/files/fix-gcc10.patch +++ /dev/null @@ -1,34 +0,0 @@ -commit 3f10a16153308f967149917585d2bc0b9c06492c -Author: Anil Madhavapeddy -Date: Sun Jun 21 18:40:27 2020 +0100 - - Add `-fcommon` unconditionally to CFLAGS to fix gcc10 build - - Signed-off-by: Anil Madhavapeddy - -diff --git a/configure b/configure -index 9a78a4554..0c54b560b 100755 ---- a/configure -+++ b/configure -@@ -12424,7 +12424,7 @@ $as_echo "$as_me: WARNING: Consider using GCC version 4.2 or above." >&2;}; - -fno-builtin-memcmp"; - internal_cflags="$gcc_warnings" ;; #( - gcc-*) : -- common_cflags="-O2 -fno-strict-aliasing -fwrapv"; -+ common_cflags="-O2 -fno-strict-aliasing -fwrapv -fcommon"; - internal_cflags="$gcc_warnings" ;; #( - msvc-*) : - common_cflags="-nologo -O2 -Gy- -MD" -diff --git a/configure.ac b/configure.ac -index f5d8a2687..775e0e2db 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -540,7 +540,7 @@ AS_CASE([$host], - -fno-builtin-memcmp"; - internal_cflags="$gcc_warnings"], - [gcc-*], -- [common_cflags="-O2 -fno-strict-aliasing -fwrapv"; -+ [common_cflags="-O2 -fno-strict-aliasing -fwrapv -fcommon"; - internal_cflags="$gcc_warnings"], - [msvc-*], - [common_cflags="-nologo -O2 -Gy- -MD" diff --git a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/opam b/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/opam deleted file mode 100644 index 905f9b3dde..0000000000 --- a/esy.lock/opam/ocaml-secondary-compiler.4.08.1-1/opam +++ /dev/null @@ -1,51 +0,0 @@ -opam-version: "2.0" -synopsis: "OCaml 4.08.1 Secondary Switch Compiler" -maintainer: "platform@lists.ocaml.org" -authors: "Xavier Leroy and many contributors" -homepage: "https://ocaml.org" -bug-reports: "https://github.com/ocaml/ocaml/issues" -dev-repo: "git://github.com/ocaml/ocaml" -depends: "ocaml" {< "4.08.0" | >= "4.09~"} -build: [ - [ - "./configure" - "--prefix=%{_:share}%" - "--libdir=%{_:share}%/lib" - "--disable-debugger" - "--disable-installing-bytecode-programs" - "--disable-debug-runtime" - "--disable-instrumented-runtime" - "--disable-graph-lib" - "CC=cc" {os = "openbsd" | os = "freebsd" | os = "macos"} - "ASPP=cc -c" {os = "openbsd" | os = "freebsd" | os = "macos"} - ] - [make "-j%{jobs}%" {os != "cygwin"} "world.opt"] -] -install: [make "install"] -url { - src: "https://github.com/ocaml/ocaml/archive/4.08.1.tar.gz" - checksum: "md5=723b6bfe8cf5abcbccc6911143f71055" -} -extra-files: [ - ["0001-Don-t-build-manpages-for-stdlib-docs.patch" "md5=6caa580fe6031c109d2dc96b19bd40cd"] - ["0001-Fix-failure-to-install-tools-links.patch" "md5=e973762c0b3d62b0b25a26468086fae3"] - ["fix-gcc10.patch" "md5=17ecd696a8f5647a4c543280599f6974"] -] -patches: [ - "0001-Don-t-build-manpages-for-stdlib-docs.patch" - "0001-Fix-failure-to-install-tools-links.patch" - "fix-gcc10.patch" -] - -post-messages: [ - "A failure in the middle of the build may be caused by build parallelism - (enabled by default). - Please file a bug report at https://github.com/ocaml/ocaml/issues" - {failure & jobs > 1 & os != "cygwin"} - "You can try installing again including --jobs=1 - to force a sequential build instead." - {failure & jobs > 1 & os != "cygwin" & opam-version >= "2.0.5"} -] -description: "Installs an additional compiler to the opam switch in -%{_:share}%/ocaml-secondary-compiler which can be accessed using -`ocamlfind -toolchain secondary`." diff --git a/esy.lock/opam/ocamlbuild.0.14.0/opam b/esy.lock/opam/ocamlbuild.0.14.0/opam deleted file mode 100644 index 8deabeedfb..0000000000 --- a/esy.lock/opam/ocamlbuild.0.14.0/opam +++ /dev/null @@ -1,36 +0,0 @@ -opam-version: "2.0" -maintainer: "Gabriel Scherer " -authors: ["Nicolas Pouillard" "Berke Durak"] -homepage: "https://github.com/ocaml/ocamlbuild/" -bug-reports: "https://github.com/ocaml/ocamlbuild/issues" -license: "LGPL-2.1-only with OCaml-LGPL-linking-exception" -doc: "https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc" -dev-repo: "git+https://github.com/ocaml/ocamlbuild.git" -build: [ - [ - make - "-f" - "configure.make" - "all" - "OCAMLBUILD_PREFIX=%{prefix}%" - "OCAMLBUILD_BINDIR=%{bin}%" - "OCAMLBUILD_LIBDIR=%{lib}%" - "OCAMLBUILD_MANDIR=%{man}%" - "OCAML_NATIVE=%{ocaml:native}%" - "OCAML_NATIVE_TOOLS=%{ocaml:native}%" - ] - [make "check-if-preinstalled" "all" "opam-install"] -] -conflicts: [ - "base-ocamlbuild" - "ocamlfind" {< "1.6.2"} -] -synopsis: - "OCamlbuild is a build system with builtin rules to easily build most OCaml projects." -depends: [ - "ocaml" {>= "4.03"} -] -url { - src: "https://github.com/ocaml/ocamlbuild/archive/0.14.0.tar.gz" - checksum: "sha256=87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78" -} diff --git a/esy.lock/opam/ocamlfind-secondary.1.8.1/files/META.in b/esy.lock/opam/ocamlfind-secondary.1.8.1/files/META.in deleted file mode 100644 index 12e3ee6619..0000000000 --- a/esy.lock/opam/ocamlfind-secondary.1.8.1/files/META.in +++ /dev/null @@ -1,3 +0,0 @@ -description = "OCaml Secondary Compiler" -version = "%{ocaml-secondary-compiler:version}%" -directory = "%{ocaml-secondary-compiler:share}%/bin" diff --git a/esy.lock/opam/ocamlfind-secondary.1.8.1/files/ocaml-secondary-compiler.conf.in b/esy.lock/opam/ocamlfind-secondary.1.8.1/files/ocaml-secondary-compiler.conf.in deleted file mode 100644 index d13023c9f6..0000000000 --- a/esy.lock/opam/ocamlfind-secondary.1.8.1/files/ocaml-secondary-compiler.conf.in +++ /dev/null @@ -1,10 +0,0 @@ -path(secondary) = "%{ocaml-secondary-compiler:share}%/lib" -destdir(secondary) = "%{ocaml-secondary-compiler:share}%/lib" -stdlib(secondary) = "%{ocaml-secondary-compiler:share}%/lib" -ocamlc(secondary) = "%{ocaml-secondary-compiler:share}%/bin/ocamlc" -ocamlopt(secondary) = "%{ocaml-secondary-compiler:share}%/bin/ocamlopt" -ocamlcp(secondary) = "%{ocaml-secondary-compiler:share}%/bin/ocamlcp" -ocamlmklib(secondary) = "%{ocaml-secondary-compiler:share}%/bin/ocamlmklib" -ocamlmktop(secondary) = "%{ocaml-secondary-compiler:share}%/bin/ocamlmktop" -ocamldoc(secondary) = "%{ocaml-secondary-compiler:share}%/bin/ocamldoc" -ocamldep(secondary) = "%{ocaml-secondary-compiler:share}%/bin/ocamldep" diff --git a/esy.lock/opam/ocamlfind-secondary.1.8.1/opam b/esy.lock/opam/ocamlfind-secondary.1.8.1/opam deleted file mode 100644 index acdb576452..0000000000 --- a/esy.lock/opam/ocamlfind-secondary.1.8.1/opam +++ /dev/null @@ -1,32 +0,0 @@ -opam-version: "2.0" -maintainer: "David Allsopp " -homepage: "https://github.com/ocaml/opam-repository" -bug-reports: "https://github.com/ocaml/opam-repository/issues" -build: ["./configure" "-sitelib" "%{ocaml-secondary-compiler:share}%/lib" "-no-camlp4"] -install: [ - [make "install-meta"] - ["mkdir" "-p" "%{lib}%/findlib.conf.d/"] - ["cp" "ocaml-secondary-compiler.conf" "%{lib}%/findlib.conf.d/"] - ["mkdir" "-p" "%{ocaml-secondary-compiler:share}%/lib/ocaml"] - ["cp" "META" "%{ocaml-secondary-compiler:share}%/lib/ocaml"] -] -depends: [ - "ocaml-secondary-compiler" - "ocamlfind" {= "1.8.1"} -] -synopsis: "ocamlfind support for ocaml-secondary-compiler" -description: """ -Exposes the compiler built by the ocaml-secondary-compielr package via --toolchain secondary. A virtual package called ocaml is also installed to -locate the binary directory via `ocamlfind -toolchain secondary query ocaml`.""" -authors: ["Gerd Stolpmann " "David Allsopp "] -substs: ["META" "ocaml-secondary-compiler.conf"] -extra-files: [ - ["META.in" "md5=8c6ea8a0158a33ed87e6c38a7d686d49"] - ["ocaml-secondary-compiler.conf.in" "md5=367a7bb68e2e1e65a31356421ddc809c"] -] -url { - src: "http://download.camlcity.org/download/findlib-1.8.1.tar.gz" - checksum: "md5=18ca650982c15536616dea0e422cbd8c" - mirrors: "http://download2.camlcity.org/download/findlib-1.8.1.tar.gz" -} diff --git a/esy.lock/opam/ocamlfind.1.8.1/files/ocaml-stub b/esy.lock/opam/ocamlfind.1.8.1/files/ocaml-stub deleted file mode 100644 index e5ad9907e8..0000000000 --- a/esy.lock/opam/ocamlfind.1.8.1/files/ocaml-stub +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -BINDIR=$(dirname "$(command -v ocamlc)") -"$BINDIR/ocaml" -I "$OCAML_TOPLEVEL_PATH" "$@" diff --git a/esy.lock/opam/ocamlfind.1.8.1/files/ocamlfind.install b/esy.lock/opam/ocamlfind.1.8.1/files/ocamlfind.install deleted file mode 100644 index 295c62545f..0000000000 --- a/esy.lock/opam/ocamlfind.1.8.1/files/ocamlfind.install +++ /dev/null @@ -1,6 +0,0 @@ -bin: [ - "src/findlib/ocamlfind" {"ocamlfind"} - "?src/findlib/ocamlfind_opt" {"ocamlfind"} - "?tools/safe_camlp4" -] -toplevel: ["src/findlib/topfind"] diff --git a/esy.lock/opam/ocamlfind.1.8.1/opam b/esy.lock/opam/ocamlfind.1.8.1/opam deleted file mode 100644 index 04cbc6ccaf..0000000000 --- a/esy.lock/opam/ocamlfind.1.8.1/opam +++ /dev/null @@ -1,64 +0,0 @@ -opam-version: "2.0" -synopsis: "A library manager for OCaml" -maintainer: "Thomas Gazagnaire " -authors: "Gerd Stolpmann " -homepage: "http://projects.camlcity.org/projects/findlib.html" -bug-reports: "https://gitlab.camlcity.org/gerd/lib-findlib/issues" -dev-repo: "git+https://gitlab.camlcity.org/gerd/lib-findlib.git" -description: """ -Findlib is a library manager for OCaml. It provides a convention how -to store libraries, and a file format ("META") to describe the -properties of libraries. There is also a tool (ocamlfind) for -interpreting the META files, so that it is very easy to use libraries -in programs and scripts. -""" -build: [ - [ - "./configure" - "-bindir" - bin - "-sitelib" - lib - "-mandir" - man - "-config" - "%{lib}%/findlib.conf" - "-no-custom" - "-no-camlp4" {!ocaml:preinstalled & ocaml:version >= "4.02.0"} - "-no-topfind" {ocaml:preinstalled} - ] - [make "all"] - [make "opt"] {ocaml:native} -] -install: [ - [ - "./configure" - "-bindir" - bin - "-sitelib" - lib - "-mandir" - man - "-config" - "%{lib}%/findlib.conf" - "-no-custom" - "-no-camlp4" {!ocaml:preinstalled & ocaml:version >= "4.02.0"} - "-no-topfind" {ocaml:preinstalled} - ] - [make "install"] - ["install" "-m" "0755" "ocaml-stub" "%{bin}%/ocaml"] {ocaml:preinstalled} -] -depends: [ - "ocaml" {>= "4.00.0" & < "4.13"} - "conf-m4" {build} -] -extra-files: [ - ["ocamlfind.install" "md5=06f2c282ab52d93aa6adeeadd82a2543"] - ["ocaml-stub" "md5=181f259c9e0bad9ef523e7d4abfdf87a"] -] -url { - src: "http://download.camlcity.org/download/findlib-1.8.1.tar.gz" - checksum: "md5=18ca650982c15536616dea0e422cbd8c" - mirrors: "http://download2.camlcity.org/download/findlib-1.8.1.tar.gz" -} -depopts: ["graphics"] diff --git a/esy.lock/opam/ppx_derivers.1.2.1/opam b/esy.lock/opam/ppx_derivers.1.2.1/opam deleted file mode 100644 index 3d10814e04..0000000000 --- a/esy.lock/opam/ppx_derivers.1.2.1/opam +++ /dev/null @@ -1,23 +0,0 @@ -opam-version: "2.0" -maintainer: "jeremie@dimino.org" -authors: ["Jérémie Dimino"] -license: "BSD-3-Clause" -homepage: "https://github.com/ocaml-ppx/ppx_derivers" -bug-reports: "https://github.com/ocaml-ppx/ppx_derivers/issues" -dev-repo: "git://github.com/ocaml-ppx/ppx_derivers.git" -build: [ - ["dune" "build" "-p" name "-j" jobs] -] -depends: [ - "ocaml" - "dune" -] -synopsis: "Shared [@@deriving] plugin registry" -description: """ -Ppx_derivers is a tiny package whose sole purpose is to allow -ppx_deriving and ppx_type_conv to inter-operate gracefully when linked -as part of the same ocaml-migrate-parsetree driver.""" -url { - src: "https://github.com/ocaml-ppx/ppx_derivers/archive/1.2.1.tar.gz" - checksum: "md5=5dc2bf130c1db3c731fe0fffc5648b41" -} diff --git a/esy.lock/opam/ppx_tools_versioned.5.4.0/opam b/esy.lock/opam/ppx_tools_versioned.5.4.0/opam deleted file mode 100644 index 9305dd1997..0000000000 --- a/esy.lock/opam/ppx_tools_versioned.5.4.0/opam +++ /dev/null @@ -1,27 +0,0 @@ -opam-version: "2.0" -version: "5.4.0" -maintainer: "frederic.bour@lakaban.net" -authors: [ - "Frédéric Bour " - "Alain Frisch " -] -license: "MIT" -homepage: "https://github.com/ocaml-ppx/ppx_tools_versioned" -bug-reports: "https://github.com/ocaml-ppx/ppx_tools_versioned/issues" -dev-repo: "git://github.com/ocaml-ppx/ppx_tools_versioned.git" -tags: [ "syntax" ] -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} -] -depends: [ - "ocaml" {>= "4.02.0"} - "dune" {>= "1.0"} - "ocaml-migrate-parsetree" {>= "1.7.0" & < "2.0.0"} -] -synopsis: "A variant of ppx_tools based on ocaml-migrate-parsetree" -url { - src: "https://github.com/ocaml-ppx/ppx_tools_versioned/archive/5.4.0.tar.gz" - checksum: "md5=3e809a11cae99f57c051d3d0100311f6" -} diff --git a/esy.lock/opam/re.1.9.0/opam b/esy.lock/opam/re.1.9.0/opam deleted file mode 100644 index f7987544d1..0000000000 --- a/esy.lock/opam/re.1.9.0/opam +++ /dev/null @@ -1,42 +0,0 @@ -opam-version: "2.0" - -maintainer: "rudi.grinberg@gmail.com" -authors: [ - "Jerome Vouillon" - "Thomas Gazagnaire" - "Anil Madhavapeddy" - "Rudi Grinberg" - "Gabriel Radanne" -] -license: "LGPL-2.0-only with OCaml-LGPL-linking-exception" -homepage: "https://github.com/ocaml/ocaml-re" -bug-reports: "https://github.com/ocaml/ocaml-re/issues" -dev-repo: "git+https://github.com/ocaml/ocaml-re.git" - -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} -] - -depends: [ - "ocaml" {>= "4.02"} - "dune" - "ounit" {with-test} - "seq" -] - -synopsis: "RE is a regular expression library for OCaml" -description: """ -Pure OCaml regular expressions with: -* Perl-style regular expressions (module Re.Perl) -* Posix extended regular expressions (module Re.Posix) -* Emacs-style regular expressions (module Re.Emacs) -* Shell-style file globbing (module Re.Glob) -* Compatibility layer for OCaml's built-in Str module (module Re.Str) -""" -url { - src: - "https://github.com/ocaml/ocaml-re/releases/download/1.9.0/re-1.9.0.tbz" - checksum: "md5=bddaed4f386a22cace7850c9c7dac296" -} diff --git a/esy.lock/opam/result.1.4/opam b/esy.lock/opam/result.1.4/opam deleted file mode 100644 index b44aeead8b..0000000000 --- a/esy.lock/opam/result.1.4/opam +++ /dev/null @@ -1,22 +0,0 @@ -opam-version: "2.0" -maintainer: "opensource@janestreet.com" -authors: ["Jane Street Group, LLC "] -homepage: "https://github.com/janestreet/result" -dev-repo: "git+https://github.com/janestreet/result.git" -bug-reports: "https://github.com/janestreet/result/issues" -license: "BSD-3-Clause" -build: [["dune" "build" "-p" name "-j" jobs]] -depends: [ - "ocaml" - "dune" {>= "1.0"} -] -synopsis: "Compatibility Result module" -description: """ -Projects that want to use the new result type defined in OCaml >= 4.03 -while staying compatible with older version of OCaml should use the -Result module defined in this library.""" -url { - src: - "https://github.com/janestreet/result/archive/1.4.tar.gz" - checksum: "md5=d3162dbc501a2af65c8c71e0866541da" -} diff --git a/esy.lock/opam/seq.0.2.2/opam b/esy.lock/opam/seq.0.2.2/opam deleted file mode 100644 index 5ed516543f..0000000000 --- a/esy.lock/opam/seq.0.2.2/opam +++ /dev/null @@ -1,24 +0,0 @@ -opam-version: "2.0" -synopsis: - "Compatibility package for OCaml's standard iterator type starting from 4.07" -maintainer: "simon.cruanes.2007@m4x.org" -license: "LGPL2.1" -build: [ - ["dune" "build" "-p" name "-j" jobs] -] -depends: [ - "dune" {>= "1.1.0"} - "ocaml" -] -tags: [ "iterator" "seq" "pure" "list" "compatibility" "cascade" ] -homepage: "https://github.com/c-cube/seq/" -bug-reports: "https://github.com/c-cube/seq/issues" -dev-repo: "git+https://github.com/c-cube/seq.git" -authors: "Simon Cruanes" -url { - src: "https://github.com/c-cube/seq/archive/0.2.2.tar.gz" - checksum: [ - "md5=9033e02283aa3bde9f97f24e632902e3" - "sha512=cab0eb4cb6d9788b7cbd7acbefefc15689d706c97ff7f75dd97faf3c21e466af4d0ff110541a24729db587e7172b1a30a3c2967e17ec2e49cbd923360052c07c" - ] -} diff --git a/esy.lock/opam/sexplib0.v0.14.0/opam b/esy.lock/opam/sexplib0.v0.14.0/opam deleted file mode 100644 index f7afcef364..0000000000 --- a/esy.lock/opam/sexplib0.v0.14.0/opam +++ /dev/null @@ -1,26 +0,0 @@ -opam-version: "2.0" -maintainer: "opensource@janestreet.com" -authors: ["Jane Street Group, LLC "] -homepage: "https://github.com/janestreet/sexplib0" -bug-reports: "https://github.com/janestreet/sexplib0/issues" -dev-repo: "git+https://github.com/janestreet/sexplib0.git" -doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/sexplib0/index.html" -license: "MIT" -build: [ - ["dune" "build" "-p" name "-j" jobs] -] -depends: [ - "ocaml" {>= "4.04.2"} - "dune" {>= "2.0.0"} -] -synopsis: "Library containing the definition of S-expressions and some base converters" -description: " -Part of Jane Street's Core library -The Core suite of libraries is an industrial strength alternative to -OCaml's standard library that was developed by Jane Street, the -largest industrial user of OCaml. -" -url { - src: "https://ocaml.janestreet.com/ocaml-core/v0.14/files/sexplib0-v0.14.0.tar.gz" - checksum: "md5=37aff0af8f8f6f759249475684aebdc4" -} diff --git a/esy.lock/opam/stdlib-shims.0.3.0/opam b/esy.lock/opam/stdlib-shims.0.3.0/opam deleted file mode 100644 index d657e04368..0000000000 --- a/esy.lock/opam/stdlib-shims.0.3.0/opam +++ /dev/null @@ -1,31 +0,0 @@ -opam-version: "2.0" -maintainer: "The stdlib-shims programmers" -authors: "The stdlib-shims programmers" -homepage: "https://github.com/ocaml/stdlib-shims" -doc: "https://ocaml.github.io/stdlib-shims/" -dev-repo: "git+https://github.com/ocaml/stdlib-shims.git" -bug-reports: "https://github.com/ocaml/stdlib-shims/issues" -tags: ["stdlib" "compatibility" "org:ocaml"] -license: ["typeof OCaml system"] -depends: [ - "dune" - "ocaml" {>= "4.02.3"} -] -build: [ "dune" "build" "-p" name "-j" jobs ] -synopsis: "Backport some of the new stdlib features to older compiler" -description: """ -Backport some of the new stdlib features to older compiler, -such as the Stdlib module. - -This allows projects that require compatibility with older compiler to -use these new features in their code. -""" -x-commit-hash: "fb6815e5d745f07fd567c11671149de6ef2e74c8" -url { - src: - "https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz" - checksum: [ - "sha256=babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a" - "sha512=1151d7edc8923516e9a36995a3f8938d323aaade759ad349ed15d6d8501db61ffbe63277e97c4d86149cf371306ac23df0f581ec7e02611f58335126e1870980" - ] -} diff --git a/esy.lock/opam/topkg.1.0.3/opam b/esy.lock/opam/topkg.1.0.3/opam deleted file mode 100644 index 6e073a114b..0000000000 --- a/esy.lock/opam/topkg.1.0.3/opam +++ /dev/null @@ -1,48 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: ["Daniel Bünzli "] -homepage: "http://erratique.ch/software/topkg" -doc: "http://erratique.ch/software/topkg/doc" -license: "ISC" -dev-repo: "git+http://erratique.ch/repos/topkg.git" -bug-reports: "https://github.com/dbuenzli/topkg/issues" -tags: ["packaging" "ocamlbuild" "org:erratique"] -depends: [ - "ocaml" {>= "4.03.0"} - "ocamlfind" {build & >= "1.6.1"} - "ocamlbuild" ] -build: [[ - "ocaml" "pkg/pkg.ml" "build" - "--pkg-name" name - "--dev-pkg" "%{pinned}%" ]] -synopsis: """The transitory OCaml software packager""" -description: """\ - -Topkg is a packager for distributing OCaml software. It provides an -API to describe the files a package installs in a given build -configuration and to specify information about the package's -distribution, creation and publication procedures. - -The optional topkg-care package provides the `topkg` command line tool -which helps with various aspects of a package's life cycle: creating -and linting a distribution, releasing it on the WWW, publish its -documentation, add it to the OCaml opam repository, etc. - -Topkg is distributed under the ISC license and has **no** -dependencies. This is what your packages will need as a *build* -dependency. - -Topkg-care is distributed under the ISC license it depends on -[fmt][fmt], [logs][logs], [bos][bos], [cmdliner][cmdliner], -[webbrowser][webbrowser] and `opam-format`. - -[fmt]: http://erratique.ch/software/fmt -[logs]: http://erratique.ch/software/logs -[bos]: http://erratique.ch/software/bos -[cmdliner]: http://erratique.ch/software/cmdliner -[webbrowser]: http://erratique.ch/software/webbrowser -""" -url { -archive: "http://erratique.ch/software/topkg/releases/topkg-1.0.3.tbz" -checksum: "e285f7a296d77ee7d831ba9a6bfb396f" -} diff --git a/esy.lock/opam/tyxml.4.3.0/opam b/esy.lock/opam/tyxml.4.3.0/opam deleted file mode 100644 index 93872f8b3c..0000000000 --- a/esy.lock/opam/tyxml.4.3.0/opam +++ /dev/null @@ -1,45 +0,0 @@ -opam-version: "2.0" -maintainer: "dev@ocsigen.org" -homepage: "https://github.com/ocsigen/tyxml/" -bug-reports: "https://github.com/ocsigen/tyxml/issues" -doc: "https://ocsigen.org/tyxml/manual/" -dev-repo: "git+https://github.com/ocsigen/tyxml.git" -license: "LGPL-2.1-only with OCaml-LGPL-linking-exception" - -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} -] - -depends: [ - "ocaml" {>= "4.02"} - "re" {>= "1.5.0"} - ("ocaml" {>= "4.07"} | "re" {>= "1.8.0"}) - "dune" - "alcotest" {with-test} - "seq" - "uutf" {>= "1.0.0"} -] - -synopsis:"TyXML is a library for building correct HTML and SVG documents" -description:""" -TyXML provides a set of convenient combinators that uses the OCaml -type system to ensure the validity of the generated documents. TyXML -can be used with any representation of HTML and SVG: the textual one, -provided directly by this package, or DOM trees (`js_of_ocaml-tyxml`) -virtual DOM (`virtual-dom`) and reactive or replicated trees -(`eliom`). You can also create your own representation and use it to -instantiate a new set of combinators. - -```ocaml -open Tyxml -let to_ocaml = Html.(a ~a:[a_href "ocaml.org"] [txt "OCaml!"]) -``` -""" -authors: "The ocsigen team" -url { - src: - "https://github.com/ocsigen/tyxml/releases/download/4.3.0/tyxml-4.3.0.tbz" - checksum: "md5=fd834a567f813bf447cab5f4c3a723e2" -} diff --git a/esy.lock/opam/uchar.0.0.2/opam b/esy.lock/opam/uchar.0.0.2/opam deleted file mode 100644 index 428d7aa6f8..0000000000 --- a/esy.lock/opam/uchar.0.0.2/opam +++ /dev/null @@ -1,36 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: ["Daniel Bünzli "] -homepage: "http://ocaml.org" -doc: "https://ocaml.github.io/uchar/" -dev-repo: "git+https://github.com/ocaml/uchar.git" -bug-reports: "https://github.com/ocaml/uchar/issues" -tags: [ "text" "character" "unicode" "compatibility" "org:ocaml.org" ] -license: "typeof OCaml system" -depends: [ - "ocaml" {>= "3.12.0"} - "ocamlbuild" {build} -] -build: [ - ["ocaml" "pkg/git.ml"] - [ - "ocaml" - "pkg/build.ml" - "native=%{ocaml:native}%" - "native-dynlink=%{ocaml:native-dynlink}%" - ] -] -synopsis: "Compatibility library for OCaml's Uchar module" -description: """ -The `uchar` package provides a compatibility library for the -[`Uchar`][1] module introduced in OCaml 4.03. - -The `uchar` package is distributed under the license of the OCaml -compiler. See [LICENSE](LICENSE) for details. - -[1]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Uchar.html""" -url { - src: - "https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz" - checksum: "md5=c9ba2c738d264c420c642f7bb1cf4a36" -} diff --git a/esy.lock/opam/uuidm.0.9.7/opam b/esy.lock/opam/uuidm.0.9.7/opam deleted file mode 100644 index 0c59ad9390..0000000000 --- a/esy.lock/opam/uuidm.0.9.7/opam +++ /dev/null @@ -1,34 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: ["Daniel Bünzli "] -homepage: "https://erratique.ch/software/uuidm" -doc: "https://erratique.ch/software/uuidm/doc/Uuidm" -dev-repo: "git+https://erratique.ch/repos/uuidm.git" -bug-reports: "https://github.com/dbuenzli/uuidm/issues" -tags: [ "uuid" "codec" "org:erratique" ] -license: "ISC" -depends: [ - "ocaml" {>= "4.03.0"} - "ocamlfind" {build} - "ocamlbuild" {build} - "topkg" {build} ] -depopts: [ "cmdliner" ] -build: -[ "ocaml" "pkg/pkg.ml" "build" - "--pinned" "%{pinned}%" - "--with-cmdliner" "%{cmdliner:installed}%" ] -synopsis: """Universally unique identifiers (UUIDs) for OCaml""" -description: """\ - -Uuidm is an OCaml module implementing 128 bits universally unique -identifiers version 3, 5 (named based with MD5, SHA-1 hashing) and 4 -(random based) according to [RFC 4122][rfc4122]. - -Uuidm has no dependency and is distributed under the ISC license. - -[rfc4122]: http://tools.ietf.org/html/rfc4122 -""" -url { -archive: "https://erratique.ch/software/uuidm/releases/uuidm-0.9.7.tbz" -checksum: "54658248e3981d8c05237d0a4277ccd3" -} diff --git a/esy.lock/opam/uutf.1.0.2/opam b/esy.lock/opam/uutf.1.0.2/opam deleted file mode 100644 index 3a9f5678d2..0000000000 --- a/esy.lock/opam/uutf.1.0.2/opam +++ /dev/null @@ -1,40 +0,0 @@ -opam-version: "2.0" -maintainer: "Daniel Bünzli " -authors: ["Daniel Bünzli "] -homepage: "http://erratique.ch/software/uutf" -doc: "http://erratique.ch/software/uutf/doc/Uutf" -dev-repo: "git+http://erratique.ch/repos/uutf.git" -bug-reports: "https://github.com/dbuenzli/uutf/issues" -tags: [ "unicode" "text" "utf-8" "utf-16" "codec" "org:erratique" ] -license: "ISC" -depends: [ - "ocaml" {>= "4.01.0"} - "ocamlfind" {build} - "ocamlbuild" {build} - "topkg" {build} - "uchar" -] -depopts: ["cmdliner"] -conflicts: ["cmdliner" { < "0.9.6"} ] -build: [[ - "ocaml" "pkg/pkg.ml" "build" - "--pinned" "%{pinned}%" - "--with-cmdliner" "%{cmdliner:installed}%" ]] -synopsis: """Non-blocking streaming Unicode codec for OCaml""" -description: """\ - -Uutf is a non-blocking streaming codec to decode and encode the UTF-8, -UTF-16, UTF-16LE and UTF-16BE encoding schemes. It can efficiently -work character by character without blocking on IO. Decoders perform -character position tracking and support newline normalization. - -Functions are also provided to fold over the characters of UTF encoded -OCaml string values and to directly encode characters in OCaml -Buffer.t values. - -Uutf has no dependency and is distributed under the ISC license. -""" -url { -archive: "http://erratique.ch/software/uutf/releases/uutf-1.0.2.tbz" -checksum: "a7c542405a39630c689a82bd7ef2292c" -} diff --git a/esy.lock/opam/yojson.1.7.0/opam b/esy.lock/opam/yojson.1.7.0/opam deleted file mode 100644 index ffef0682a7..0000000000 --- a/esy.lock/opam/yojson.1.7.0/opam +++ /dev/null @@ -1,38 +0,0 @@ -opam-version: "2.0" -maintainer: "martin@mjambon.com" -authors: ["Martin Jambon"] -homepage: "https://github.com/ocaml-community/yojson" -bug-reports: "https://github.com/ocaml-community/yojson/issues" -dev-repo: "git+https://github.com/ocaml-community/yojson.git" -doc: "https://ocaml-community.github.io/yojson/" -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] -] -run-test: [["dune" "runtest" "-p" name "-j" jobs]] -depends: [ - "ocaml" {>= "4.02.3"} - "dune" - "cppo" {build} - "easy-format" - "biniou" {>= "1.2.0"} - "alcotest" {with-test & >= "0.8.5"} -] -synopsis: - "Yojson is an optimized parsing and printing library for the JSON format" -description: """ -Yojson is an optimized parsing and printing library for the JSON format. - -It addresses a few shortcomings of json-wheel including 2x speedup, -polymorphic variants and optional syntax for tuples and variants. - -ydump is a pretty-printing command-line program provided with the -yojson package. - -The program atdgen can be used to derive OCaml-JSON serializers and -deserializers from type definitions.""" -url { - src: - "https://github.com/ocaml-community/yojson/releases/download/1.7.0/yojson-1.7.0.tbz" - checksum: "md5=b89d39ca3f8c532abe5f547ad3b8f84d" -} diff --git a/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json b/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json deleted file mode 100644 index ca6a373d8c..0000000000 --- a/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "build": "true", - "dependencies": { - "esy-m4": "esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7" - } -} diff --git a/esy.lock/overrides/opam__s__dune_opam__c__2.7.1_opam_override/files/build.sh b/esy.lock/overrides/opam__s__dune_opam__c__2.7.1_opam_override/files/build.sh deleted file mode 100644 index b2a94f7510..0000000000 --- a/esy.lock/overrides/opam__s__dune_opam__c__2.7.1_opam_override/files/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SECONDARY_CONF="$OCAMLFIND_SECONDARY_PREFIX/lib/findlib.conf.d/ocaml-secondary-compiler.conf" - -if test -f $SECONDARY_CONF; then - export OCAMLFIND_CONF=$SECONDARY_CONF; -fi - -env -u OCAMLLIB ocaml bootstrap.ml -./dune.exe build -p dune --profile dune-bootstrap diff --git a/esy.lock/overrides/opam__s__dune_opam__c__2.7.1_opam_override/package.json b/esy.lock/overrides/opam__s__dune_opam__c__2.7.1_opam_override/package.json deleted file mode 100644 index c7d77ab678..0000000000 --- a/esy.lock/overrides/opam__s__dune_opam__c__2.7.1_opam_override/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "buildsInSource": true, - "build": "bash build.sh", - "install": "esy-installer dune.install", - "buildEnv": { - "OCAMLPATH": "#{ $OCAMLFIND_SECONDARY_PREFIX / 'lib' : ocaml.lib : $OCAML_SECONDARY_COMPILER_PREFIX / 'share' / 'ocaml-secondary-compiler' / 'lib' }" - } -} diff --git a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/clone-flexdll b/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/clone-flexdll deleted file mode 100755 index 26301ddd39..0000000000 --- a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/clone-flexdll +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh - -# clone-flexdll -# -# Brings in flexdll, if necessary - -if [ -d "flexdll" ] && [ -f "flexdll/flexdll.c" ]; then - echo "[Flexdll] Already present, no need to clone." -else - echo "[Flexdll] Cloning..." - git clone https://github.com/esy-ocaml/flexdll.git - cd flexdll - git checkout f84baaeae463f96f9582883a9cfb7dd1096757ff - cd .. - echo "[Flexdll] Clone successful!" -fi \ No newline at end of file diff --git a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/configure-windows b/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/configure-windows deleted file mode 100755 index 4040b49ea8..0000000000 --- a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/configure-windows +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh - -# configure-windows -# -# Creates a native Windows MingW build, based on: -# https://github.com/ocaml/ocaml/blob/trunk/README.win32.adoc - - -export prefix=C:/ocamlmgw64 -while : ; do - case "$1" in - "") break;; - -prefix|--prefix) - prefix=$2; shift;; - esac - shift -done - -echo "[configure-windows] Setting up flexdll" -./clone-flexdll -./configure --build=x86_64-unknown-cygwin --host=x86_64-w64-mingw32 --prefix=$prefix -make flexdll diff --git a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/esy-build b/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/esy-build deleted file mode 100755 index b95356a530..0000000000 --- a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/esy-build +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env bash - -# esy-build -# -# Wrapper to execute appropriate build strategy, based on platform - -set -u -set -e -set -o pipefail - -case "$(uname -s)" in - CYGWIN*|MINGW32*|MSYS*) - echo "[esy-build] Detected windows environment..." - make -j4 world.opt - make flexlink.opt - ;; - *) - echo "[esy-build] Detected OSX / Linux environment" - make -j4 world.opt - ;; -esac - -# Common build steps -make install \ No newline at end of file diff --git a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/esy-configure b/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/esy-configure deleted file mode 100755 index fd196c5177..0000000000 --- a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/files/esy-configure +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env bash - -# esy-configure -# -# Wrapper to delegate to configuration to the -# appropriate `configure` strategy based on the active platform. -# -# Today, OCaml has separate build strategies: -# - Linux, OSX, Cygwin (gcc) - https://github.com/ocaml/ocaml/blob/trunk/INSTALL.adoc -# - Windows, Cygin (mingw) - https://github.com/ocaml/ocaml/blob/trunk/README.win32.adoc -# -# We want `esy` to work cross-platform, so this is a shim script that will delegate to the -# appropriate script depending on the platform. We assume that if the platform is `CYGWIN` -# that the `mingw` (native executable) strategy is desired. - -set -u -set -e -set -o pipefail - -case "$(uname -s)" in - CYGWIN*|MINGW32*|MSYS*) - echo "[esy-configure] Detected windows environment..." - ./configure-windows "$@" - ;; - *) - echo "[esy-configure] Detected OSX / Linux environment" - ./configure "$@" - ;; -esac \ No newline at end of file diff --git a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/package.json b/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/package.json deleted file mode 100644 index 948455caf8..0000000000 --- a/esy.lock/overrides/opam__s__ocaml_secondary_compiler_opam__c__4.08.1_1_opam_override/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "buildEnv": { - "PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" - }, - "build": [ - [ - "env", - "-u", - "OCAMLLIB", - "bash", "./esy-configure", - "--disable-cfi", - "--prefix", "$cur__install/share/ocaml-secondary-compiler", - "--libdir", "$cur__install/share/ocaml-secondary-compiler/lib", - "--disable-debugger", - "--disable-installing-bytecode-programs", - "--disable-debug-runtime", - "--disable-instrumented-runtime", - "--disable-graph-lib" - ], - [ - "env", - "-u", - "OCAMLLIB", - "bash", "./esy-build" - ] - ], - "buildsInSource": true -} diff --git a/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch b/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch deleted file mode 100644 index 4d5bea0e09..0000000000 --- a/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch +++ /dev/null @@ -1,463 +0,0 @@ ---- ./Makefile -+++ ./Makefile -@@ -213,7 +213,7 @@ - rm -f man/ocamlbuild.1 - - man/options_man.byte: src/ocamlbuild_pack.cmo -- $(OCAMLC) $^ -I src man/options_man.ml -o man/options_man.byte -+ $(OCAMLC) -I +unix unix.cma $^ -I src man/options_man.ml -o man/options_man.byte - - clean:: - rm -f man/options_man.cm* ---- ./src/command.ml -+++ ./src/command.ml -@@ -148,9 +148,10 @@ - let self = string_of_command_spec_with_calls call_with_tags call_with_target resolve_virtuals in - let b = Buffer.create 256 in - (* The best way to prevent bash from switching to its windows-style -- * quote-handling is to prepend an empty string before the command name. *) -+ * quote-handling is to prepend an empty string before the command name. -+ * space seems to work, too - and the ouput is nicer *) - if Sys.os_type = "Win32" then -- Buffer.add_string b "''"; -+ Buffer.add_char b ' '; - let first = ref true in - let put_space () = - if !first then -@@ -260,7 +261,7 @@ - - let execute_many ?(quiet=false) ?(pretend=false) cmds = - add_parallel_stat (List.length cmds); -- let degraded = !*My_unix.is_degraded || Sys.os_type = "Win32" in -+ let degraded = !*My_unix.is_degraded in - let jobs = !jobs in - if jobs < 0 then invalid_arg "jobs < 0"; - let max_jobs = if jobs = 0 then None else Some jobs in ---- ./src/findlib.ml -+++ ./src/findlib.ml -@@ -66,9 +66,6 @@ - (fun command -> lexer & Lexing.from_string & run_and_read command) - command - --let run_and_read command = -- Printf.ksprintf run_and_read command -- - let rec query name = - try - Hashtbl.find packages name -@@ -135,7 +132,8 @@ - with Not_found -> s - - let list () = -- List.map before_space (split_nl & run_and_read "%s list" ocamlfind) -+ let cmd = Shell.quote_filename_if_needed ocamlfind ^ " list" in -+ List.map before_space (split_nl & run_and_read cmd) - - (* The closure algorithm is easy because the dependencies are already closed - and sorted for each package. We only have to make the union. We could also ---- ./src/main.ml -+++ ./src/main.ml -@@ -162,6 +162,9 @@ - Tags.mem "traverse" tags - || List.exists (Pathname.is_prefix path_name) !Options.include_dirs - || List.exists (Pathname.is_prefix path_name) target_dirs) -+ && ((* beware: !Options.build_dir is an absolute directory *) -+ Pathname.normalize !Options.build_dir -+ <> Pathname.normalize (Pathname.pwd/path_name)) - end - end - end ---- ./src/my_std.ml -+++ ./src/my_std.ml -@@ -271,13 +271,107 @@ - try Array.iter (fun x -> if x = basename then raise Exit) a; false - with Exit -> true - -+let command_plain = function -+| [| |] -> 0 -+| margv -> -+ let rec waitpid a b = -+ match Unix.waitpid a b with -+ | exception (Unix.Unix_error(Unix.EINTR,_,_)) -> waitpid a b -+ | x -> x -+ in -+ let pid = Unix.(create_process margv.(0) margv stdin stdout stderr) in -+ let pid', process_status = waitpid [] pid in -+ assert (pid = pid'); -+ match process_status with -+ | Unix.WEXITED n -> n -+ | Unix.WSIGNALED _ -> 2 (* like OCaml's uncaught exceptions *) -+ | Unix.WSTOPPED _ -> 127 -+ -+(* can't use Lexers because of circular dependency *) -+let split_path_win str = -+ let rec aux pos = -+ try -+ let i = String.index_from str pos ';' in -+ let len = i - pos in -+ if len = 0 then -+ aux (succ i) -+ else -+ String.sub str pos (i - pos) :: aux (succ i) -+ with Not_found | Invalid_argument _ -> -+ let len = String.length str - pos in -+ if len = 0 then [] else [String.sub str pos len] -+ in -+ aux 0 -+ -+let windows_shell = lazy begin -+ let rec iter = function -+ | [] -> [| "bash.exe" ; "--norc" ; "--noprofile" |] -+ | hd::tl -> -+ let dash = Filename.concat hd "dash.exe" in -+ if Sys.file_exists dash then [|dash|] else -+ let bash = Filename.concat hd "bash.exe" in -+ if Sys.file_exists bash = false then iter tl else -+ (* if sh.exe and bash.exe exist in the same dir, choose sh.exe *) -+ let sh = Filename.concat hd "sh.exe" in -+ if Sys.file_exists sh then [|sh|] else [|bash ; "--norc" ; "--noprofile"|] -+ in -+ split_path_win (try Sys.getenv "PATH" with Not_found -> "") |> iter -+end -+ -+let prep_windows_cmd cmd = -+ (* workaround known ocaml bug, remove later *) -+ if String.contains cmd '\t' && String.contains cmd ' ' = false then -+ " " ^ cmd -+ else -+ cmd -+ -+let run_with_shell = function -+| "" -> 0 -+| cmd -> -+ let cmd = prep_windows_cmd cmd in -+ let shell = Lazy.force windows_shell in -+ let qlen = Filename.quote cmd |> String.length in -+ (* old versions of dash had problems with bs *) -+ try -+ if qlen < 7_900 then -+ command_plain (Array.append shell [| "-ec" ; cmd |]) -+ else begin -+ (* it can still work, if the called command is a cygwin tool *) -+ let ch_closed = ref false in -+ let file_deleted = ref false in -+ let fln,ch = -+ Filename.open_temp_file -+ ~mode:[Open_binary] -+ "ocamlbuildtmp" -+ ".sh" -+ in -+ try -+ let f_slash = String.map ( fun x -> if x = '\\' then '/' else x ) fln in -+ output_string ch cmd; -+ ch_closed:= true; -+ close_out ch; -+ let ret = command_plain (Array.append shell [| "-e" ; f_slash |]) in -+ file_deleted:= true; -+ Sys.remove fln; -+ ret -+ with -+ | x -> -+ if !ch_closed = false then -+ close_out_noerr ch; -+ if !file_deleted = false then -+ (try Sys.remove fln with _ -> ()); -+ raise x -+ end -+ with -+ | (Unix.Unix_error _) as x -> -+ (* Sys.command doesn't raise an exception, so run_with_shell also won't -+ raise *) -+ Printexc.to_string x ^ ":" ^ cmd |> prerr_endline; -+ 1 -+ - let sys_command = -- match Sys.os_type with -- | "Win32" -> fun cmd -> -- if cmd = "" then 0 else -- let cmd = "bash --norc -c " ^ Filename.quote cmd in -- Sys.command cmd -- | _ -> fun cmd -> if cmd = "" then 0 else Sys.command cmd -+ if Sys.win32 then run_with_shell -+ else fun cmd -> if cmd = "" then 0 else Sys.command cmd - - (* FIXME warning fix and use Filename.concat *) - let filename_concat x y = ---- ./src/my_std.mli -+++ ./src/my_std.mli -@@ -69,3 +69,6 @@ - - val split_ocaml_version : (int * int * int * string) option - (** (major, minor, patchlevel, rest) *) -+ -+val windows_shell : string array Lazy.t -+val prep_windows_cmd : string -> string ---- ./src/ocamlbuild_executor.ml -+++ ./src/ocamlbuild_executor.ml -@@ -34,6 +34,8 @@ - job_stdin : out_channel; - job_stderr : in_channel; - job_buffer : Buffer.t; -+ job_pid : int; -+ job_tmp_file: string option; - mutable job_dying : bool; - };; - -@@ -76,6 +78,61 @@ - in - loop 0 - ;; -+ -+let open_process_full_win cmd env = -+ let (in_read, in_write) = Unix.pipe () in -+ let (out_read, out_write) = Unix.pipe () in -+ let (err_read, err_write) = Unix.pipe () in -+ Unix.set_close_on_exec in_read; -+ Unix.set_close_on_exec out_write; -+ Unix.set_close_on_exec err_read; -+ let inchan = Unix.in_channel_of_descr in_read in -+ let outchan = Unix.out_channel_of_descr out_write in -+ let errchan = Unix.in_channel_of_descr err_read in -+ let shell = Lazy.force Ocamlbuild_pack.My_std.windows_shell in -+ let test_cmd = -+ String.concat " " (List.map Filename.quote (Array.to_list shell)) ^ -+ "-ec " ^ -+ Filename.quote (Ocamlbuild_pack.My_std.prep_windows_cmd cmd) in -+ let argv,tmp_file = -+ if String.length test_cmd < 7_900 then -+ Array.append -+ shell -+ [| "-ec" ; Ocamlbuild_pack.My_std.prep_windows_cmd cmd |],None -+ else -+ let fln,ch = Filename.open_temp_file ~mode:[Open_binary] "ocamlbuild" ".sh" in -+ output_string ch (Ocamlbuild_pack.My_std.prep_windows_cmd cmd); -+ close_out ch; -+ let fln' = String.map (function '\\' -> '/' | c -> c) fln in -+ Array.append -+ shell -+ [| "-c" ; fln' |], Some fln in -+ let pid = -+ Unix.create_process_env argv.(0) argv env out_read in_write err_write in -+ Unix.close out_read; -+ Unix.close in_write; -+ Unix.close err_write; -+ (pid, inchan, outchan, errchan,tmp_file) -+ -+let close_process_full_win (pid,inchan, outchan, errchan, tmp_file) = -+ let delete tmp_file = -+ match tmp_file with -+ | None -> () -+ | Some x -> try Sys.remove x with Sys_error _ -> () in -+ let tmp_file_deleted = ref false in -+ try -+ close_in inchan; -+ close_out outchan; -+ close_in errchan; -+ let res = snd(Unix.waitpid [] pid) in -+ tmp_file_deleted := true; -+ delete tmp_file; -+ res -+ with -+ | x when tmp_file <> None && !tmp_file_deleted = false -> -+ delete tmp_file; -+ raise x -+ - (* ***) - (*** execute *) - (* XXX: Add test for non reentrancy *) -@@ -130,10 +187,16 @@ - (*** add_job *) - let add_job cmd rest result id = - (*display begin fun oc -> fp oc "Job %a is %s\n%!" print_job_id id cmd; end;*) -- let (stdout', stdin', stderr') = open_process_full cmd env in -+ let (pid,stdout', stdin', stderr', tmp_file) = -+ if Sys.win32 then open_process_full_win cmd env else -+ let a,b,c = open_process_full cmd env in -+ -1,a,b,c,None -+ in - incr jobs_active; -- set_nonblock (doi stdout'); -- set_nonblock (doi stderr'); -+ if not Sys.win32 then ( -+ set_nonblock (doi stdout'); -+ set_nonblock (doi stderr'); -+ ); - let job = - { job_id = id; - job_command = cmd; -@@ -143,7 +206,9 @@ - job_stdin = stdin'; - job_stderr = stderr'; - job_buffer = Buffer.create 1024; -- job_dying = false } -+ job_dying = false; -+ job_tmp_file = tmp_file; -+ job_pid = pid } - in - outputs := FDM.add (doi stdout') job (FDM.add (doi stderr') job !outputs); - jobs := JS.add job !jobs; -@@ -199,6 +264,7 @@ - try - read fd u 0 (Bytes.length u) - with -+ | Unix.Unix_error(Unix.EPIPE,_,_) when Sys.win32 -> 0 - | Unix.Unix_error(e,_,_) -> - let msg = error_message e in - display (fun oc -> fp oc -@@ -241,14 +307,19 @@ - decr jobs_active; - - (* PR#5371: we would get EAGAIN below otherwise *) -- clear_nonblock (doi job.job_stdout); -- clear_nonblock (doi job.job_stderr); -- -+ if not Sys.win32 then ( -+ clear_nonblock (doi job.job_stdout); -+ clear_nonblock (doi job.job_stderr); -+ ); - do_read ~loop:true (doi job.job_stdout) job; - do_read ~loop:true (doi job.job_stderr) job; - outputs := FDM.remove (doi job.job_stdout) (FDM.remove (doi job.job_stderr) !outputs); - jobs := JS.remove job !jobs; -- let status = close_process_full (job.job_stdout, job.job_stdin, job.job_stderr) in -+ let status = -+ if Sys.win32 then -+ close_process_full_win (job.job_pid, job.job_stdout, job.job_stdin, job.job_stderr, job.job_tmp_file) -+ else -+ close_process_full (job.job_stdout, job.job_stdin, job.job_stderr) in - - let shown = ref false in - ---- ./src/ocamlbuild_unix_plugin.ml -+++ ./src/ocamlbuild_unix_plugin.ml -@@ -48,12 +48,22 @@ - end - - let run_and_open s kont = -+ let s_orig = s in -+ let s = -+ (* Be consistent! My_unix.run_and_open uses My_std.sys_command and -+ sys_command uses bash. *) -+ if Sys.win32 = false then s else -+ let l = match Lazy.force My_std.windows_shell |> Array.to_list with -+ | hd::tl -> (Filename.quote hd)::tl -+ | _ -> assert false in -+ "\"" ^ (String.concat " " l) ^ " -ec " ^ Filename.quote (" " ^ s) ^ "\"" -+ in - let ic = Unix.open_process_in s in - let close () = - match Unix.close_process_in ic with - | Unix.WEXITED 0 -> () - | Unix.WEXITED _ | Unix.WSIGNALED _ | Unix.WSTOPPED _ -> -- failwith (Printf.sprintf "Error while running: %s" s) in -+ failwith (Printf.sprintf "Error while running: %s" s_orig) in - let res = try - kont ic - with e -> (close (); raise e) ---- ./src/options.ml -+++ ./src/options.ml -@@ -174,11 +174,24 @@ - build_dir := Filename.concat (Sys.getcwd ()) s - else - build_dir := s -+ -+let slashify = -+ if Sys.win32 then fun p -> String.map (function '\\' -> '/' | x -> x) p -+ else fun p ->p -+ -+let sb () = -+ match Sys.os_type with -+ | "Win32" -> -+ (try set_binary_mode_out stdout true with _ -> ()); -+ | _ -> () -+ -+ - let spec = ref ( - let print_version () = -+ sb (); - Printf.printf "ocamlbuild %s\n%!" Ocamlbuild_config.version; raise Exit_OK - in -- let print_vnum () = print_endline Ocamlbuild_config.version; raise Exit_OK in -+ let print_vnum () = sb (); print_endline Ocamlbuild_config.version; raise Exit_OK in - Arg.align - [ - "-version", Unit print_version , " Display the version"; -@@ -257,8 +270,8 @@ - "-build-dir", String set_build_dir, " Set build directory (implies no-links)"; - "-install-lib-dir", Set_string Ocamlbuild_where.libdir, " Set the install library directory"; - "-install-bin-dir", Set_string Ocamlbuild_where.bindir, " Set the install binary directory"; -- "-where", Unit (fun () -> print_endline !Ocamlbuild_where.libdir; raise Exit_OK), " Display the install library directory"; -- "-which", String (fun cmd -> print_endline (find_tool cmd); raise Exit_OK), " Display path to the tool command"; -+ "-where", Unit (fun () -> sb (); print_endline (slashify !Ocamlbuild_where.libdir); raise Exit_OK), " Display the install library directory"; -+ "-which", String (fun cmd -> sb (); print_endline (slashify (find_tool cmd)); raise Exit_OK), " Display path to the tool command"; - "-ocamlc", set_cmd ocamlc, " Set the OCaml bytecode compiler"; - "-plugin-ocamlc", set_cmd plugin_ocamlc, " Set the OCaml bytecode compiler \ - used when building myocamlbuild.ml (only)"; ---- ./src/pathname.ml -+++ ./src/pathname.ml -@@ -84,6 +84,26 @@ - | x :: xs -> x :: normalize_list xs - - let normalize x = -+ let x = -+ if Sys.win32 = false then -+ x -+ else -+ let len = String.length x in -+ let b = Bytes.create len in -+ for i = 0 to pred len do -+ match x.[i] with -+ | '\\' -> Bytes.set b i '/' -+ | c -> Bytes.set b i c -+ done; -+ if len > 1 then ( -+ let c1 = Bytes.get b 0 in -+ let c2 = Bytes.get b 1 in -+ if c2 = ':' && c1 >= 'a' && c1 <= 'z' && -+ ( len = 2 || Bytes.get b 2 = '/') then -+ Bytes.set b 0 (Char.uppercase_ascii c1) -+ ); -+ Bytes.unsafe_to_string b -+ in - if Glob.eval not_normal_form_re x then - let root, paths = split x in - join root (normalize_list paths) ---- ./src/shell.ml -+++ ./src/shell.ml -@@ -24,12 +24,26 @@ - | 'a'..'z' | 'A'..'Z' | '0'..'9' | '.' | '-' | '/' | '_' | ':' | '@' | '+' | ',' -> loop (pos + 1) - | _ -> false in - loop 0 -+ -+let generic_quote quotequote s = -+ let l = String.length s in -+ let b = Buffer.create (l + 20) in -+ Buffer.add_char b '\''; -+ for i = 0 to l - 1 do -+ if s.[i] = '\'' -+ then Buffer.add_string b quotequote -+ else Buffer.add_char b s.[i] -+ done; -+ Buffer.add_char b '\''; -+ Buffer.contents b -+let unix_quote = generic_quote "'\\''" -+ - let quote_filename_if_needed s = - if is_simple_filename s then s - (* We should probably be using [Filename.unix_quote] except that function - * isn't exported. Users on Windows will have to live with not being able to - * install OCaml into c:\o'caml. Too bad. *) -- else if Sys.os_type = "Win32" then Printf.sprintf "'%s'" s -+ else if Sys.os_type = "Win32" then unix_quote s - else Filename.quote s - let chdir dir = - reset_filesys_cache (); -@@ -37,7 +51,7 @@ - let run args target = - reset_readdir_cache (); - let cmd = String.concat " " (List.map quote_filename_if_needed args) in -- if !*My_unix.is_degraded || Sys.os_type = "Win32" then -+ if !*My_unix.is_degraded then - begin - Log.event cmd target Tags.empty; - let st = sys_command cmd in diff --git a/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json b/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json deleted file mode 100644 index b24be7b5bc..0000000000 --- a/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "build": [ - [ - "bash", - "-c", - "#{os == 'windows' ? 'patch -p1 < ocamlbuild-0.14.0.patch' : 'true'}" - ], - [ - "make", - "-f", - "configure.make", - "all", - "OCAMLBUILD_PREFIX=#{self.install}", - "OCAMLBUILD_BINDIR=#{self.bin}", - "OCAMLBUILD_LIBDIR=#{self.lib}", - "OCAMLBUILD_MANDIR=#{self.man}", - "OCAMLBUILD_NATIVE=true", - "OCAMLBUILD_NATIVE_TOOLS=true" - ], - [ - "make", - "check-if-preinstalled", - "all", - "#{os == 'windows' ? 'install' : 'opam-install'}" - ] - ] -} diff --git a/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch b/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch deleted file mode 100644 index 3e3ee5a24f..0000000000 --- a/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch +++ /dev/null @@ -1,471 +0,0 @@ ---- ./Makefile -+++ ./Makefile -@@ -57,16 +57,16 @@ - cat findlib.conf.in | \ - $(SH) tools/patch '@SITELIB@' '$(OCAML_SITELIB)' >findlib.conf - if ./tools/cmd_from_same_dir ocamlc; then \ -- echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \ -+ echo 'ocamlc="ocamlc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - if ./tools/cmd_from_same_dir ocamlopt; then \ -- echo 'ocamlopt="ocamlopt.opt"' >>findlib.conf; \ -+ echo 'ocamlopt="ocamlopt.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - if ./tools/cmd_from_same_dir ocamldep; then \ -- echo 'ocamldep="ocamldep.opt"' >>findlib.conf; \ -+ echo 'ocamldep="ocamldep.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - if ./tools/cmd_from_same_dir ocamldoc; then \ -- echo 'ocamldoc="ocamldoc.opt"' >>findlib.conf; \ -+ echo 'ocamldoc="ocamldoc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - - .PHONY: install-doc ---- ./src/findlib/findlib_config.mlp -+++ ./src/findlib/findlib_config.mlp -@@ -24,3 +24,5 @@ - | "MacOS" -> "" (* don't know *) - | _ -> failwith "Unknown Sys.os_type" - ;; -+ -+let exec_suffix = "@EXEC_SUFFIX@";; ---- ./src/findlib/findlib.ml -+++ ./src/findlib/findlib.ml -@@ -28,15 +28,20 @@ - let conf_ldconf = ref "";; - let conf_ignore_dups_in = ref ([] : string list);; - --let ocamlc_default = "ocamlc";; --let ocamlopt_default = "ocamlopt";; --let ocamlcp_default = "ocamlcp";; --let ocamloptp_default = "ocamloptp";; --let ocamlmklib_default = "ocamlmklib";; --let ocamlmktop_default = "ocamlmktop";; --let ocamldep_default = "ocamldep";; --let ocamlbrowser_default = "ocamlbrowser";; --let ocamldoc_default = "ocamldoc";; -+let add_exec str = -+ match Findlib_config.exec_suffix with -+ | "" -> str -+ | a -> str ^ a ;; -+let ocamlc_default = add_exec "ocamlc";; -+let ocamlopt_default = add_exec "ocamlopt";; -+let ocamlcp_default = add_exec "ocamlcp";; -+let ocamloptp_default = add_exec "ocamloptp";; -+let ocamlmklib_default = add_exec "ocamlmklib";; -+let ocamlmktop_default = add_exec "ocamlmktop";; -+let ocamldep_default = add_exec "ocamldep";; -+let ocamlbrowser_default = add_exec "ocamlbrowser";; -+let ocamldoc_default = add_exec "ocamldoc";; -+ - - - let init_manually ---- ./src/findlib/fl_package_base.ml -+++ ./src/findlib/fl_package_base.ml -@@ -133,7 +133,15 @@ - List.find (fun def -> def.def_var = "exists_if") p.package_defs in - let files = Fl_split.in_words def.def_value in - List.exists -- (fun file -> Sys.file_exists (Filename.concat d' file)) -+ (fun file -> -+ let fln = Filename.concat d' file in -+ let e = Sys.file_exists fln in -+ (* necessary for ppx executables *) -+ if e || Sys.os_type <> "Win32" || Filename.check_suffix fln ".exe" then -+ e -+ else -+ Sys.file_exists (fln ^ ".exe") -+ ) - files - with Not_found -> true in - ---- ./src/findlib/fl_split.ml -+++ ./src/findlib/fl_split.ml -@@ -126,10 +126,17 @@ - | '/' | '\\' -> true - | _ -> false in - let norm_dir_win() = -- if l >= 1 && s.[0] = '/' then -- Buffer.add_char b '\\' else Buffer.add_char b s.[0]; -- if l >= 2 && s.[1] = '/' then -- Buffer.add_char b '\\' else Buffer.add_char b s.[1]; -+ if l >= 1 then ( -+ if s.[0] = '/' then -+ Buffer.add_char b '\\' -+ else -+ Buffer.add_char b s.[0] ; -+ if l >= 2 then -+ if s.[1] = '/' then -+ Buffer.add_char b '\\' -+ else -+ Buffer.add_char b s.[1]; -+ ); - for k = 2 to l - 1 do - let c = s.[k] in - if is_slash c then ( ---- ./src/findlib/frontend.ml -+++ ./src/findlib/frontend.ml -@@ -31,10 +31,18 @@ - else - Sys_error (arg ^ ": " ^ Unix.error_message code) - -+let is_win = Sys.os_type = "Win32" -+ -+let () = -+ match Findlib_config.system with -+ | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" -> -+ (try set_binary_mode_out stdout true with _ -> ()); -+ (try set_binary_mode_out stderr true with _ -> ()); -+ | _ -> () - - let slashify s = - match Findlib_config.system with -- | "mingw" | "mingw64" | "cygwin" -> -+ | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" -> - let b = Buffer.create 80 in - String.iter - (function -@@ -49,7 +57,7 @@ - - let out_path ?(prefix="") s = - match Findlib_config.system with -- | "mingw" | "mingw64" | "cygwin" -> -+ | "win32" | "win64" | "mingw" | "mingw64" | "cygwin" -> - let u = slashify s in - prefix ^ - (if String.contains u ' ' then -@@ -273,11 +281,9 @@ - - - let identify_dir d = -- match Sys.os_type with -- | "Win32" -> -- failwith "identify_dir" (* not available *) -- | _ -> -- let s = Unix.stat d in -+ if is_win then -+ failwith "identify_dir"; (* not available *) -+ let s = Unix.stat d in - (s.Unix.st_dev, s.Unix.st_ino) - ;; - -@@ -459,6 +465,96 @@ - ) - packages - -+let rewrite_cmd s = -+ if s = "" || not is_win then -+ s -+ else -+ let s = -+ let l = String.length s in -+ let b = Buffer.create l in -+ for i = 0 to pred l do -+ match s.[i] with -+ | '/' -> Buffer.add_char b '\\' -+ | x -> Buffer.add_char b x -+ done; -+ Buffer.contents b -+ in -+ if (Filename.is_implicit s && String.contains s '\\' = false) || -+ Filename.check_suffix (String.lowercase s) ".exe" then -+ s -+ else -+ let s' = s ^ ".exe" in -+ if Sys.file_exists s' then -+ s' -+ else -+ s -+ -+let rewrite_cmd s = -+ if s = "" || not is_win then s else -+ let s = -+ let l = String.length s in -+ let b = Buffer.create l in -+ for i = 0 to pred l do -+ match s.[i] with -+ | '/' -> Buffer.add_char b '\\' -+ | x -> Buffer.add_char b x -+ done; -+ Buffer.contents b -+ in -+ if (Filename.is_implicit s && String.contains s '\\' = false) || -+ Filename.check_suffix (String.lowercase s) ".exe" then -+ s -+ else -+ let s' = s ^ ".exe" in -+ if Sys.file_exists s' then -+ s' -+ else -+ s -+ -+let rewrite_pp cmd = -+ if not is_win then cmd else -+ let module T = struct exception Keep end in -+ let is_whitespace = function -+ | ' ' | '\011' | '\012' | '\n' | '\r' | '\t' -> true -+ | _ -> false in -+ (* characters that triggers special behaviour (cmd.exe, not unix shell) *) -+ let is_unsafe_char = function -+ | '(' | ')' | '%' | '!' | '^' | '<' | '>' | '&' -> true -+ | _ -> false in -+ let len = String.length cmd in -+ let buf = Buffer.create (len + 4) in -+ let buf_cmd = Buffer.create len in -+ let rec iter_ws i = -+ if i >= len then () else -+ let cur = cmd.[i] in -+ if is_whitespace cur then ( -+ Buffer.add_char buf cur; -+ iter_ws (succ i) -+ ) -+ else -+ iter_cmd i -+ and iter_cmd i = -+ if i >= len then add_buf_cmd () else -+ let cur = cmd.[i] in -+ if is_unsafe_char cur || cur = '"' || cur = '\'' then -+ raise T.Keep; -+ if is_whitespace cur then ( -+ add_buf_cmd (); -+ Buffer.add_substring buf cmd i (len - i) -+ ) -+ else ( -+ Buffer.add_char buf_cmd cur; -+ iter_cmd (succ i) -+ ) -+ and add_buf_cmd () = -+ if Buffer.length buf_cmd > 0 then -+ Buffer.add_string buf (rewrite_cmd (Buffer.contents buf_cmd)) -+ in -+ try -+ iter_ws 0; -+ Buffer.contents buf -+ with -+ | T.Keep -> cmd - - let process_pp_spec syntax_preds packages pp_opts = - (* Returns: pp_command *) -@@ -549,7 +645,7 @@ - None -> [] - | Some cmd -> - ["-pp"; -- cmd ^ " " ^ -+ (rewrite_cmd cmd) ^ " " ^ - String.concat " " (List.map Filename.quote pp_i_options) ^ " " ^ - String.concat " " (List.map Filename.quote pp_archives) ^ " " ^ - String.concat " " (List.map Filename.quote pp_opts)] -@@ -625,9 +721,11 @@ - in - try - let preprocessor = -+ rewrite_cmd ( - resolve_path - ~base ~explicit:true -- (package_property predicates pname "ppx") in -+ (package_property predicates pname "ppx") ) -+ in - ["-ppx"; String.concat " " (preprocessor :: options)] - with Not_found -> [] - ) -@@ -895,6 +993,14 @@ - switch (e.g. -L instead of -L ) - *) - -+(* We may need to remove files on which we do not have complete control. -+ On Windows, removing a read-only file fails so try to change the -+ mode of the file first. *) -+let remove_file fname = -+ try Sys.remove fname -+ with Sys_error _ when is_win -> -+ (try Unix.chmod fname 0o666 with Unix.Unix_error _ -> ()); -+ Sys.remove fname - - let ocamlc which () = - -@@ -1022,9 +1128,12 @@ - - "-intf", - Arg.String (fun s -> pass_files := !pass_files @ [ Intf(slashify s) ]); -- -+ - "-pp", -- Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" s); -+ Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" (rewrite_pp s)); -+ -+ "-ppx", -+ Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s)); - - "-thread", - Arg.Unit (fun _ -> threads := threads_default); -@@ -1237,7 +1346,7 @@ - with - any -> - close_out initl; -- Sys.remove initl_file_name; -+ remove_file initl_file_name; - raise any - end; - -@@ -1245,9 +1354,9 @@ - at_exit - (fun () -> - let tr f x = try f x with _ -> () in -- tr Sys.remove initl_file_name; -- tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmi"); -- tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmo"); -+ tr remove_file initl_file_name; -+ tr remove_file (Filename.chop_extension initl_file_name ^ ".cmi"); -+ tr remove_file (Filename.chop_extension initl_file_name ^ ".cmo"); - ); - - let exclude_list = [ stdlibdir; threads_dir; vmthreads_dir ] in -@@ -1493,7 +1602,9 @@ - [ "-v", Arg.Unit (fun () -> verbose := Verbose); - "-pp", Arg.String (fun s -> - pp_specified := true; -- options := !options @ ["-pp"; s]); -+ options := !options @ ["-pp"; rewrite_pp s]); -+ "-ppx", Arg.String (fun s -> -+ options := !options @ ["-ppx"; rewrite_pp s]); - ] - ) - ) -@@ -1672,7 +1783,9 @@ - Arg.String (fun s -> add_spec_fn "-I" (slashify (resolve_path s))); - - "-pp", Arg.String (fun s -> pp_specified := true; -- add_spec_fn "-pp" s); -+ add_spec_fn "-pp" (rewrite_pp s)); -+ "-ppx", Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s)); -+ - ] - ) - ) -@@ -1830,7 +1943,10 @@ - output_string ch_out append; - close_out ch_out; - close_in ch_in; -- Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime; -+ (try Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime -+ with Unix.Unix_error(e,_,_) -> -+ prerr_endline("Warning: setting utimes for " ^ outpath -+ ^ ": " ^ Unix.error_message e)); - - prerr_endline("Installed " ^ outpath); - with -@@ -1882,6 +1998,8 @@ - Unix.openfile (Filename.concat dir owner_file) [Unix.O_RDONLY] 0 in - let f = - Unix.in_channel_of_descr fd in -+ if is_win then -+ set_binary_mode_in f false; - try - let line = input_line f in - let is_my_file = (line = pkg) in -@@ -2208,7 +2326,7 @@ - let lines = read_ldconf !ldconf in - let dlldir_norm = Fl_split.norm_dir dlldir in - let dlldir_norm_lc = string_lowercase_ascii dlldir_norm in -- let ci_filesys = (Sys.os_type = "Win32") in -+ let ci_filesys = is_win in - let check_dir d = - let d' = Fl_split.norm_dir d in - (d' = dlldir_norm) || -@@ -2356,7 +2474,7 @@ - List.iter - (fun file -> - let absfile = Filename.concat dlldir file in -- Sys.remove absfile; -+ remove_file absfile; - prerr_endline ("Removed " ^ absfile) - ) - dll_files -@@ -2365,7 +2483,7 @@ - (* Remove the files from the package directory: *) - if Sys.file_exists pkgdir then begin - let files = Sys.readdir pkgdir in -- Array.iter (fun f -> Sys.remove (Filename.concat pkgdir f)) files; -+ Array.iter (fun f -> remove_file (Filename.concat pkgdir f)) files; - Unix.rmdir pkgdir; - prerr_endline ("Removed " ^ pkgdir) - end -@@ -2415,7 +2533,9 @@ - - - let print_configuration() = -+ let sl = slashify in - let dir s = -+ let s = sl s in - if Sys.file_exists s then - s - else -@@ -2453,27 +2573,27 @@ - if md = "" then "the corresponding package directories" else dir md - ); - Printf.printf "The standard library is assumed to reside in:\n %s\n" -- (Findlib.ocaml_stdlib()); -+ (sl (Findlib.ocaml_stdlib())); - Printf.printf "The ld.conf file can be found here:\n %s\n" -- (Findlib.ocaml_ldconf()); -+ (sl (Findlib.ocaml_ldconf())); - flush stdout - | Some "conf" -> -- print_endline (Findlib.config_file()) -+ print_endline (sl (Findlib.config_file())) - | Some "path" -> -- List.iter print_endline (Findlib.search_path()) -+ List.iter ( fun x -> print_endline (sl x)) (Findlib.search_path()) - | Some "destdir" -> -- print_endline (Findlib.default_location()) -+ print_endline ( sl (Findlib.default_location())) - | Some "metadir" -> -- print_endline (Findlib.meta_directory()) -+ print_endline ( sl (Findlib.meta_directory())) - | Some "metapath" -> - let mdir = Findlib.meta_directory() in - let ddir = Findlib.default_location() in -- print_endline -- (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META") -+ print_endline ( sl -+ (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META")) - | Some "stdlib" -> -- print_endline (Findlib.ocaml_stdlib()) -+ print_endline ( sl (Findlib.ocaml_stdlib())) - | Some "ldconf" -> -- print_endline (Findlib.ocaml_ldconf()) -+ print_endline ( sl (Findlib.ocaml_ldconf())) - | _ -> - assert false - ;; -@@ -2481,7 +2601,7 @@ - - let ocamlcall pkg cmd = - let dir = package_directory pkg in -- let path = Filename.concat dir cmd in -+ let path = rewrite_cmd (Filename.concat dir cmd) in - begin - try Unix.access path [ Unix.X_OK ] - with -@@ -2647,6 +2767,10 @@ - | Sys_error f -> - prerr_endline ("ocamlfind: " ^ f); - exit 2 -+ | Unix.Unix_error (e, fn, f) -> -+ prerr_endline ("ocamlfind: " ^ fn ^ " " ^ f -+ ^ ": " ^ Unix.error_message e); -+ exit 2 - | Findlib.No_such_package(pkg,info) -> - prerr_endline ("ocamlfind: Package `" ^ pkg ^ "' not found" ^ - (if info <> "" then " - " ^ info else "")); ---- ./src/findlib/Makefile -+++ ./src/findlib/Makefile -@@ -90,6 +90,7 @@ - cat findlib_config.mlp | \ - $(SH) $(TOP)/tools/patch '@CONFIGFILE@' '$(OCAMLFIND_CONF)' | \ - $(SH) $(TOP)/tools/patch '@STDLIB@' '$(OCAML_CORE_STDLIB)' | \ -+ $(SH) $(TOP)/tools/patch '@EXEC_SUFFIX@' '$(EXEC_SUFFIX)' | \ - sed -e 's;@AUTOLINK@;$(OCAML_AUTOLINK);g' \ - -e 's;@SYSTEM@;$(SYSTEM);g' \ - >findlib_config.ml diff --git a/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/package.json b/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/package.json deleted file mode 100644 index 9314f87088..0000000000 --- a/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "build": [ - [ - "bash", - "-c", - "#{os == 'windows' ? 'patch -p1 < findlib-1.8.1.patch' : 'true'}" - ], - [ - "./configure", - "-bindir", - "#{self.bin}", - "-sitelib", - "#{self.lib}", - "-mandir", - "#{self.man}", - "-config", - "#{self.lib}/findlib.conf", - "-no-custom", - "-no-topfind" - ], - [ - "make", - "all" - ], - [ - "make", - "opt" - ] - ], - "install": [ - [ - "make", - "install" - ], - [ - "install", - "-m", - "0755", - "ocaml-stub", - "#{self.bin}/ocaml" - ], - [ - "mkdir", - "-p", - "#{self.toplevel}" - ], - [ - "install", - "-m", - "0644", - "src/findlib/topfind", - "#{self.toplevel}/topfind" - ] - ], - "exportedEnv": { - "OCAML_TOPLEVEL_PATH": { - "val": "#{self.toplevel}", - "scope": "global" - } - } -} diff --git a/esy.lock/overrides/opam__s__ocamlfind_secondary_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch b/esy.lock/overrides/opam__s__ocamlfind_secondary_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch deleted file mode 100644 index 3e3ee5a24f..0000000000 --- a/esy.lock/overrides/opam__s__ocamlfind_secondary_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch +++ /dev/null @@ -1,471 +0,0 @@ ---- ./Makefile -+++ ./Makefile -@@ -57,16 +57,16 @@ - cat findlib.conf.in | \ - $(SH) tools/patch '@SITELIB@' '$(OCAML_SITELIB)' >findlib.conf - if ./tools/cmd_from_same_dir ocamlc; then \ -- echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \ -+ echo 'ocamlc="ocamlc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - if ./tools/cmd_from_same_dir ocamlopt; then \ -- echo 'ocamlopt="ocamlopt.opt"' >>findlib.conf; \ -+ echo 'ocamlopt="ocamlopt.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - if ./tools/cmd_from_same_dir ocamldep; then \ -- echo 'ocamldep="ocamldep.opt"' >>findlib.conf; \ -+ echo 'ocamldep="ocamldep.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - if ./tools/cmd_from_same_dir ocamldoc; then \ -- echo 'ocamldoc="ocamldoc.opt"' >>findlib.conf; \ -+ echo 'ocamldoc="ocamldoc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ - fi - - .PHONY: install-doc ---- ./src/findlib/findlib_config.mlp -+++ ./src/findlib/findlib_config.mlp -@@ -24,3 +24,5 @@ - | "MacOS" -> "" (* don't know *) - | _ -> failwith "Unknown Sys.os_type" - ;; -+ -+let exec_suffix = "@EXEC_SUFFIX@";; ---- ./src/findlib/findlib.ml -+++ ./src/findlib/findlib.ml -@@ -28,15 +28,20 @@ - let conf_ldconf = ref "";; - let conf_ignore_dups_in = ref ([] : string list);; - --let ocamlc_default = "ocamlc";; --let ocamlopt_default = "ocamlopt";; --let ocamlcp_default = "ocamlcp";; --let ocamloptp_default = "ocamloptp";; --let ocamlmklib_default = "ocamlmklib";; --let ocamlmktop_default = "ocamlmktop";; --let ocamldep_default = "ocamldep";; --let ocamlbrowser_default = "ocamlbrowser";; --let ocamldoc_default = "ocamldoc";; -+let add_exec str = -+ match Findlib_config.exec_suffix with -+ | "" -> str -+ | a -> str ^ a ;; -+let ocamlc_default = add_exec "ocamlc";; -+let ocamlopt_default = add_exec "ocamlopt";; -+let ocamlcp_default = add_exec "ocamlcp";; -+let ocamloptp_default = add_exec "ocamloptp";; -+let ocamlmklib_default = add_exec "ocamlmklib";; -+let ocamlmktop_default = add_exec "ocamlmktop";; -+let ocamldep_default = add_exec "ocamldep";; -+let ocamlbrowser_default = add_exec "ocamlbrowser";; -+let ocamldoc_default = add_exec "ocamldoc";; -+ - - - let init_manually ---- ./src/findlib/fl_package_base.ml -+++ ./src/findlib/fl_package_base.ml -@@ -133,7 +133,15 @@ - List.find (fun def -> def.def_var = "exists_if") p.package_defs in - let files = Fl_split.in_words def.def_value in - List.exists -- (fun file -> Sys.file_exists (Filename.concat d' file)) -+ (fun file -> -+ let fln = Filename.concat d' file in -+ let e = Sys.file_exists fln in -+ (* necessary for ppx executables *) -+ if e || Sys.os_type <> "Win32" || Filename.check_suffix fln ".exe" then -+ e -+ else -+ Sys.file_exists (fln ^ ".exe") -+ ) - files - with Not_found -> true in - ---- ./src/findlib/fl_split.ml -+++ ./src/findlib/fl_split.ml -@@ -126,10 +126,17 @@ - | '/' | '\\' -> true - | _ -> false in - let norm_dir_win() = -- if l >= 1 && s.[0] = '/' then -- Buffer.add_char b '\\' else Buffer.add_char b s.[0]; -- if l >= 2 && s.[1] = '/' then -- Buffer.add_char b '\\' else Buffer.add_char b s.[1]; -+ if l >= 1 then ( -+ if s.[0] = '/' then -+ Buffer.add_char b '\\' -+ else -+ Buffer.add_char b s.[0] ; -+ if l >= 2 then -+ if s.[1] = '/' then -+ Buffer.add_char b '\\' -+ else -+ Buffer.add_char b s.[1]; -+ ); - for k = 2 to l - 1 do - let c = s.[k] in - if is_slash c then ( ---- ./src/findlib/frontend.ml -+++ ./src/findlib/frontend.ml -@@ -31,10 +31,18 @@ - else - Sys_error (arg ^ ": " ^ Unix.error_message code) - -+let is_win = Sys.os_type = "Win32" -+ -+let () = -+ match Findlib_config.system with -+ | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" -> -+ (try set_binary_mode_out stdout true with _ -> ()); -+ (try set_binary_mode_out stderr true with _ -> ()); -+ | _ -> () - - let slashify s = - match Findlib_config.system with -- | "mingw" | "mingw64" | "cygwin" -> -+ | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" -> - let b = Buffer.create 80 in - String.iter - (function -@@ -49,7 +57,7 @@ - - let out_path ?(prefix="") s = - match Findlib_config.system with -- | "mingw" | "mingw64" | "cygwin" -> -+ | "win32" | "win64" | "mingw" | "mingw64" | "cygwin" -> - let u = slashify s in - prefix ^ - (if String.contains u ' ' then -@@ -273,11 +281,9 @@ - - - let identify_dir d = -- match Sys.os_type with -- | "Win32" -> -- failwith "identify_dir" (* not available *) -- | _ -> -- let s = Unix.stat d in -+ if is_win then -+ failwith "identify_dir"; (* not available *) -+ let s = Unix.stat d in - (s.Unix.st_dev, s.Unix.st_ino) - ;; - -@@ -459,6 +465,96 @@ - ) - packages - -+let rewrite_cmd s = -+ if s = "" || not is_win then -+ s -+ else -+ let s = -+ let l = String.length s in -+ let b = Buffer.create l in -+ for i = 0 to pred l do -+ match s.[i] with -+ | '/' -> Buffer.add_char b '\\' -+ | x -> Buffer.add_char b x -+ done; -+ Buffer.contents b -+ in -+ if (Filename.is_implicit s && String.contains s '\\' = false) || -+ Filename.check_suffix (String.lowercase s) ".exe" then -+ s -+ else -+ let s' = s ^ ".exe" in -+ if Sys.file_exists s' then -+ s' -+ else -+ s -+ -+let rewrite_cmd s = -+ if s = "" || not is_win then s else -+ let s = -+ let l = String.length s in -+ let b = Buffer.create l in -+ for i = 0 to pred l do -+ match s.[i] with -+ | '/' -> Buffer.add_char b '\\' -+ | x -> Buffer.add_char b x -+ done; -+ Buffer.contents b -+ in -+ if (Filename.is_implicit s && String.contains s '\\' = false) || -+ Filename.check_suffix (String.lowercase s) ".exe" then -+ s -+ else -+ let s' = s ^ ".exe" in -+ if Sys.file_exists s' then -+ s' -+ else -+ s -+ -+let rewrite_pp cmd = -+ if not is_win then cmd else -+ let module T = struct exception Keep end in -+ let is_whitespace = function -+ | ' ' | '\011' | '\012' | '\n' | '\r' | '\t' -> true -+ | _ -> false in -+ (* characters that triggers special behaviour (cmd.exe, not unix shell) *) -+ let is_unsafe_char = function -+ | '(' | ')' | '%' | '!' | '^' | '<' | '>' | '&' -> true -+ | _ -> false in -+ let len = String.length cmd in -+ let buf = Buffer.create (len + 4) in -+ let buf_cmd = Buffer.create len in -+ let rec iter_ws i = -+ if i >= len then () else -+ let cur = cmd.[i] in -+ if is_whitespace cur then ( -+ Buffer.add_char buf cur; -+ iter_ws (succ i) -+ ) -+ else -+ iter_cmd i -+ and iter_cmd i = -+ if i >= len then add_buf_cmd () else -+ let cur = cmd.[i] in -+ if is_unsafe_char cur || cur = '"' || cur = '\'' then -+ raise T.Keep; -+ if is_whitespace cur then ( -+ add_buf_cmd (); -+ Buffer.add_substring buf cmd i (len - i) -+ ) -+ else ( -+ Buffer.add_char buf_cmd cur; -+ iter_cmd (succ i) -+ ) -+ and add_buf_cmd () = -+ if Buffer.length buf_cmd > 0 then -+ Buffer.add_string buf (rewrite_cmd (Buffer.contents buf_cmd)) -+ in -+ try -+ iter_ws 0; -+ Buffer.contents buf -+ with -+ | T.Keep -> cmd - - let process_pp_spec syntax_preds packages pp_opts = - (* Returns: pp_command *) -@@ -549,7 +645,7 @@ - None -> [] - | Some cmd -> - ["-pp"; -- cmd ^ " " ^ -+ (rewrite_cmd cmd) ^ " " ^ - String.concat " " (List.map Filename.quote pp_i_options) ^ " " ^ - String.concat " " (List.map Filename.quote pp_archives) ^ " " ^ - String.concat " " (List.map Filename.quote pp_opts)] -@@ -625,9 +721,11 @@ - in - try - let preprocessor = -+ rewrite_cmd ( - resolve_path - ~base ~explicit:true -- (package_property predicates pname "ppx") in -+ (package_property predicates pname "ppx") ) -+ in - ["-ppx"; String.concat " " (preprocessor :: options)] - with Not_found -> [] - ) -@@ -895,6 +993,14 @@ - switch (e.g. -L instead of -L ) - *) - -+(* We may need to remove files on which we do not have complete control. -+ On Windows, removing a read-only file fails so try to change the -+ mode of the file first. *) -+let remove_file fname = -+ try Sys.remove fname -+ with Sys_error _ when is_win -> -+ (try Unix.chmod fname 0o666 with Unix.Unix_error _ -> ()); -+ Sys.remove fname - - let ocamlc which () = - -@@ -1022,9 +1128,12 @@ - - "-intf", - Arg.String (fun s -> pass_files := !pass_files @ [ Intf(slashify s) ]); -- -+ - "-pp", -- Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" s); -+ Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" (rewrite_pp s)); -+ -+ "-ppx", -+ Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s)); - - "-thread", - Arg.Unit (fun _ -> threads := threads_default); -@@ -1237,7 +1346,7 @@ - with - any -> - close_out initl; -- Sys.remove initl_file_name; -+ remove_file initl_file_name; - raise any - end; - -@@ -1245,9 +1354,9 @@ - at_exit - (fun () -> - let tr f x = try f x with _ -> () in -- tr Sys.remove initl_file_name; -- tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmi"); -- tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmo"); -+ tr remove_file initl_file_name; -+ tr remove_file (Filename.chop_extension initl_file_name ^ ".cmi"); -+ tr remove_file (Filename.chop_extension initl_file_name ^ ".cmo"); - ); - - let exclude_list = [ stdlibdir; threads_dir; vmthreads_dir ] in -@@ -1493,7 +1602,9 @@ - [ "-v", Arg.Unit (fun () -> verbose := Verbose); - "-pp", Arg.String (fun s -> - pp_specified := true; -- options := !options @ ["-pp"; s]); -+ options := !options @ ["-pp"; rewrite_pp s]); -+ "-ppx", Arg.String (fun s -> -+ options := !options @ ["-ppx"; rewrite_pp s]); - ] - ) - ) -@@ -1672,7 +1783,9 @@ - Arg.String (fun s -> add_spec_fn "-I" (slashify (resolve_path s))); - - "-pp", Arg.String (fun s -> pp_specified := true; -- add_spec_fn "-pp" s); -+ add_spec_fn "-pp" (rewrite_pp s)); -+ "-ppx", Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s)); -+ - ] - ) - ) -@@ -1830,7 +1943,10 @@ - output_string ch_out append; - close_out ch_out; - close_in ch_in; -- Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime; -+ (try Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime -+ with Unix.Unix_error(e,_,_) -> -+ prerr_endline("Warning: setting utimes for " ^ outpath -+ ^ ": " ^ Unix.error_message e)); - - prerr_endline("Installed " ^ outpath); - with -@@ -1882,6 +1998,8 @@ - Unix.openfile (Filename.concat dir owner_file) [Unix.O_RDONLY] 0 in - let f = - Unix.in_channel_of_descr fd in -+ if is_win then -+ set_binary_mode_in f false; - try - let line = input_line f in - let is_my_file = (line = pkg) in -@@ -2208,7 +2326,7 @@ - let lines = read_ldconf !ldconf in - let dlldir_norm = Fl_split.norm_dir dlldir in - let dlldir_norm_lc = string_lowercase_ascii dlldir_norm in -- let ci_filesys = (Sys.os_type = "Win32") in -+ let ci_filesys = is_win in - let check_dir d = - let d' = Fl_split.norm_dir d in - (d' = dlldir_norm) || -@@ -2356,7 +2474,7 @@ - List.iter - (fun file -> - let absfile = Filename.concat dlldir file in -- Sys.remove absfile; -+ remove_file absfile; - prerr_endline ("Removed " ^ absfile) - ) - dll_files -@@ -2365,7 +2483,7 @@ - (* Remove the files from the package directory: *) - if Sys.file_exists pkgdir then begin - let files = Sys.readdir pkgdir in -- Array.iter (fun f -> Sys.remove (Filename.concat pkgdir f)) files; -+ Array.iter (fun f -> remove_file (Filename.concat pkgdir f)) files; - Unix.rmdir pkgdir; - prerr_endline ("Removed " ^ pkgdir) - end -@@ -2415,7 +2533,9 @@ - - - let print_configuration() = -+ let sl = slashify in - let dir s = -+ let s = sl s in - if Sys.file_exists s then - s - else -@@ -2453,27 +2573,27 @@ - if md = "" then "the corresponding package directories" else dir md - ); - Printf.printf "The standard library is assumed to reside in:\n %s\n" -- (Findlib.ocaml_stdlib()); -+ (sl (Findlib.ocaml_stdlib())); - Printf.printf "The ld.conf file can be found here:\n %s\n" -- (Findlib.ocaml_ldconf()); -+ (sl (Findlib.ocaml_ldconf())); - flush stdout - | Some "conf" -> -- print_endline (Findlib.config_file()) -+ print_endline (sl (Findlib.config_file())) - | Some "path" -> -- List.iter print_endline (Findlib.search_path()) -+ List.iter ( fun x -> print_endline (sl x)) (Findlib.search_path()) - | Some "destdir" -> -- print_endline (Findlib.default_location()) -+ print_endline ( sl (Findlib.default_location())) - | Some "metadir" -> -- print_endline (Findlib.meta_directory()) -+ print_endline ( sl (Findlib.meta_directory())) - | Some "metapath" -> - let mdir = Findlib.meta_directory() in - let ddir = Findlib.default_location() in -- print_endline -- (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META") -+ print_endline ( sl -+ (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META")) - | Some "stdlib" -> -- print_endline (Findlib.ocaml_stdlib()) -+ print_endline ( sl (Findlib.ocaml_stdlib())) - | Some "ldconf" -> -- print_endline (Findlib.ocaml_ldconf()) -+ print_endline ( sl (Findlib.ocaml_ldconf())) - | _ -> - assert false - ;; -@@ -2481,7 +2601,7 @@ - - let ocamlcall pkg cmd = - let dir = package_directory pkg in -- let path = Filename.concat dir cmd in -+ let path = rewrite_cmd (Filename.concat dir cmd) in - begin - try Unix.access path [ Unix.X_OK ] - with -@@ -2647,6 +2767,10 @@ - | Sys_error f -> - prerr_endline ("ocamlfind: " ^ f); - exit 2 -+ | Unix.Unix_error (e, fn, f) -> -+ prerr_endline ("ocamlfind: " ^ fn ^ " " ^ f -+ ^ ": " ^ Unix.error_message e); -+ exit 2 - | Findlib.No_such_package(pkg,info) -> - prerr_endline ("ocamlfind: Package `" ^ pkg ^ "' not found" ^ - (if info <> "" then " - " ^ info else "")); ---- ./src/findlib/Makefile -+++ ./src/findlib/Makefile -@@ -90,6 +90,7 @@ - cat findlib_config.mlp | \ - $(SH) $(TOP)/tools/patch '@CONFIGFILE@' '$(OCAMLFIND_CONF)' | \ - $(SH) $(TOP)/tools/patch '@STDLIB@' '$(OCAML_CORE_STDLIB)' | \ -+ $(SH) $(TOP)/tools/patch '@EXEC_SUFFIX@' '$(EXEC_SUFFIX)' | \ - sed -e 's;@AUTOLINK@;$(OCAML_AUTOLINK);g' \ - -e 's;@SYSTEM@;$(SYSTEM);g' \ - >findlib_config.ml diff --git a/esy.lock/overrides/opam__s__ocamlfind_secondary_opam__c__1.8.1_opam_override/files/gen-findlib-conf.sh b/esy.lock/overrides/opam__s__ocamlfind_secondary_opam__c__1.8.1_opam_override/files/gen-findlib-conf.sh deleted file mode 100644 index c923ef49eb..0000000000 --- a/esy.lock/overrides/opam__s__ocamlfind_secondary_opam__c__1.8.1_opam_override/files/gen-findlib-conf.sh +++ /dev/null @@ -1,14 +0,0 @@ -OCAML_SECONDARY_COMPILER=$1 - -cat >ocaml-secondary-compiler.conf <META <= "0.9.0"} "astring" "cmdliner" "cppo" {build} diff --git a/package.json b/package.json index c540c8bf63..5b7770fadc 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,10 @@ "Leo White " ], "esy": { - "build": "dune build -p odoc", + "build": "dune build @install", + "install": [ + "dune install --prefix=#{self.install}" + ], "release": { "releasedBinaries": [ "odoc" @@ -29,28 +32,23 @@ "buildsInSource": "_build" }, "dependencies": { - "@opam/alcotest": "0.8.5", - "@opam/astring": "0.8.3", - "@opam/bisect_ppx": "2.4.1", - "@opam/cmdliner": "1.0.2", - "@opam/cppo": "1.6.5", - "@opam/dune": "2.7.1", - "@opam/fpath": "0.7.2", - "@opam/lambdasoup": "0.7.1", + "@opam/alcotest": "^0.8.5", + "@opam/astring": "^0.8.3", + "@opam/bisect_ppx": "^2.4.1", + "@opam/cmdliner": "^1.0.2", + "@opam/cppo": "^1.6.5", + "@opam/dune": "~2.8.0", + "@opam/fpath": "^0.7.2", + "@opam/lambdasoup": "^0.7.1", "@opam/markup": "*", - "@opam/ocamlfind": "1.8.1", + "@opam/ocamlfind": "^1.8.1", "@opam/result": "1.4", "@opam/sexplib0": "*", - "@opam/tyxml": "4.3.0", - "@opam/ocamlfind-secondary":"1.8.1", - "ocaml": "~4.2.0" - }, - "resolutions": { - "@opam/markup": "aantron/markup.ml:markup.opam#9f8e77" + "@opam/tyxml": "^4.3.0", + "@opam/odoc-parser":"^0.9.0", + "ocaml": "^4.8.0" }, "devDependencies": { - "@opam/merlin": "^3.0.3", - "ocaml": "~4.6.0" }, "license": "ISC", "private": false diff --git a/src/document/comment.ml b/src/document/comment.ml index 18b5fec1b7..1061250082 100644 --- a/src/document/comment.ml +++ b/src/document/comment.ml @@ -195,7 +195,8 @@ let rec nestable_block_element : Comment.nestable_block_element -> Block.one = fun content -> match content with | `Paragraph p -> paragraph p - | `Code_block code -> block @@ Source (source_of_code code) + | `Code_block (_, code) -> + block @@ Source (source_of_code (Odoc_model.Location_.value code)) | `Verbatim s -> block @@ Verbatim s | `Modules ms -> module_references ms | `List (kind, items) -> diff --git a/src/loader/dune b/src/loader/dune index a6b842122a..f40d3d4055 100644 --- a/src/loader/dune +++ b/src/loader/dune @@ -22,4 +22,4 @@ (preprocess (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{input-file}))) - (libraries compiler-libs.common odoc_model odoc_parser)) + (libraries compiler-libs.common odoc_model odoc-parser)) diff --git a/src/model/comment.ml b/src/model/comment.ml index 1598555a08..7b50602228 100644 --- a/src/model/comment.ml +++ b/src/model/comment.ml @@ -40,7 +40,7 @@ type module_reference = { type nestable_block_element = [ `Paragraph of paragraph - | `Code_block of string + | `Code_block of string with_location option * string with_location | `Verbatim of string | `Modules of module_reference list | `List of diff --git a/src/model/dune b/src/model/dune index 514d1e3e67..bfe82fb9ea 100644 --- a/src/model/dune +++ b/src/model/dune @@ -12,4 +12,4 @@ (public_name odoc.model) (instrumentation (backend bisect_ppx)) - (libraries result compiler-libs.common odoc_parser)) + (libraries result compiler-libs.common odoc-parser)) diff --git a/src/model/error.ml b/src/model/error.ml index 3c7a6e78db..8127769fb0 100644 --- a/src/model/error.ml +++ b/src/model/error.ml @@ -1,6 +1,6 @@ open Result -type full_location_payload = Odoc_parser.Error.t = { +type full_location_payload = Odoc_parser.Warning.t = { location : Location_.span; message : string; } @@ -8,7 +8,7 @@ type full_location_payload = Odoc_parser.Error.t = { type filename_only_payload = { file : string; message : string } type t = - [ `With_full_location of Odoc_parser.Error.t + [ `With_full_location of Odoc_parser.Warning.t | `With_filename_only of filename_only_payload ] let kasprintf k fmt = @@ -125,12 +125,13 @@ let handle_errors_and_warnings ~warnings_options = function let unpack_warnings ww = (ww.value, List.map (fun w -> w.w) ww.warnings) -let t_of_parser_t : Odoc_parser.Error.t -> t = +let t_of_parser_t : Odoc_parser.Warning.t -> t = fun x -> (`With_full_location x :> t) -let raise_parser_warnings { Odoc_parser.Error.value; warnings } = +let raise_parser_warnings v = (* Parsing errors may be fatal. *) + let warnings = Odoc_parser.warnings v in let non_fatal = false in raise_warnings' (List.map (fun p -> { w = t_of_parser_t p; non_fatal }) warnings); - value + Odoc_parser.ast v diff --git a/src/model/error.mli b/src/model/error.mli index 97b2f28657..28bcc01191 100644 --- a/src/model/error.mli +++ b/src/model/error.mli @@ -60,8 +60,8 @@ val print_errors : t list -> unit val unpack_warnings : 'a with_warnings -> 'a * t list -val t_of_parser_t : Odoc_parser.Error.t -> t +val t_of_parser_t : Odoc_parser.Warning.t -> t (** Convert a parsing error into a [t]. *) -val raise_parser_warnings : 'a Odoc_parser.Error.with_warnings -> 'a +val raise_parser_warnings : Odoc_parser.t -> Odoc_parser.Ast.t (** Like {!raise_warnings} but handle parsing errors. *) diff --git a/src/model/location_.ml b/src/model/location_.ml index 34ba6390ae..2067aa66fb 100644 --- a/src/model/location_.ml +++ b/src/model/location_.ml @@ -1,4 +1,4 @@ -include Odoc_parser.Location +include Odoc_parser.Loc let set_end_as_offset_from_start offset span = { span with end_ = { span.start with column = span.start.column + offset } } diff --git a/src/model/location_.mli b/src/model/location_.mli index ed57d55a6d..f05e877baa 100644 --- a/src/model/location_.mli +++ b/src/model/location_.mli @@ -1,5 +1,5 @@ include module type of struct - include Odoc_parser.Location + include Odoc_parser.Loc end val set_end_as_offset_from_start : int -> span -> span diff --git a/src/model/semantics.ml b/src/model/semantics.ml index d1c19ca66b..aad965b533 100644 --- a/src/model/semantics.ml +++ b/src/model/semantics.ml @@ -2,7 +2,7 @@ module Location = Location_ module Ast = Odoc_parser.Ast type internal_tags_removed = - [ `Tag of Ast.external_tag + [ `Tag of Ast.ocamldoc_tag | `Heading of Ast.heading | Ast.nestable_block_element ] (** {!Ast.block_element} without internal tags. *) @@ -116,8 +116,10 @@ type ast_leaf_inline_element = | `Code_span of string | `Raw_markup of string option * string ] +type sections_allowed = [ `All | `No_titles | `None ] + type status = { - sections_allowed : Odoc_parser.Ast.sections_allowed; + sections_allowed : sections_allowed; parent_of_sections : Paths.Identifier.LabelParent.t; } @@ -250,7 +252,7 @@ and nestable_block_elements status elements = let tag : location:Location.span -> status -> - Ast.external_tag -> + Ast.ocamldoc_tag -> ( Comment.block_element with_location, internal_tags_removed with_location ) Result.result = @@ -459,7 +461,7 @@ let strip_internal_tags ast : internal_tags_removed with_location list * _ = loop tags ast' tl)) | ({ value = - `Tag #Ast.external_tag | `Heading _ | #Ast.nestable_block_element; + `Tag #Ast.ocamldoc_tag | `Heading _ | #Ast.nestable_block_element; _; } as hd) :: tl -> diff --git a/src/model/semantics.mli b/src/model/semantics.mli index dae17874c0..c76012bfd7 100644 --- a/src/model/semantics.mli +++ b/src/model/semantics.mli @@ -6,16 +6,18 @@ type _ handle_internal_tags = : [ `Dot of Paths.Path.Module.t * string ] option handle_internal_tags | Expect_none : unit handle_internal_tags +type sections_allowed = [ `All | `No_titles | `None ] + val ast_to_comment : internal_tags:'tags handle_internal_tags -> - sections_allowed:Odoc_parser.Ast.sections_allowed -> + sections_allowed:sections_allowed -> parent_of_sections:Paths.Identifier.LabelParent.t -> - Odoc_parser.Ast.docs -> + Odoc_parser.Ast.t -> (Comment.docs * 'tags) Error.with_warnings val parse_comment : internal_tags:'tags handle_internal_tags -> - sections_allowed:Odoc_parser.Ast.sections_allowed -> + sections_allowed:sections_allowed -> containing_definition:Paths.Identifier.LabelParent.t -> location:Lexing.position -> text:string -> diff --git a/src/model_desc/comment_desc.ml b/src/model_desc/comment_desc.ml index aab5f62528..ab57fe2e5a 100644 --- a/src/model_desc/comment_desc.ml +++ b/src/model_desc/comment_desc.ml @@ -18,7 +18,7 @@ and general_link_content = general_inline_element with_location list type general_block_element = [ `Paragraph of general_link_content - | `Code_block of string + | `Code_block of string with_location option * string with_location | `Verbatim of string | `Modules of Comment.module_reference list | `List of @@ -88,7 +88,12 @@ let rec block_element : general_block_element t = Variant (function | `Paragraph x -> C ("`Paragraph", x, link_content) - | `Code_block x -> C ("`Code_block", x, string) + | `Code_block (x, y) -> + C + ( "`Code_block", + ( (match x with None -> None | Some x -> Some (ignore_loc x)), + ignore_loc y ), + Pair (Option string, string) ) | `Verbatim x -> C ("`Verbatim", x, string) | `Modules x -> C ("`Modules", x, List module_reference) | `List (x1, x2) -> diff --git a/src/parser/ast.ml b/src/parser/ast.ml deleted file mode 100644 index dd08f47be0..0000000000 --- a/src/parser/ast.ml +++ /dev/null @@ -1,53 +0,0 @@ -type 'a with_location = 'a Location.with_location - -type style = [ `Bold | `Italic | `Emphasis | `Superscript | `Subscript ] - -type reference_kind = [ `Simple | `With_text ] - -type inline_element = - [ `Space of string - | `Word of string - | `Code_span of string - | `Raw_markup of string option * string - | `Styled of style * inline_element with_location list - | `Reference of - reference_kind * string with_location * inline_element with_location list - | `Link of string * inline_element with_location list ] - -type nestable_block_element = - [ `Paragraph of inline_element with_location list - | `Code_block of string - | `Verbatim of string - | `Modules of string with_location list - | `List of - [ `Unordered | `Ordered ] - * [ `Light | `Heavy ] - * nestable_block_element with_location list list ] - -type internal_tag = - [ `Canonical of string with_location | `Inline | `Open | `Closed ] - -type external_tag = - [ `Author of string - | `Deprecated of nestable_block_element with_location list - | `Param of string * nestable_block_element with_location list - | `Raise of string * nestable_block_element with_location list - | `Return of nestable_block_element with_location list - | `See of - [ `Url | `File | `Document ] - * string - * nestable_block_element with_location list - | `Since of string - | `Before of string * nestable_block_element with_location list - | `Version of string ] - -type tag = [ internal_tag | external_tag ] - -type heading = int * string option * inline_element with_location list - -type block_element = - [ nestable_block_element | `Heading of heading | `Tag of tag ] - -type docs = block_element with_location list - -type sections_allowed = [ `All | `No_titles | `None ] diff --git a/src/parser/dune b/src/parser/dune deleted file mode 100644 index 316bf7b695..0000000000 --- a/src/parser/dune +++ /dev/null @@ -1,8 +0,0 @@ -(ocamllex lexer) - -(library - (name odoc_parser) - (public_name odoc.parser) - (instrumentation - (backend bisect_ppx)) - (libraries astring result)) diff --git a/src/parser/error.ml b/src/parser/error.ml deleted file mode 100644 index 63f107e71a..0000000000 --- a/src/parser/error.ml +++ /dev/null @@ -1,39 +0,0 @@ -type t = { location : Location.span; message : string } - -let to_string e = - let { location; message } = e in - let location_string = - if location.start.line = location.end_.line then - Printf.sprintf "line %i, characters %i-%i" location.start.line - location.start.column location.end_.column - else - Printf.sprintf "line %i, character %i to line %i, character %i" - location.start.line location.start.column location.end_.line - location.end_.column - in - Printf.sprintf "File \"%s\", %s:\n%s" location.file location_string message - -let kasprintf k fmt = - Format.(kfprintf (fun _ -> k (flush_str_formatter ())) str_formatter fmt) - -let kmake k ?suggestion format = - format - |> kasprintf (fun message -> - match suggestion with - | None -> k message - | Some suggestion -> k (message ^ "\nSuggestion: " ^ suggestion)) - -let make ?suggestion format = - let k message location = { location; message } in - kmake k ?suggestion format - -type 'a with_warnings = { value : 'a; warnings : t list } - -type warning_accumulator = t list ref - -let accumulate_warnings f = - let warnings = ref [] in - let value = f warnings in - { value; warnings = List.rev !warnings } - -let warning accumulator error = accumulator := error :: !accumulator diff --git a/src/parser/error.mli b/src/parser/error.mli deleted file mode 100644 index d5ee051aab..0000000000 --- a/src/parser/error.mli +++ /dev/null @@ -1,16 +0,0 @@ -type t = { location : Location.span; message : string } - -val to_string : t -> string - -val make : - ?suggestion:string -> - ('a, Format.formatter, unit, Location.span -> t) format4 -> - 'a - -type 'a with_warnings = { value : 'a; warnings : t list } - -type warning_accumulator - -val accumulate_warnings : (warning_accumulator -> 'a) -> 'a with_warnings - -val warning : warning_accumulator -> t -> unit diff --git a/src/parser/lexer.mli b/src/parser/lexer.mli deleted file mode 100644 index f9a0e0a099..0000000000 --- a/src/parser/lexer.mli +++ /dev/null @@ -1,8 +0,0 @@ -type input = { - file : string; - offset_to_location : int -> Location.point; - warnings : Error.warning_accumulator; - lexbuf : Lexing.lexbuf; -} - -val token : input -> Lexing.lexbuf -> Token.t Location.with_location diff --git a/src/parser/lexer.mll b/src/parser/lexer.mll deleted file mode 100644 index e58c211231..0000000000 --- a/src/parser/lexer.mll +++ /dev/null @@ -1,565 +0,0 @@ -{ - -let unescape_word : string -> string = fun s -> - (* The common case is that there are no escape sequences. *) - match String.index s '\\' with - | exception Not_found -> s - | _ -> - let buffer = Buffer.create (String.length s) in - let rec scan_word index = - if index >= String.length s then - () - else - let c = s.[index] in - let c, increment = - match c with - | '\\' -> - if index + 1 < String.length s then - match s.[index + 1] with - | '{' | '}' | '[' | ']' | '@' as c -> c, 2 - | _ -> c, 1 - else c, 1 - | _ -> c, 1 - in - Buffer.add_char buffer c; - scan_word (index + increment) - in - scan_word 0; - Buffer.contents buffer - - - -(* This is used for code and verbatim blocks. It can be done with a regular - expression, but the regexp gets quite ugly, so a function is easier to - understand. *) -let trim_leading_blank_lines : string -> string = fun s -> - let rec scan_for_last_newline : int -> int -> int = - fun index trim_until -> - if index >= String.length s then - String.length s - else - match s.[index] with - | ' ' | '\t' | '\r' -> scan_for_last_newline (index + 1) trim_until - | '\n' -> scan_for_last_newline (index + 1) (index + 1) - | _ -> trim_until - in - let trim_until = scan_for_last_newline 0 0 in - String.sub s trim_until (String.length s - trim_until) - -let trim_trailing_blank_lines : string -> string = fun s -> - let rec scan_for_last_newline : int -> int option -> int option = - fun index trim_from -> - if index < 0 then - Some 0 - else - match s.[index] with - | ' ' | '\t' | '\r' -> scan_for_last_newline (index - 1) trim_from - | '\n' -> scan_for_last_newline (index - 1) (Some index) - | _ -> trim_from - in - let last = String.length s - 1 in - match scan_for_last_newline last None with - | None -> - s - | Some trim_from -> - let trim_from = - if trim_from > 0 && s.[trim_from - 1] = '\r' then - trim_from - 1 - else - trim_from - in - String.sub s 0 trim_from - -(** Returns [None] for an empty, [Some ident] for an indented line. *) -let trim_leading_whitespace : first_line_offset:int -> string -> string = - fun ~first_line_offset s -> - let count_leading_whitespace line = - let rec count_leading_whitespace' index len = - if index = len then None - else - match line.[index] with - | ' ' | '\t' -> count_leading_whitespace' (index + 1) len - | _ -> Some index - in - let len = String.length line in - (* '\r' may remain because we only split on '\n' below. This is important - for the first line, which would be considered not empty without this check. *) - let len = if len > 0 && line.[len - 1] = '\r' then len - 1 else len in - count_leading_whitespace' 0 len - in - - let lines = Astring.String.cuts ~sep:"\n" s in - - let least_amount_of_whitespace = - List.fold_left (fun least_so_far line -> - match (count_leading_whitespace line, least_so_far) with - | (Some _ as n', None) -> n' - | (Some n as n', Some least) when n < least -> n' - | _ -> least_so_far) - in - - let first_line_max_drop, least_amount_of_whitespace = - match lines with - | [] -> 0, None - | first_line :: tl -> - begin match count_leading_whitespace first_line with - | Some n -> - n, least_amount_of_whitespace (Some (first_line_offset + n)) tl - | None -> - 0, least_amount_of_whitespace None tl - end - in - - match least_amount_of_whitespace with - | None -> - s - | Some least_amount_of_whitespace -> - let drop n line = - (* Since blank lines were ignored when calculating - [least_amount_of_whitespace], their length might be less than the - amount. *) - if String.length line < n then line - else String.sub line n (String.length line - n) - in - let lines = - match lines with - | [] -> [] - | first_line :: tl -> - drop (min first_line_max_drop least_amount_of_whitespace) first_line - :: List.map (drop least_amount_of_whitespace) tl - in - String.concat "\n" lines - -type input = { - file : string; - offset_to_location : int -> Location.point; - warnings : Error.warning_accumulator; - lexbuf : Lexing.lexbuf; -} - -let with_location_adjustments - k input ?start_offset ?adjust_start_by ?end_offset ?adjust_end_by value = - - let start = - match start_offset with - | None -> Lexing.lexeme_start input.lexbuf - | Some s -> s - in - let start = - match adjust_start_by with - | None -> start - | Some s -> start + String.length s - in - let end_ = - match end_offset with - | None -> Lexing.lexeme_end input.lexbuf - | Some e -> e - in - let end_ = - match adjust_end_by with - | None -> end_ - | Some s -> end_ - String.length s - in - let location = { - Location.file = input.file; - start = input.offset_to_location start; - end_ = input.offset_to_location end_; - } - in - k input location value - -let emit = - with_location_adjustments (fun _ -> Location.at) - -let warning = - with_location_adjustments (fun input location error -> - Error.warning input.warnings (error location)) - -let reference_token start target = - match start with - | "{!" -> `Simple_reference target - | "{{!" -> `Begin_reference_with_replacement_text target - | "{:" -> `Simple_link target - | "{{:" -> `Begin_link_with_replacement_text target - | _ -> assert false - - - -let trim_leading_space_or_accept_whitespace input start_offset text = - match text.[0] with - | ' ' -> String.sub text 1 (String.length text - 1) - | '\t' | '\r' | '\n' -> text - | exception Invalid_argument _ -> "" - | _ -> - warning - input - ~start_offset - ~end_offset:(start_offset + 2) - Parse_error.no_leading_whitespace_in_verbatim; - text - -let trim_trailing_space_or_accept_whitespace text = - match text.[String.length text - 1] with - | ' ' -> String.sub text 0 (String.length text - 1) - | '\t' | '\r' | '\n' -> text - | _ -> text - | exception Invalid_argument _ -> text - -let emit_verbatim input start_offset buffer = - let t = Buffer.contents buffer in - let t = trim_trailing_space_or_accept_whitespace t in - let t = trim_leading_space_or_accept_whitespace input start_offset t in - let t = trim_leading_blank_lines t in - let t = trim_trailing_blank_lines t in - emit input (`Verbatim t) ~start_offset - -let emit_code_block input c = - let c = trim_trailing_blank_lines c in - let c = - with_location_adjustments - (fun _ location c -> - let first_line_offset = location.start.column + 2 (* Length of {[ *) in - trim_leading_whitespace ~first_line_offset c) - input c - in - let c = trim_leading_blank_lines c in - emit input (`Code_block c) - - - -let heading_level input level = - if String.length level >= 2 && level.[0] = '0' then begin - warning - input ~start_offset:1 (Parse_error.leading_zero_in_heading_level level) - end; - int_of_string level - -} - - - -let markup_char = - ['{' '}' '[' ']' '@'] -let space_char = - [' ' '\t' '\n' '\r'] -let bullet_char = - ['-' '+'] - -let word_char = - (_ # markup_char # space_char # bullet_char) | ('\\' markup_char) - -let horizontal_space = - [' ' '\t'] -let newline = - '\n' | "\r\n" - -let reference_start = - "{!" | "{{!" | "{:" | "{{:" - -let code_block_text = - ([^ ']'] | ']'+ [^ ']' '}'])* ']'* -let raw_markup = - ([^ '%'] | '%'+ [^ '%' '}'])* '%'* -let raw_markup_target = - ([^ ':' '%'] | '%'+ [^ ':' '%' '}'])* '%'* - - - -rule token input = parse - | horizontal_space* eof - { emit input `End } - - | ((horizontal_space* newline as prefix) - horizontal_space* ((newline horizontal_space*)+ as suffix) as ws) - { emit input (`Blank_line ws) ~adjust_start_by:prefix ~adjust_end_by:suffix } - - | (horizontal_space* newline horizontal_space* as ws) - { emit input (`Single_newline ws) } - - | (horizontal_space+ as ws) - { emit input (`Space ws) } - - | (horizontal_space* (newline horizontal_space*)? as p) '}' - { emit input `Right_brace ~adjust_start_by:p } - - | word_char (word_char | bullet_char | '@')* - | bullet_char (word_char | bullet_char | '@')+ as w - { emit input (`Word (unescape_word w)) } - - | '[' - { code_span - (Buffer.create 1024) 0 (Lexing.lexeme_start lexbuf) input lexbuf } - - | '-' - { emit input `Minus } - - | '+' - { emit input `Plus } - - | "{b" - { emit input (`Begin_style `Bold) } - - | "{i" - { emit input (`Begin_style `Italic) } - - | "{e" - { emit input (`Begin_style `Emphasis) } - - | "{L" - { emit input (`Begin_paragraph_style `Left) } - - | "{C" - { emit input (`Begin_paragraph_style `Center) } - - | "{R" - { emit input (`Begin_paragraph_style `Right) } - - | "{^" - { emit input (`Begin_style `Superscript) } - - | "{_" - { emit input (`Begin_style `Subscript) } - - | "{!modules:" ([^ '}']* as modules) '}' - { emit input (`Modules modules) } - - | (reference_start as start) ([^ '}']* as target) '}' - { emit input (reference_token start target) } - - | "{[" (code_block_text as c) "]}" - { emit_code_block input c } - - | "{v" - { verbatim - (Buffer.create 1024) None (Lexing.lexeme_start lexbuf) input lexbuf } - - | "{%" ((raw_markup_target as target) ':')? (raw_markup as s) - ("%}" | eof as e) - { let token = `Raw_markup (target, s) in - if e <> "%}" then - warning - input - ~start_offset:(Lexing.lexeme_end lexbuf) - (Parse_error.not_allowed - ~what:(Token.describe `End) - ~in_what:(Token.describe token)); - emit input token } - - | "{ul" - { emit input (`Begin_list `Unordered) } - - | "{ol" - { emit input (`Begin_list `Ordered) } - - | "{li" - { emit input (`Begin_list_item `Li) } - - | "{-" - { emit input (`Begin_list_item `Dash) } - - | '{' (['0'-'9']+ as level) ':' (([^ '}'] # space_char)* as label) - { emit - input (`Begin_section_heading (heading_level input level, Some label)) } - - | '{' (['0'-'9']+ as level) - { emit input (`Begin_section_heading (heading_level input level, None)) } - - | "@author" ((horizontal_space+ [^ '\r' '\n']*)? as author) - { emit input (`Tag (`Author author)) } - - | "@deprecated" - { emit input (`Tag `Deprecated) } - - | "@param" horizontal_space+ ((_ # space_char)+ as name) - { emit input (`Tag (`Param name)) } - - | ("@raise" | "@raises") horizontal_space+ ((_ # space_char)+ as name) - { emit input (`Tag (`Raise name)) } - - | ("@return" | "@returns") - { emit input (`Tag `Return) } - - | "@see" horizontal_space* '<' ([^ '>']* as url) '>' - { emit input (`Tag (`See (`Url, url))) } - - | "@see" horizontal_space* '\'' ([^ '\'']* as filename) '\'' - { emit input (`Tag (`See (`File, filename))) } - - | "@see" horizontal_space* '"' ([^ '"']* as name) '"' - { emit input (`Tag (`See (`Document, name))) } - - | "@since" ((horizontal_space+ [^ '\r' '\n']*)? as version) - { emit input (`Tag (`Since version)) } - - | "@before" horizontal_space+ ((_ # space_char)+ as version) - { emit input (`Tag (`Before version)) } - - | "@version" ((horizontal_space+ [^ '\r' '\n']*)? as version) - { emit input (`Tag (`Version version)) } - - | "@canonical" ((horizontal_space+ [^ '\r' '\n']*)? as identifier) - { emit input (`Tag (`Canonical identifier)) } - - | "@inline" - { emit input (`Tag `Inline) } - - | "@open" - { emit input (`Tag `Open) } - - | "@closed" - { emit input (`Tag `Closed) } - - - - | '{' - { try bad_markup_recovery (Lexing.lexeme_start lexbuf) input lexbuf - with Failure _ -> - warning - input - (Parse_error.bad_markup - "{" ~suggestion:"escape the brace with '\\{'."); - emit input (`Word "{") } - - | ']' - { warning input Parse_error.unpaired_right_bracket; - emit input (`Word "]") } - - | "@param" - { warning input Parse_error.truncated_param; - emit input (`Tag (`Param "")) } - - | ("@raise" | "@raises") as tag - { warning input (Parse_error.truncated_raise tag); - emit input (`Tag (`Raise "")) } - - | "@before" - { warning input Parse_error.truncated_before; - emit input (`Tag (`Before "")) } - - | "@see" - { warning input Parse_error.truncated_see; - emit input (`Word "@see") } - - | '@' ['a'-'z' 'A'-'Z']+ as tag - { warning input (Parse_error.unknown_tag tag); - emit input (`Word tag) } - - | '@' - { warning input Parse_error.stray_at; - emit input (`Word "@") } - - | '\r' - { warning input Parse_error.stray_cr; - token input lexbuf } - - | "{!modules:" ([^ '}']* as modules) eof - { warning - input - ~start_offset:(Lexing.lexeme_end lexbuf) - (Parse_error.not_allowed - ~what:(Token.describe `End) - ~in_what:(Token.describe (`Modules ""))); - emit input (`Modules modules) } - - | (reference_start as start) ([^ '}']* as target) eof - { warning - input - ~start_offset:(Lexing.lexeme_end lexbuf) - (Parse_error.not_allowed - ~what:(Token.describe `End) - ~in_what:(Token.describe (reference_token start ""))); - emit input (reference_token start target) } - - | "{[" (code_block_text as c) eof - { warning - input - ~start_offset:(Lexing.lexeme_end lexbuf) - (Parse_error.not_allowed - ~what:(Token.describe `End) - ~in_what:(Token.describe (`Code_block ""))); - emit_code_block input c } - - - -and code_span buffer nesting_level start_offset input = parse - | ']' - { if nesting_level = 0 then - emit input (`Code_span (Buffer.contents buffer)) ~start_offset - else begin - Buffer.add_char buffer ']'; - code_span buffer (nesting_level - 1) start_offset input lexbuf - end } - - | '[' - { Buffer.add_char buffer '['; - code_span buffer (nesting_level + 1) start_offset input lexbuf } - - | '\\' ('[' | ']' as c) - { Buffer.add_char buffer c; - code_span buffer nesting_level start_offset input lexbuf } - - | newline newline - { warning - input - (Parse_error.not_allowed - ~what:(Token.describe (`Blank_line "\n\n")) - ~in_what:(Token.describe (`Code_span ""))); - Buffer.add_char buffer '\n'; - code_span buffer nesting_level start_offset input lexbuf } - - | eof - { warning - input - (Parse_error.not_allowed - ~what:(Token.describe `End) - ~in_what:(Token.describe (`Code_span ""))); - emit input (`Code_span (Buffer.contents buffer)) ~start_offset } - - | _ as c - { Buffer.add_char buffer c; - code_span buffer nesting_level start_offset input lexbuf } - - - -and verbatim buffer last_false_terminator start_offset input = parse - | (space_char as c) "v}" - { Buffer.add_char buffer c; - emit_verbatim input start_offset buffer } - - | "v}" - { Buffer.add_string buffer "v}"; - verbatim - buffer (Some (Lexing.lexeme_start lexbuf)) start_offset input lexbuf } - - | eof - { begin match last_false_terminator with - | None -> - warning - input - (Parse_error.not_allowed - ~what:(Token.describe `End) - ~in_what:(Token.describe (`Verbatim ""))) - | Some location -> - warning - input - ~start_offset:location - ~end_offset:(location + 2) - Parse_error.no_trailing_whitespace_in_verbatim - end; - emit_verbatim input start_offset buffer } - - | _ as c - { Buffer.add_char buffer c; - verbatim buffer last_false_terminator start_offset input lexbuf } - - - -and bad_markup_recovery start_offset input = parse - | [^ '}']+ as text '}' as rest - { let suggestion = - Printf.sprintf "did you mean '{!%s}' or '[%s]'?" text text in - warning - input - ~start_offset - (Parse_error.bad_markup ("{" ^ rest) ~suggestion); - emit input (`Code_span text) ~start_offset} diff --git a/src/parser/location.ml b/src/parser/location.ml deleted file mode 100644 index 9e2a5668db..0000000000 --- a/src/parser/location.ml +++ /dev/null @@ -1,30 +0,0 @@ -type point = { line : int; column : int } - -type span = { file : string; start : point; end_ : point } - -type +'a with_location = { location : span; value : 'a } - -let at location value = { location; value } - -let location { location; _ } = location - -let value { value; _ } = value - -let map f annotated = { annotated with value = f annotated.value } - -let same annotated value = { annotated with value } - -let span spans = - match spans with - | [] -> - { - file = "_none_"; - start = { line = 1; column = 0 }; - end_ = { line = 1; column = 0 }; - } - | first :: spans -> - let last = List.fold_left (fun _ span -> span) first spans in - { file = first.file; start = first.start; end_ = last.end_ } - -let nudge_start offset span = - { span with start = { span.start with column = span.start.column + offset } } diff --git a/src/parser/location.mli b/src/parser/location.mli deleted file mode 100644 index c4a59baac1..0000000000 --- a/src/parser/location.mli +++ /dev/null @@ -1,21 +0,0 @@ -type point = { line : int; column : int } - -type span = { file : string; start : point; end_ : point } - -type +'a with_location = { location : span; value : 'a } - -val at : span -> 'a -> 'a with_location - -val location : 'a with_location -> span - -val value : 'a with_location -> 'a - -val map : ('a -> 'b) -> 'a with_location -> 'b with_location - -val same : _ with_location -> 'b -> 'b with_location - -val span : span list -> span - -(* This adjusts only the column number, implicitly assuming that the offset does - not move the location across a newline character. *) -val nudge_start : int -> span -> span diff --git a/src/parser/odoc_parser.ml b/src/parser/odoc_parser.ml deleted file mode 100644 index 4af612c189..0000000000 --- a/src/parser/odoc_parser.ml +++ /dev/null @@ -1,82 +0,0 @@ -module Ast = Ast -module Location = Location -module Error = Error - -(* odoc uses an ocamllex lexer. The "engine" for such lexers is the standard - [Lexing] module. - - As the [Lexing] module reads the input, it keeps track of only the byte - offset into the input. It is normally the job of each particular lexer - implementation to decide which character sequences count as newlines, and - keep track of line/column locations. This is usually done by writing several - extra regular expressions, and calling [Lexing.new_line] at the right time. - - Keeping track of newlines like this makes the odoc lexer somewhat too - diffiult to read, however. To factor the aspect of keeping track of newlines - fully out of the odoc lexer, instead of having it keep track of newlines as - it's scanning the input, the input is pre-scanned before feeding it into the - lexer. A table of all the newlines is assembled, and used to convert offsets - into line/column pairs after the lexer emits tokens. - - [offset_to_location ~input ~comment_location offset] converts the byte - [offset], relative to the beginning of a comment, into a location, relative - to the beginning of the file containing the comment. [input] is the comment - text, and [comment_location] is the location of the comment within its file. - The function is meant to be partially applied to its first two arguments, at - which point it creates the table described above. The remaining function is - then passed to the lexer, so it can apply the table to its emitted tokens. *) -let offset_to_location : - input:string -> comment_location:Lexing.position -> int -> Location.point = - fun ~input ~comment_location -> - let rec find_newlines line_number input_index newlines_accumulator = - if input_index >= String.length input then newlines_accumulator - else if - (* This is good enough to detect CR-LF also. *) - input.[input_index] = '\n' - then - find_newlines (line_number + 1) (input_index + 1) - ((line_number + 1, input_index + 1) :: newlines_accumulator) - else find_newlines line_number (input_index + 1) newlines_accumulator - in - - let reversed_newlines : (int * int) list = find_newlines 1 0 [ (1, 0) ] in - - fun byte_offset -> - let rec scan_to_last_newline reversed_newlines_prefix = - match reversed_newlines_prefix with - | [] -> assert false - | (line_in_comment, line_start_offset) :: prefix -> - if line_start_offset > byte_offset then scan_to_last_newline prefix - else - let column_in_comment = byte_offset - line_start_offset in - let line_in_file = - line_in_comment + comment_location.Lexing.pos_lnum - 1 - in - let column_in_file = - if line_in_comment = 1 then - column_in_comment + comment_location.Lexing.pos_cnum - - comment_location.Lexing.pos_bol - else column_in_comment - in - { Location.line = line_in_file; column = column_in_file } - in - scan_to_last_newline reversed_newlines - -let parse_comment ~location ~text = - Error.accumulate_warnings (fun warnings -> - let token_stream = - let lexbuf = Lexing.from_string text in - let offset_to_location = - offset_to_location ~input:text ~comment_location:location - in - let input : Lexer.input = - { - file = location.Lexing.pos_fname; - offset_to_location; - warnings; - lexbuf; - } - in - Stream.from (fun _token_index -> Some (Lexer.token input lexbuf)) - in - Syntax.parse warnings token_stream) diff --git a/src/parser/odoc_parser.mli b/src/parser/odoc_parser.mli deleted file mode 100644 index c9513338df..0000000000 --- a/src/parser/odoc_parser.mli +++ /dev/null @@ -1,13 +0,0 @@ -module Ast = Ast -module Location = Location - -module Error : sig - type t = Error.t = { location : Location.span; message : string } - - val to_string : t -> string - - type 'a with_warnings = { value : 'a; warnings : t list } -end - -val parse_comment : - location:Lexing.position -> text:string -> Ast.docs Error.with_warnings diff --git a/src/parser/parse_error.ml b/src/parser/parse_error.ml deleted file mode 100644 index 4f054dcc57..0000000000 --- a/src/parser/parse_error.ml +++ /dev/null @@ -1,67 +0,0 @@ -let capitalize_ascii = Astring.String.Ascii.capitalize - -let bad_markup : ?suggestion:string -> string -> Location.span -> Error.t = - fun ?suggestion -> Error.make ?suggestion "'%s': bad markup." - -let leading_zero_in_heading_level : string -> Location.span -> Error.t = - Error.make "'%s': leading zero in heading level." - -let should_not_be_empty : what:string -> Location.span -> Error.t = - fun ~what -> Error.make "%s should not be empty." (capitalize_ascii what) - -let markup_should_not_be_used : what:string -> Location.span -> Error.t = - fun ~what -> - Error.make "%s should not be used because it has no effect." - (capitalize_ascii what) - -let should_begin_on_its_own_line : what:string -> Location.span -> Error.t = - fun ~what -> - Error.make "%s should begin on its own line." (capitalize_ascii what) - -let should_be_followed_by_whitespace : what:string -> Location.span -> Error.t = - fun ~what -> - Error.make "%s should be followed by space, a tab, or a new line." - (capitalize_ascii what) - -let not_allowed : - ?suggestion:string -> - what:string -> - in_what:string -> - Location.span -> - Error.t = - fun ?suggestion ~what ~in_what -> - Error.make ?suggestion "%s is not allowed in %s." (capitalize_ascii what) - in_what - -let no_leading_whitespace_in_verbatim : Location.span -> Error.t = - Error.make "'{v' should be followed by whitespace." - -let no_trailing_whitespace_in_verbatim : Location.span -> Error.t = - Error.make "'v}' should be preceded by whitespace." - -let stray_at : Location.span -> Error.t = Error.make "Stray '@'." - -let stray_cr : Location.span -> Error.t = - Error.make "Stray '\\r' (carriage return character)." - -let truncated_before : Location.span -> Error.t = - Error.make "'@before' expects version number on the same line." - -let truncated_param : Location.span -> Error.t = - Error.make "'@param' expects parameter name on the same line." - -let truncated_raise : string -> Location.span -> Error.t = - Error.make "'%s' expects exception constructor on the same line." - -let truncated_see : Location.span -> Error.t = - Error.make - "'@see' should be followed by , 'file', or \"document title\"." - -let unknown_tag : string -> Location.span -> Error.t = - Error.make "Unknown tag '%s'." - -let unpaired_right_brace : Location.span -> Error.t = - Error.make ~suggestion:"try '\\}'." "Unpaired '}' (end of markup)." - -let unpaired_right_bracket : Location.span -> Error.t = - Error.make ~suggestion:"try '\\]'." "Unpaired ']' (end of code)." diff --git a/src/parser/syntax.ml b/src/parser/syntax.ml deleted file mode 100644 index a21fd25ff0..0000000000 --- a/src/parser/syntax.ml +++ /dev/null @@ -1,1099 +0,0 @@ -(* This module is a recursive descent parser for the ocamldoc syntax. The parser - consumes a token stream of type [Token.t Stream.t], provided by the lexer, - and produces a comment AST of the type defined in [Parser_.Ast]. - - The AST has two main levels: inline elements, which can appear inside - paragraphs, and are spaced horizontally when presented, and block elements, - such as paragraphs and lists, which are spaced vertically when presented. - Block elements contain inline elements, but not vice versa. - - Corresponding to this, the parser has three "main" functions: - - - [delimited_inline_element_list] parses a run of inline elements that is - delimited by curly brace markup ([{...}]). - - [paragraph] parses a run of inline elements that make up a paragraph, and - is not explicitly delimited with curly braces. - - [block_element_list] parses a sequence of block elements. A comment is a - sequence of block elements, so [block_element_list] is the top-level - parser. It is also used for list item and tag content. *) - -module Location = Location - -type 'a with_location = 'a Location.with_location - -(* {2 Input} *) - -type input = { - tokens : Token.t Location.with_location Stream.t; - warnings : Error.warning_accumulator; -} - -let junk input = Stream.junk input.tokens - -let peek input = - match Stream.peek input.tokens with - | Some token -> token - | None -> assert false - -(* The last token in the stream is always [`End], and it is never consumed by - the parser, so the [None] case is impossible. *) - -let npeek n input = Stream.npeek n input.tokens - -(* {2 Non-link inline elements} *) -type style = [ `Bold | `Italic | `Emphasis | `Superscript | `Subscript ] - -(* Convenient abbreviation for use in patterns. *) -type token_that_always_begins_an_inline_element = - [ `Word of string - | `Code_span of string - | `Raw_markup of string option * string - | `Begin_style of style - | `Simple_reference of string - | `Begin_reference_with_replacement_text of string - | `Simple_link of string - | `Begin_link_with_replacement_text of string ] - -(* Check that the token constructors above actually are all in [Token.t]. *) -let _check_subset : token_that_always_begins_an_inline_element -> Token.t = - fun t -> (t :> Token.t) - -(* Consumes tokens that make up a single non-link inline element: - - - a horizontal space ([`Space], significant in inline elements), - - a word (see [word]), - - a code span ([...], [`Code_span _]), or - - styled text ({e ...}). - - The latter requires a recursive call to [delimited_inline_element_list], - defined below. - - This should be part of [delimited_inline_element_list]; however, it is also - called by function [paragraph]. As a result, it is factored out, and made - mutually-recursive with [delimited_inline_element_list]. - - This is called only when it is known that the first token in the list is the - beginning of an inline element. In the case of [`Minus] and [`Plus], that - means the caller has determined that they are not a list bullet (i.e., not - the first non-whitespace tokens on their line). - - This function consumes exactly the tokens that make up the element. *) -let rec inline_element : - input -> Location.span -> _ -> Ast.inline_element with_location = - fun input location next_token -> - match next_token with - | `Space _ as token -> - junk input; - Location.at location token - | `Word _ as token -> - junk input; - Location.at location token - (* This is actually the same memory representation as the token, complete - with location, and is probably the most common case. Perhaps the token - can be reused somehow. The same is true of [`Space], [`Code_span]. *) - | `Minus -> - junk input; - Location.at location (`Word "-") - | `Plus -> - junk input; - Location.at location (`Word "+") - | `Code_span c -> - junk input; - Location.at location (`Code_span c) - | `Raw_markup (raw_markup_target, s) -> - junk input; - Location.at location (`Raw_markup (raw_markup_target, s)) - | `Begin_style s as parent_markup -> - junk input; - - let requires_leading_whitespace = - match s with - | `Bold | `Italic | `Emphasis -> true - | `Superscript | `Subscript -> false - in - let content, brace_location = - delimited_inline_element_list ~parent_markup - ~parent_markup_location:location ~requires_leading_whitespace input - in - - let location = Location.span [ location; brace_location ] in - - if content = [] then - Parse_error.should_not_be_empty - ~what:(Token.describe parent_markup) - location - |> Error.warning input.warnings; - - Location.at location (`Styled (s, content)) - | `Simple_reference r -> - junk input; - - let r_location = Location.nudge_start (String.length "{!") location in - let r = Location.at r_location r in - - Location.at location (`Reference (`Simple, r, [])) - | `Begin_reference_with_replacement_text r as parent_markup -> - junk input; - - let r_location = Location.nudge_start (String.length "{{!") location in - let r = Location.at r_location r in - - let content, brace_location = - delimited_inline_element_list ~parent_markup - ~parent_markup_location:location ~requires_leading_whitespace:false - input - in - - let location = Location.span [ location; brace_location ] in - - if content = [] then - Parse_error.should_not_be_empty - ~what:(Token.describe parent_markup) - location - |> Error.warning input.warnings; - - Location.at location (`Reference (`With_text, r, content)) - | `Simple_link u -> - junk input; - - let u = String.trim u in - - if u = "" then - Parse_error.should_not_be_empty - ~what:(Token.describe next_token) - location - |> Error.warning input.warnings; - - Location.at location (`Link (u, [])) - | `Begin_link_with_replacement_text u as parent_markup -> - junk input; - - let u = String.trim u in - - if u = "" then - Parse_error.should_not_be_empty - ~what:(Token.describe parent_markup) - location - |> Error.warning input.warnings; - - let content, brace_location = - delimited_inline_element_list ~parent_markup - ~parent_markup_location:location ~requires_leading_whitespace:false - input - in - - `Link (u, content) - |> Location.at (Location.span [ location; brace_location ]) - -(* Consumes tokens that make up a sequence of inline elements that is ended by - a '}', a [`Right_brace] token. The brace token is also consumed. - - The sequences are also preceded by some markup like '{b'. Some of these - markup tokens require whitespace immediately after the token, and others not. - The caller indicates which way that is through the - [~requires_leading_whitespace] argument. - - Whitespace is significant in inline element lists. In particular, "foo [bar]" - is represented as [`Word "foo"; `Space; `Code_span "bar"], while "foo[bar]" - is [`Word "foo"; `Code_span "bar"]. It doesn't matter how much whitespace is - there, just whether it is present or not. Single newlines and horizontal - space in any amount are allowed. Blank lines are not, as these are separators - for {e block} elements. - - In correct input, the first and last elements emitted will not be [`Space], - i.e. [`Space] appears only between other non-link inline elements. In - incorrect input, there might be [`Space] followed immediately by something - like an @author tag. - - The [~parent_markup] and [~parent_markup_location] arguments are used for - generating error messages. *) -and delimited_inline_element_list : - parent_markup:[< Token.t ] -> - parent_markup_location:Location.span -> - requires_leading_whitespace:bool -> - input -> - Ast.inline_element with_location list * Location.span = - fun ~parent_markup ~parent_markup_location ~requires_leading_whitespace input -> - (* [~at_start_of_line] is used to interpret [`Minus] and [`Plus]. These are - word tokens if not the first non-whitespace tokens on their line. Then, - they are allowed in a non-link element list. *) - let rec consume_elements : - at_start_of_line:bool -> - Ast.inline_element with_location list -> - Ast.inline_element with_location list * Location.span = - fun ~at_start_of_line acc -> - let next_token = peek input in - match next_token.value with - | `Right_brace -> - junk input; - (List.rev acc, next_token.location) - (* The [`Space] token is not space at the beginning or end of line, because - that is combined into [`Single_newline] or [`Blank_line] tokens. It is - also not at the beginning of markup (after e.g. '{b'), because that is - handled separately before calling - [consume_non_link_inline_elements], and not immediately before '}', - because that is combined into the [`Right_brace] token by the lexer. So, - it is an internal space, and we want to add it to the non-link inline - element list. *) - | (`Space _ | #token_that_always_begins_an_inline_element) as token -> - let acc = inline_element input next_token.location token :: acc in - consume_elements ~at_start_of_line:false acc - | `Single_newline ws -> - junk input; - let element = Location.same next_token (`Space ws) in - consume_elements ~at_start_of_line:true (element :: acc) - | `Blank_line ws as blank -> - Parse_error.not_allowed ~what:(Token.describe blank) - ~in_what:(Token.describe parent_markup) - next_token.location - |> Error.warning input.warnings; - - junk input; - let element = Location.same next_token (`Space ws) in - consume_elements ~at_start_of_line:true (element :: acc) - | (`Minus | `Plus) as bullet -> - (if at_start_of_line then - let suggestion = - Printf.sprintf "move %s so it isn't the first thing on the line." - (Token.print bullet) - in - Parse_error.not_allowed ~what:(Token.describe bullet) - ~in_what:(Token.describe parent_markup) - ~suggestion next_token.location - |> Error.warning input.warnings); - - let acc = inline_element input next_token.location bullet :: acc in - consume_elements ~at_start_of_line:false acc - | other_token -> - Parse_error.not_allowed - ~what:(Token.describe other_token) - ~in_what:(Token.describe parent_markup) - next_token.location - |> Error.warning input.warnings; - - let last_location = - match acc with - | last_token :: _ -> last_token.location - | [] -> parent_markup_location - in - - (List.rev acc, last_location) - in - - let first_token = peek input in - match first_token.value with - | `Space _ -> - junk input; - consume_elements ~at_start_of_line:false [] - (* [~at_start_of_line] is [false] here because the preceding token was some - some markup like '{b', and we didn't move to the next line, so the next - token will not be the first non-whitespace token on its line. *) - | `Single_newline _ -> - junk input; - consume_elements ~at_start_of_line:true [] - | `Blank_line _ as blank -> - (* In case the markup is immediately followed by a blank line, the error - message printed by the catch-all case below can be confusing, as it will - suggest that the markup must be followed by a newline (which it is). It - just must not be followed by two newlines. To explain that clearly, - handle that case specifically. *) - Parse_error.not_allowed ~what:(Token.describe blank) - ~in_what:(Token.describe parent_markup) - first_token.location - |> Error.warning input.warnings; - - junk input; - consume_elements ~at_start_of_line:true [] - | `Right_brace -> - junk input; - ([], first_token.location) - | _ -> - if requires_leading_whitespace then - Parse_error.should_be_followed_by_whitespace - ~what:(Token.print parent_markup) - parent_markup_location - |> Error.warning input.warnings; - consume_elements ~at_start_of_line:false [] - -(* {2 Paragraphs} *) - -(* Consumes tokens that make up a paragraph. - - A paragraph is a sequence of inline elements that ends on a blank line, or - explicit block markup such as a verbatim block on a new line. - - Because of the significance of newlines, paragraphs are parsed line-by-line. - The function [paragraph] is called only when the current token is the first - non-whitespace token on its line, and begins an inline element. [paragraph] - then parses a line of inline elements. Afterwards, it looks ahead to the next - line. If that line also begins with an inline element, it parses that line, - and so on. *) -let paragraph : input -> Ast.nestable_block_element with_location = - fun input -> - (* Parses a single line of a paragraph, consisting of inline elements. The - only valid ways to end a paragraph line are with [`End], [`Single_newline], - [`Blank_line], and [`Right_brace]. Everything else either belongs in the - paragraph, or signifies an attempt to begin a block element inside a - paragraph line, which is an error. These errors are caught elsewhere; the - paragraph parser just stops. *) - let rec paragraph_line : - Ast.inline_element with_location list -> - Ast.inline_element with_location list = - fun acc -> - let next_token = peek input in - match next_token.value with - | (`Space _ | `Minus | `Plus | #token_that_always_begins_an_inline_element) - as token -> - let element = inline_element input next_token.location token in - paragraph_line (element :: acc) - | _ -> acc - in - - (* After each line is parsed, decides whether to parse more lines. *) - let rec additional_lines : - Ast.inline_element with_location list -> - Ast.inline_element with_location list = - fun acc -> - match npeek 2 input with - | { value = `Single_newline ws; location } - :: { value = #token_that_always_begins_an_inline_element; _ } :: _ -> - junk input; - let acc = Location.at location (`Space ws) :: acc in - let acc = paragraph_line acc in - additional_lines acc - | _ -> List.rev acc - in - - let elements = paragraph_line [] |> additional_lines in - `Paragraph elements - |> Location.at (Location.span (List.map Location.location elements)) - -(* {2 Block elements} *) - -(* {3 Helper types} *) - -(* The interpretation of tokens in the block parser depends on where on a line - each token appears. The five possible "locations" are: - - - [`At_start_of_line], when only whitespace has been read on the current - line. - - [`After_tag], when a valid tag token, such as [@deprecated], has been read, - and only whitespace has been read since. - - [`After_shorthand_bullet], when a valid shorthand list item bullet, such as - [-], has been read, and only whitespace has been read since. - - [`After_explicit_list_bullet], when a valid explicit bullet, such as [{li], - has been read, and only whitespace has been read since. - - [`After_text], when any other valid non-whitespace token has already been - read on the current line. - - Here are some examples of how this affects the interpretation of tokens: - - - A paragraph can start anywhere except [`After_text] (two paragraphs cannot - be on the same line, but paragraphs can be nested in just about anything). - - [`Minus] is interpreted as a list item bullet [`At_start_of_line], - [`After_tag], and [`After_explicit_list_bullet]. - - Tags are only allowed [`At_start_of_line]. - - To track the location accurately, the functions that make up the block parser - pass explicit [where_in_line] values around and return them. - - In a few cases, [where_in_line] can be inferred from what helper was called. - For example, the [paragraph] parser always stops on the same line as the last - significant token that is in the paragraph it consumed, so the location must - be [`After_text]. *) -type where_in_line = - [ `At_start_of_line - | `After_tag - | `After_shorthand_bullet - | `After_explicit_list_bullet - | `After_text ] - -(* The block parsing loop, function [block_element_list], stops when it - encounters certain tokens. - - When it is called for the whole comment, or for in explicit list item - ([{li foo}]), it can only stop on end of input or a right brace. - - When it is called inside a shorthand list item ([- foo]), it stops on end of - input, right brace, a blank line (indicating end of shorthand list), plus or - minus (indicating the start of the next liste item), or a section heading or - tag, which cannot be nested in list markup. - - The block parser [block_element_list] explicitly returns the token that - stopped it, with a type more precise than [Token.t stream_head]: if it was - called for the whole comment or an explicit list item, the stop token will - have type [stops_at_delimiters stream_head], and if it was called for a - shorthand list item, the stop token will have type - [implicit_stop stream_head]. This allows the calling parsers to write precise - cases for exactly the tokens that might be at the front of the stream after - the block parser returns. *) -type stops_at_delimiters = [ `End | `Right_brace ] - -type stopped_implicitly = - [ `End - | `Blank_line of string - | `Right_brace - | `Minus - | `Plus - | Token.section_heading - | Token.tag ] - -(* Ensure that the above two types are really subsets of [Token.t]. *) -let _check_subset : stops_at_delimiters -> Token.t = fun t -> (t :> Token.t) - -let _check_subset : stopped_implicitly -> Token.t = fun t -> (t :> Token.t) - -(* The different contexts in which the block parser [block_element_list] can be - called. The block parser's behavior depends somewhat on the context. For - example, while paragraphs are allowed anywhere, shorthand lists are not - allowed immediately inside other shorthand lists, while tags are not allowed - anywhere except at the comment top level. - - Besides telling the block parser how to behave, each context also carries two - types, which determine the return type of the block parser: - - - The type of blocks the parser returns. Note that [nestable_block_element] - is included in [block_element]. However, the extra block kinds in - [block_element] are only allowed at the comment top level. - - The type of token that the block parser stops at. See discussion above. *) -type ('block, 'stops_at_which_tokens) context = - | Top_level : (Ast.block_element, stops_at_delimiters) context - | In_shorthand_list : (Ast.nestable_block_element, stopped_implicitly) context - | In_explicit_list : (Ast.nestable_block_element, stops_at_delimiters) context - | In_tag : (Ast.nestable_block_element, Token.t) context - -(* This is a no-op. It is needed to prove to the type system that nestable block - elements are acceptable block elements in all contexts. *) -let accepted_in_all_contexts : - type block stops_at_which_tokens. - (block, stops_at_which_tokens) context -> - Ast.nestable_block_element -> - block = - fun context block -> - match context with - | Top_level -> (block :> Ast.block_element) - | In_shorthand_list -> block - | In_explicit_list -> block - | In_tag -> block - -(* Converts a tag to a series of words. This is used in error recovery, when a - tag cannot be generated. *) -let tag_to_words = function - | `Author s -> [ `Word "@author"; `Space " "; `Word s ] - | `Before s -> [ `Word "@before"; `Space " "; `Word s ] - | `Canonical s -> [ `Word "@canonical"; `Space " "; `Word s ] - | `Deprecated -> [ `Word "@deprecated" ] - | `Inline -> [ `Word "@inline" ] - | `Open -> [ `Word "@open" ] - | `Closed -> [ `Word "@closed" ] - | `Param s -> [ `Word "@param"; `Space " "; `Word s ] - | `Raise s -> [ `Word "@raise"; `Space " "; `Word s ] - | `Return -> [ `Word "@return" ] - | `See (`Document, s) -> [ `Word "@see"; `Space " "; `Word ("\"" ^ s ^ "\"") ] - | `See (`File, s) -> [ `Word "@see"; `Space " "; `Word ("'" ^ s ^ "'") ] - | `See (`Url, s) -> [ `Word "@see"; `Space " "; `Word ("<" ^ s ^ ">") ] - | `Since s -> [ `Word "@since"; `Space " "; `Word s ] - | `Version s -> [ `Word "@version"; `Space " "; `Word s ] - -(* {3 Block element lists} *) - -(* Consumes tokens making up a sequence of block elements. These are: - - - paragraphs, - - code blocks, - - verbatim text blocks, - - lists, and - - section headings. *) -let rec block_element_list : - type block stops_at_which_tokens. - (block, stops_at_which_tokens) context -> - parent_markup:[< Token.t | `Comment ] -> - input -> - block with_location list - * stops_at_which_tokens with_location - * where_in_line = - fun context ~parent_markup input -> - let rec consume_block_elements : - parsed_a_tag:bool -> - where_in_line -> - block with_location list -> - block with_location list - * stops_at_which_tokens with_location - * where_in_line = - fun ~parsed_a_tag where_in_line acc -> - let describe token = - match token with - | #token_that_always_begins_an_inline_element -> "paragraph" - | _ -> Token.describe token - in - - let warn_if_after_text { Location.location; value = token } = - if where_in_line = `After_text then - Parse_error.should_begin_on_its_own_line ~what:(describe token) location - |> Error.warning input.warnings - in - - let warn_if_after_tags { Location.location; value = token } = - if parsed_a_tag then - let suggestion = - Printf.sprintf "move %s before any tags." (Token.describe token) - in - Parse_error.not_allowed ~what:(describe token) - ~in_what:"the tags section" ~suggestion location - |> Error.warning input.warnings - in - - let warn_because_not_at_top_level { Location.location; value = token } = - let suggestion = - Printf.sprintf "move %s outside of any other markup." - (Token.print token) - in - Parse_error.not_allowed ~what:(Token.describe token) - ~in_what:(Token.describe parent_markup) - ~suggestion location - |> Error.warning input.warnings - in - - match peek input with - (* Terminators: the two tokens that terminate anything. *) - | ({ value = `End; _ } | { value = `Right_brace; _ }) as next_token -> ( - (* This little absurdity is needed to satisfy the type system. Without it, - OCaml is unable to prove that [stream_head] has the right type for all - possible values of [context]. *) - match context with - | Top_level -> (List.rev acc, next_token, where_in_line) - | In_shorthand_list -> (List.rev acc, next_token, where_in_line) - | In_explicit_list -> (List.rev acc, next_token, where_in_line) - | In_tag -> (List.rev acc, next_token, where_in_line)) - (* Whitespace. This can terminate some kinds of block elements. It is also - necessary to track it to interpret [`Minus] and [`Plus] correctly, as - well as to ensure that all block elements begin on their own line. *) - | { value = `Space _; _ } -> - junk input; - consume_block_elements ~parsed_a_tag where_in_line acc - | { value = `Single_newline _; _ } -> - junk input; - consume_block_elements ~parsed_a_tag `At_start_of_line acc - | { value = `Blank_line _; _ } as next_token -> ( - match context with - (* Blank lines terminate shorthand lists ([- foo]). They also terminate - paragraphs, but the paragraph parser is aware of that internally. *) - | In_shorthand_list -> (List.rev acc, next_token, where_in_line) - (* Otherwise, blank lines are pretty much like single newlines. *) - | _ -> - junk input; - consume_block_elements ~parsed_a_tag `At_start_of_line acc) - (* Explicit list items ([{li ...}] and [{- ...}]) can never appear directly - in block content. They can only appear inside [{ul ...}] and [{ol ...}]. - So, catch those. *) - | { value = `Begin_list_item _ as token; location } -> - let suggestion = - Printf.sprintf "move %s into %s, or use %s." (Token.print token) - (Token.describe (`Begin_list `Unordered)) - (Token.describe `Minus) - in - Parse_error.not_allowed ~what:(Token.describe token) - ~in_what:(Token.describe parent_markup) - ~suggestion location - |> Error.warning input.warnings; - - junk input; - consume_block_elements ~parsed_a_tag where_in_line acc - (* Tags. These can appear at the top level only. Also, once one tag is seen, - the only top-level elements allowed are more tags. *) - | { value = `Tag tag as token; location } as next_token -> ( - let recover_when_not_at_top_level context = - warn_because_not_at_top_level next_token; - junk input; - let words = List.map (Location.at location) (tag_to_words tag) in - let paragraph = - `Paragraph words - |> accepted_in_all_contexts context - |> Location.at location - in - consume_block_elements ~parsed_a_tag `At_start_of_line - (paragraph :: acc) - in - - match context with - (* Tags cannot make sense in an explicit list ([{ul {li ...}}]). *) - | In_explicit_list -> recover_when_not_at_top_level context - (* If a tag starts at the beginning of a line, it terminates the preceding - tag and/or the current shorthand list. In this case, return to the - caller, and let the caller decide how to interpret the tag token. *) - | In_shorthand_list -> - if where_in_line = `At_start_of_line then - (List.rev acc, next_token, where_in_line) - else recover_when_not_at_top_level context - | In_tag -> - if where_in_line = `At_start_of_line then - (List.rev acc, next_token, where_in_line) - else recover_when_not_at_top_level context - (* If this is the top-level call to [block_element_list], parse the - tag. *) - | Top_level -> ( - if where_in_line <> `At_start_of_line then - Parse_error.should_begin_on_its_own_line - ~what:(Token.describe token) location - |> Error.warning input.warnings; - - junk input; - - match tag with - | (`Author s | `Since s | `Version s | `Canonical s) as tag -> - let s = String.trim s in - if s = "" then - Parse_error.should_not_be_empty ~what:(Token.describe token) - location - |> Error.warning input.warnings; - let tag = - match tag with - | `Author _ -> `Author s - | `Since _ -> `Since s - | `Version _ -> `Version s - | `Canonical _ -> - (* TODO The location is only approximate, as we need lexer - cooperation to get the real location. *) - let r_location = - Location.nudge_start - (String.length "@canonical ") - location - in - `Canonical (Location.at r_location s) - in - - let tag = Location.at location (`Tag tag) in - consume_block_elements ~parsed_a_tag:true `After_text - (tag :: acc) - | (`Deprecated | `Return) as tag -> - let content, _stream_head, where_in_line = - block_element_list In_tag ~parent_markup:token input - in - let tag = - match tag with - | `Deprecated -> `Deprecated content - | `Return -> `Return content - in - let location = - location :: List.map Location.location content - |> Location.span - in - let tag = Location.at location (`Tag tag) in - consume_block_elements ~parsed_a_tag:true where_in_line - (tag :: acc) - | (`Param _ | `Raise _ | `Before _) as tag -> - let content, _stream_head, where_in_line = - block_element_list In_tag ~parent_markup:token input - in - let tag = - match tag with - | `Param s -> `Param (s, content) - | `Raise s -> `Raise (s, content) - | `Before s -> `Before (s, content) - in - let location = - location :: List.map Location.location content - |> Location.span - in - let tag = Location.at location (`Tag tag) in - consume_block_elements ~parsed_a_tag:true where_in_line - (tag :: acc) - | `See (kind, target) -> - let content, _next_token, where_in_line = - block_element_list In_tag ~parent_markup:token input - in - let location = - location :: List.map Location.location content - |> Location.span - in - let tag = `Tag (`See (kind, target, content)) in - let tag = Location.at location tag in - consume_block_elements ~parsed_a_tag:true where_in_line - (tag :: acc) - | (`Inline | `Open | `Closed) as tag -> - let tag = Location.at location (`Tag tag) in - consume_block_elements ~parsed_a_tag:true `After_text - (tag :: acc))) - | { value = #token_that_always_begins_an_inline_element; _ } as next_token - -> - warn_if_after_tags next_token; - warn_if_after_text next_token; - - let block = paragraph input in - let block = Location.map (accepted_in_all_contexts context) block in - let acc = block :: acc in - consume_block_elements ~parsed_a_tag `After_text acc - | { value = (`Code_block s | `Verbatim s) as token; location } as next_token - -> - warn_if_after_tags next_token; - warn_if_after_text next_token; - if s = "" then - Parse_error.should_not_be_empty ~what:(Token.describe token) location - |> Error.warning input.warnings; - - junk input; - let block = - match token with - | `Code_block _ -> `Code_block s - | `Verbatim _ -> `Verbatim s - in - let block = accepted_in_all_contexts context block in - let block = Location.at location block in - let acc = block :: acc in - consume_block_elements ~parsed_a_tag `After_text acc - | { value = `Modules s as token; location } as next_token -> - warn_if_after_tags next_token; - warn_if_after_text next_token; - - junk input; - - (* TODO Use some library for a splitting function, or move this out into a - Util module. *) - let split_string delimiters s = - let rec scan_delimiters acc index = - if index >= String.length s then List.rev acc - else if String.contains delimiters s.[index] then - scan_delimiters acc (index + 1) - else scan_word acc index (index + 1) - and scan_word acc start_index index = - if index >= String.length s then - let word = String.sub s start_index (index - start_index) in - List.rev (word :: acc) - else if String.contains delimiters s.[index] then - let word = String.sub s start_index (index - start_index) in - scan_delimiters (word :: acc) (index + 1) - else scan_word acc start_index (index + 1) - in - - scan_delimiters [] 0 - in - - (* TODO Correct locations await a full implementation of {!modules} - parsing. *) - let modules = - split_string " \t\r\n" s |> List.map (fun r -> Location.at location r) - in - - if modules = [] then - Parse_error.should_not_be_empty ~what:(Token.describe token) location - |> Error.warning input.warnings; - - let block = accepted_in_all_contexts context (`Modules modules) in - let block = Location.at location block in - let acc = block :: acc in - consume_block_elements ~parsed_a_tag `After_text acc - | { value = `Begin_list kind as token; location } as next_token -> - warn_if_after_tags next_token; - warn_if_after_text next_token; - - junk input; - - let items, brace_location = - explicit_list_items ~parent_markup:token input - in - if items = [] then - Parse_error.should_not_be_empty ~what:(Token.describe token) location - |> Error.warning input.warnings; - - let location = Location.span [ location; brace_location ] in - let block = `List (kind, `Heavy, items) in - let block = accepted_in_all_contexts context block in - let block = Location.at location block in - let acc = block :: acc in - consume_block_elements ~parsed_a_tag `After_text acc - | { value = (`Minus | `Plus) as token; location } as next_token -> ( - (match where_in_line with - | `After_text | `After_shorthand_bullet -> - Parse_error.should_begin_on_its_own_line - ~what:(Token.describe token) location - |> Error.warning input.warnings - | _ -> ()); - - warn_if_after_tags next_token; - - match context with - | In_shorthand_list -> (List.rev acc, next_token, where_in_line) - | _ -> - let items, where_in_line = - shorthand_list_items next_token where_in_line input - in - let kind = - match token with `Minus -> `Unordered | `Plus -> `Ordered - in - let location = - location :: List.map Location.location (List.flatten items) - |> Location.span - in - let block = `List (kind, `Light, items) in - let block = accepted_in_all_contexts context block in - let block = Location.at location block in - let acc = block :: acc in - consume_block_elements ~parsed_a_tag where_in_line acc) - | { value = `Begin_section_heading (level, label) as token; location } as - next_token -> ( - warn_if_after_tags next_token; - - let recover_when_not_at_top_level context = - warn_because_not_at_top_level next_token; - junk input; - let content, brace_location = - delimited_inline_element_list ~parent_markup:token - ~parent_markup_location:location ~requires_leading_whitespace:true - input - in - let location = Location.span [ location; brace_location ] in - let paragraph = - `Paragraph content - |> accepted_in_all_contexts context - |> Location.at location - in - consume_block_elements ~parsed_a_tag `At_start_of_line - (paragraph :: acc) - in - - match context with - | In_shorthand_list -> - if where_in_line = `At_start_of_line then - (List.rev acc, next_token, where_in_line) - else recover_when_not_at_top_level context - | In_explicit_list -> recover_when_not_at_top_level context - | In_tag -> recover_when_not_at_top_level context - | Top_level -> - if where_in_line <> `At_start_of_line then - Parse_error.should_begin_on_its_own_line - ~what:(Token.describe token) location - |> Error.warning input.warnings; - - let label = - match label with - | Some "" -> - Parse_error.should_not_be_empty ~what:"heading label" location - |> Error.warning input.warnings; - None - | _ -> label - in - - junk input; - - let content, brace_location = - delimited_inline_element_list ~parent_markup:token - ~parent_markup_location:location - ~requires_leading_whitespace:true input - in - if content = [] then - Parse_error.should_not_be_empty ~what:(Token.describe token) - location - |> Error.warning input.warnings; - - let location = Location.span [ location; brace_location ] in - let heading = `Heading (level, label, content) in - let heading = Location.at location heading in - let acc = heading :: acc in - consume_block_elements ~parsed_a_tag `After_text acc) - | { value = `Begin_paragraph_style _ as token; location } -> - junk input; - let content, brace_location = - delimited_inline_element_list ~parent_markup:token - ~parent_markup_location:location ~requires_leading_whitespace:true - input - in - let location = Location.span [ location; brace_location ] in - - Parse_error.markup_should_not_be_used ~what:(Token.describe token) - location - |> Error.warning input.warnings; - - let paragraph = - `Paragraph content - |> accepted_in_all_contexts context - |> Location.at location - in - consume_block_elements ~parsed_a_tag `At_start_of_line - (paragraph :: acc) - in - - let where_in_line = - match context with - | Top_level -> `At_start_of_line - | In_shorthand_list -> `After_shorthand_bullet - | In_explicit_list -> `After_explicit_list_bullet - | In_tag -> `After_tag - in - - consume_block_elements ~parsed_a_tag:false where_in_line [] - -(* {3 Lists} *) - -(* Consumes a sequence of implicit list items. Each one consists of a [`Minus] - or [`Plus] token, followed by block elements until: - - - a blank line, or - - a list bullet of the opposite kind (e.g. [`Plus] for a [`Minus] list). - - This function is called when the next token is known to be [`Minus] or - [`Plus]. It consumes that token, and calls the block element parser (see - above). That parser returns to [implicit_list_items] only on [`Blank_line], - [`End], [`Minus] or [`Plus] at the start of a line, or [`Right_brace]. *) -and shorthand_list_items : - [ `Minus | `Plus ] with_location -> - where_in_line -> - input -> - Ast.nestable_block_element with_location list list * where_in_line = - fun first_token where_in_line input -> - let bullet_token = first_token.value in - - let rec consume_list_items : - [> ] with_location -> - where_in_line -> - Ast.nestable_block_element with_location list list -> - Ast.nestable_block_element with_location list list * where_in_line = - fun next_token where_in_line acc -> - match next_token.value with - | `End | `Right_brace | `Blank_line _ | `Tag _ | `Begin_section_heading _ -> - (List.rev acc, where_in_line) - | (`Minus | `Plus) as bullet -> - if bullet = bullet_token then ( - junk input; - - let content, stream_head, where_in_line = - block_element_list In_shorthand_list ~parent_markup:bullet input - in - if content = [] then - Parse_error.should_not_be_empty ~what:(Token.describe bullet) - next_token.location - |> Error.warning input.warnings; - - let acc = content :: acc in - consume_list_items stream_head where_in_line acc) - else (List.rev acc, where_in_line) - in - - consume_list_items - (first_token :> stopped_implicitly with_location) - where_in_line [] - -(* Consumes a sequence of explicit list items (starting with '{li ...}' and - '{-...}', which are represented by [`Begin_list_item _] tokens). - - This function is called immediately after '{ul' or '{ol' ([`Begin_list _]) is - read. The only "valid" way to exit is by reading a [`Right_brace] token, - which is consumed. - - Whitespace inside the list, but outside list items, is not significant – this - parsing function consumes all of it. Otherwise, only list item start tokens - are accepted. Everything else is an error. *) -and explicit_list_items : - parent_markup:[< Token.t ] -> - input -> - Ast.nestable_block_element with_location list list * Location.span = - fun ~parent_markup input -> - let rec consume_list_items : - Ast.nestable_block_element with_location list list -> - Ast.nestable_block_element with_location list list * Location.span = - fun acc -> - let next_token = peek input in - match next_token.value with - | `End -> - Parse_error.not_allowed next_token.location - ~what:(Token.describe `End) - ~in_what:(Token.describe parent_markup) - |> Error.warning input.warnings; - (List.rev acc, next_token.location) - | `Right_brace -> - junk input; - (List.rev acc, next_token.location) - | `Space _ | `Single_newline _ | `Blank_line _ -> - junk input; - consume_list_items acc - | `Begin_list_item kind as token -> - junk input; - - (* '{li', represented by [`Begin_list_item `Li], must be followed by - whitespace. *) - (if kind = `Li then - match (peek input).value with - | `Space _ | `Single_newline _ | `Blank_line _ | `Right_brace -> - () - (* The presence of [`Right_brace] above requires some explanation: - - - It is better to be silent about missing whitespace if the next - token is [`Right_brace], because the error about an empty list - item will be generated below, and that error is more important to - the user. - - The [`Right_brace] token also happens to include all whitespace - before it, as a convenience for the rest of the parser. As a - result, not ignoring it could be wrong: there could in fact be - whitespace in the concrete syntax immediately after '{li', just - it is not represented as [`Space], [`Single_newline], or - [`Blank_line]. *) - | _ -> - Parse_error.should_be_followed_by_whitespace next_token.location - ~what:(Token.print token) - |> Error.warning input.warnings); - - let content, token_after_list_item, _where_in_line = - block_element_list In_explicit_list ~parent_markup:token input - in - - if content = [] then - Parse_error.should_not_be_empty next_token.location - ~what:(Token.describe token) - |> Error.warning input.warnings; - - (match token_after_list_item.value with - | `Right_brace -> junk input - | `End -> - Parse_error.not_allowed token_after_list_item.location - ~what:(Token.describe `End) - ~in_what:(Token.describe token) - |> Error.warning input.warnings); - - let acc = content :: acc in - consume_list_items acc - | token -> - let suggestion = - match token with - | `Begin_section_heading _ | `Tag _ -> - Printf.sprintf "move %s outside the list." (Token.describe token) - | _ -> - Printf.sprintf "move %s into a list item, %s or %s." - (Token.describe token) - (Token.print (`Begin_list_item `Li)) - (Token.print (`Begin_list_item `Dash)) - in - Parse_error.not_allowed next_token.location ~what:(Token.describe token) - ~in_what:(Token.describe parent_markup) - ~suggestion - |> Error.warning input.warnings; - - junk input; - consume_list_items acc - in - - consume_list_items [] - -(* {2 Entry point} *) - -let parse warnings tokens = - let input = { tokens; warnings } in - - let rec parse_block_elements () = - let elements, last_token, _where_in_line = - block_element_list Top_level ~parent_markup:`Comment input - in - - match last_token.value with - | `End -> elements - | `Right_brace -> - Parse_error.unpaired_right_brace last_token.location - |> Error.warning input.warnings; - - let block = - Location.same last_token - (`Paragraph [ Location.same last_token (`Word "}") ]) - in - - junk input; - elements @ block :: parse_block_elements () - in - parse_block_elements () diff --git a/src/parser/syntax.mli b/src/parser/syntax.mli deleted file mode 100644 index da0497c068..0000000000 --- a/src/parser/syntax.mli +++ /dev/null @@ -1,4 +0,0 @@ -val parse : - Error.warning_accumulator -> - Token.t Location.with_location Stream.t -> - Ast.docs diff --git a/src/parser/test/dune b/src/parser/test/dune deleted file mode 100644 index 072a95a30e..0000000000 --- a/src/parser/test/dune +++ /dev/null @@ -1,8 +0,0 @@ -(library - (name odoc_parser_test) - (inline_tests) - (enabled_if - (>= %{ocaml_version} 4.04.1)) - (preprocess - (pps ppx_expect)) - (libraries sexplib0 odoc_parser)) diff --git a/src/parser/test/test.ml b/src/parser/test/test.ml deleted file mode 100644 index 8d95494ec8..0000000000 --- a/src/parser/test/test.ml +++ /dev/null @@ -1,4951 +0,0 @@ -open Odoc_parser - -type sexp = Sexplib0.Sexp.t = Atom of string | List of sexp list - -module Location_to_sexp = struct - let point : Location.point -> sexp = - fun { line; column } -> - List [ Atom (string_of_int line); Atom (string_of_int column) ] - - let span : Location.span -> sexp = - fun { file; start; end_ } -> List [ Atom file; point start; point end_ ] - - let at : ('a -> sexp) -> 'a Location.with_location -> sexp = - fun f { location; value } -> List [ span location; f value ] -end - -module Ast_to_sexp = struct - let at = Location_to_sexp.at - - let str s = Atom s - - let opt f s = match s with Some s -> List [ f s ] | None -> List [] - - let style : Ast.style -> sexp = function - | `Bold -> Atom "bold" - | `Italic -> Atom "italic" - | `Emphasis -> Atom "emphasis" - | `Superscript -> Atom "superscript" - | `Subscript -> Atom "subscript" - - let reference_kind : Ast.reference_kind -> sexp = function - | `Simple -> Atom "simple" - | `With_text -> Atom "with_text" - - let rec inline_element : Ast.inline_element -> sexp = function - | `Space _ -> Atom "space" - | `Word w -> List [ Atom "word"; Atom w ] - | `Code_span c -> List [ Atom "code_span"; Atom c ] - | `Raw_markup (target, s) -> - List [ Atom "raw_markup"; opt str target; Atom s ] - | `Styled (s, es) -> - List [ style s; List (List.map (at inline_element) es) ] - | `Reference (kind, r, es) -> - List - [ - reference_kind kind; - at str r; - List (List.map (at inline_element) es); - ] - | `Link (u, es) -> List [ str u; List (List.map (at inline_element) es) ] - - let rec nestable_block_element : Ast.nestable_block_element -> sexp = function - | `Paragraph es -> - List [ Atom "paragraph"; List (List.map (at inline_element) es) ] - | `Code_block c -> List [ Atom "code_block"; Atom c ] - | `Verbatim t -> List [ Atom "verbatim"; Atom t ] - | `Modules ps -> List [ Atom "modules"; List (List.map (at str) ps) ] - | `List (kind, weight, items) -> - let kind = - match kind with `Unordered -> "unordered" | `Ordered -> "ordered" - in - let weight = - match weight with `Light -> "light" | `Heavy -> "heavy" - in - let items = - items - |> List.map (fun item -> - List (List.map (at nestable_block_element) item)) - |> fun items -> List items - in - List [ Atom kind; Atom weight; items ] - - let tag : Ast.tag -> sexp = function - | `Author s -> List [ Atom "@author"; Atom s ] - | `Deprecated es -> - List (Atom "@deprecated" :: List.map (at nestable_block_element) es) - | `Param (s, es) -> - List - ([ Atom "@param"; Atom s ] @ List.map (at nestable_block_element) es) - | `Raise (s, es) -> - List - ([ Atom "@raise"; Atom s ] @ List.map (at nestable_block_element) es) - | `Return es -> - List (Atom "@return" :: List.map (at nestable_block_element) es) - | `See (kind, s, es) -> - let kind = - match kind with - | `Url -> "url" - | `File -> "file" - | `Document -> "document" - in - List - ([ Atom "@see"; Atom kind; Atom s ] - @ List.map (at nestable_block_element) es) - | `Since s -> List [ Atom "@since"; Atom s ] - | `Before (s, es) -> - List - ([ Atom "@before"; Atom s ] @ List.map (at nestable_block_element) es) - | `Version s -> List [ Atom "@version"; Atom s ] - | `Canonical p -> List [ Atom "@canonical"; at str p ] - | `Inline -> Atom "@inline" - | `Open -> Atom "@open" - | `Closed -> Atom "@closed" - - let block_element : Ast.block_element -> sexp = function - | #Ast.nestable_block_element as e -> nestable_block_element e - | `Heading (level, label, es) -> - let label = List [ Atom "label"; opt str label ] in - let level = string_of_int level in - List [ Atom level; label; List (List.map (at inline_element) es) ] - | `Tag t -> tag t - - let docs : Ast.docs -> sexp = fun f -> List (List.map (at block_element) f) -end - -let error err = Atom (Odoc_parser.Error.to_string err) - -let parser_output formatter { Odoc_parser.Error.value; warnings } = - let value = Ast_to_sexp.docs value in - let warnings = List (List.map error warnings) in - let output = - List [ List [ Atom "output"; value ]; List [ Atom "warnings"; warnings ] ] - in - Sexplib0.Sexp.pp_hum formatter output; - Format.pp_print_flush formatter () - -let test ?(location = { Location.line = 1; column = 0 }) str = - let dummy_filename = "f.ml" in - let location = - { - Lexing.pos_fname = dummy_filename; - pos_lnum = location.line; - pos_bol = 0; - pos_cnum = location.column; - } - in - let ast = Odoc_parser.parse_comment ~location ~text:str in - Format.printf "%a" parser_output ast - -[@@@ocaml.warning "-32"] - -let%expect_test _ = - let module Trivial = struct - let empty = - test ""; - [%expect "((output ()) (warnings ()))"] - - let space = - test " "; - [%expect "((output ()) (warnings ()))"] - - let two_spaces = - test " "; - [%expect "((output ()) (warnings ()))"] - - let tab = - test "\t"; - [%expect "((output ()) (warnings ()))"] - - let mixed_space = - test " \t \t"; - [%expect "((output ()) (warnings ()))"] - - let newline = - test "\n"; - [%expect "((output ()) (warnings ()))"] - - let blank_line = - test "\n\n"; - [%expect "((output ()) (warnings ()))"] - - let cf_lf = - test "\r\n"; - [%expect "((output ()) (warnings ()))"] - end in - () - -let%expect_test _ = - let module One_paragraph = struct - let word = - test "foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))))) - (warnings ())) |}] - - let two_words = - test "foo bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) space) - ((f.ml (1 4) (1 7)) (word bar))))))) - (warnings ())) |}] - - let two_words = - test "foo bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) space) - ((f.ml (1 4) (1 7)) (word bar))))))) - (warnings ())) |}] - - let two_spaces = - test "foo bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 5)) space) - ((f.ml (1 5) (1 8)) (word bar))))))) - (warnings ())) |}] - - let mixed_space = - test "foo \t \t bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 8)) space) - ((f.ml (1 8) (1 11)) (word bar))))))) - (warnings ())) |}] - - let two_lines = - test "foo\n"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))))) - (warnings ())) |}] - - let two_lines_cr_lf = - test "foo\r\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (2 0)) space) - ((f.ml (2 0) (2 3)) (word bar))))))) - (warnings ())) |}] - - let leading_space = - test " foo"; - [%expect - {| - ((output - (((f.ml (1 1) (1 4)) (paragraph (((f.ml (1 1) (1 4)) (word foo))))))) - (warnings ())) |}] - - let trailing_space = - test "foo "; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))))) - (warnings ())) |}] - - let leading_space_on_line = - test "foo\n bar"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (2 1)) space) - ((f.ml (2 1) (2 4)) (word bar))))))) - (warnings ())) |}] - - let trailing_space_on_line = - test "foo \nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (2 0)) space) - ((f.ml (2 0) (2 3)) (word bar))))))) - (warnings ())) |}] - - let leading_tab_on_line = - test "foo\n\tbar"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (2 1)) space) - ((f.ml (2 1) (2 4)) (word bar))))))) - (warnings ())) |}] - - let trailing_tab_on_line = - test "foo\t\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (2 0)) space) - ((f.ml (2 0) (2 3)) (word bar))))))) - (warnings ())) |}] - - let email = - test "foo@bar.com"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph (((f.ml (1 0) (1 11)) (word foo@bar.com))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Two_paragraphs = struct - let basic = - test "foo\n\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word bar))))))) - (warnings ())) |}] - - let leading_space = - test "foo \n\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word bar))))))) - (warnings ())) |}] - - let trailing_space = - test "foo\n\n bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (3 1) (3 4)) (paragraph (((f.ml (3 1) (3 4)) (word bar))))))) - (warnings ())) |}] - - let cr_lf = - test "foo\r\n\r\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word bar))))))) - (warnings ())) |}] - - let mixed_cr_lf = - test "foo\n\r\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word bar))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Plus_minus_words = struct - let minus_in_word = - test "foo-bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 0) (1 7)) (word foo-bar))))))) - (warnings ())) |}] - - let minus_as_word = - test "foo -"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) space) - ((f.ml (1 4) (1 5)) (word -))))))) - (warnings ())) |}] - - let plus_in_word = - test "foo+bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 0) (1 7)) (word foo+bar))))))) - (warnings ())) |}] - - let plus_as_word = - test "foo +"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) space) - ((f.ml (1 4) (1 5)) (word +))))))) - (warnings ())) |}] - - let negative_number = - test "-3.14 -1337"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 5)) (word -3.14)) ((f.ml (1 5) (1 6)) space) - ((f.ml (1 6) (1 11)) (word -1337))))))) - (warnings ())) |}] - - let n_em_dash = - test "-- ---"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph - (((f.ml (1 0) (1 2)) (word --)) ((f.ml (1 2) (1 3)) space) - ((f.ml (1 3) (1 6)) (word ---))))))) - (warnings ())) |}] - - let minus_at = - test "-@"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word -@))))))) - (warnings ())) |}] - - let at_minus = - test "-@-"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word -@-))))))) - (warnings ())) |}] - - let option = - test "--option"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word --option))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Escape_sequence = struct - let left_brace = - test "\\{"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word {))))))) - (warnings ())) |}] - - let left_brace_in_word = - test "foo\\{bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word foo{bar))))))) - (warnings ())) |}] - - let right_brace = - test "\\}"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word }))))))) - (warnings ())) |}] - - let right_brace_in_word = - test "foo\\{bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word foo{bar))))))) - (warnings ())) |}] - - let left_bracket = - test "\\["; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word [))))))) - (warnings ())) |}] - - let left_bracket_in_word = - test "foo\\[bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word foo[bar))))))) - (warnings ())) |}] - - let right_bracket = - test "\\]"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word ]))))))) - (warnings ())) |}] - - let right_bracket_in_word = - test "foo\\]bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word foo]bar))))))) - (warnings ())) |}] - - let at = - test "@"; - [%expect - {| - ((output (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word @))))))) - (warnings ( "File \"f.ml\", line 1, characters 0-1:\ - \nStray '@'."))) |}] - - let not_a_tag = - test "\\@author"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word @author))))))) - (warnings ())) |}] - - let at_in_word = - test "foo\\@bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word foo@bar))))))) - (warnings ())) |}] - - let trailing_backslash = - test "foo\\"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (word "foo\\"))))))) - (warnings ())) |}] - - let none_escape = - test "foo\\bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 0) (1 7)) (word "foo\\bar"))))))) - (warnings ())) |}] - - let backslash_not_escaped = - test "foo\\\\{bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (paragraph (((f.ml (1 0) (1 9)) (word "foo\\{bar"))))))) - (warnings ())) |}] - - let single_backslash = - test "\\"; - [%expect - {| - ((output - (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word "\\"))))))) - (warnings ())) |}] - - let escape_minus = - test "\\{- foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 3)) (word {-)) ((f.ml (1 3) (1 4)) space) - ((f.ml (1 4) (1 7)) (word foo))))))) - (warnings ())) |}] - - let escape_plus = - test "\\{+ foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 3)) (word {+)) ((f.ml (1 3) (1 4)) space) - ((f.ml (1 4) (1 7)) (word foo))))))) - (warnings ())) |}] - - let minus_escape = - test "-\\{"; - [%expect - {| - ((output (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word -{))))))) - (warnings ())) |}] - - let plus_escape = - test "+\\{"; - [%expect - {| - ((output (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word +{))))))) - (warnings ())) |}] - - let escape_at = - test "\\{@author"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (paragraph (((f.ml (1 0) (1 9)) (word {@author))))))) - (warnings ())) |}] - - let two = - test "\\{\\}"; - [%expect - {| - ((output (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (word {}))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Code_span = struct - let basic = - test "[foo]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) (paragraph (((f.ml (1 0) (1 5)) (code_span foo))))))) - (warnings ())) |}] - - let empty = - test "[]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (code_span ""))))))) - (warnings ())) |}] - - let list = - test "[[]]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (code_span []))))))) - (warnings ())) |}] - (* TODO The next two error messages are particularly unintuitive. *) - - let unbalanced_list = - test "[[]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (code_span []))))))) - (warnings - ( "File \"f.ml\", line 1, characters 3-3:\ - \nEnd of text is not allowed in '[...]' (code)."))) |}] - - let no_markup = - test "[{b"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (code_span {b))))))) - (warnings - ( "File \"f.ml\", line 1, characters 3-3:\ - \nEnd of text is not allowed in '[...]' (code)."))) |}] - - let few_escapes = - test "[\\{]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (code_span "\\{"))))))) - (warnings ())) |}] - - let escaped_right_bracket = - test "[\\]]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (code_span ]))))))) - (warnings ())) |}] - - let escaped_left_bracket = - test "[\\[]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (code_span [))))))) - (warnings ())) |}] - - let whitespace_preserved = - test "[ foo bar ]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph (((f.ml (1 0) (1 11)) (code_span " foo bar "))))))) - (warnings ())) |}] - - let no_new_lines = - test "[foo\nbar]"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph (((f.ml (1 0) (2 4)) (code_span "foo\ - \nbar"))))))) - (warnings ())) |}] - - let cr_lf_preserved = - test "[foo\r\nbar]"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph (((f.ml (1 0) (2 4)) (code_span "foo\r\ - \nbar"))))))) - (warnings ())) |}] - - let no_double_new_line = - test "[foo\r\n\r\nbar]"; - [%expect - {| - ((output - (((f.ml (1 0) (3 4)) - (paragraph (((f.ml (1 0) (3 4)) (code_span "foo\ - \nbar"))))))) - (warnings - ( "File \"f.ml\", line 1, character 4 to line 3, character 0:\ - \nBlank line is not allowed in '[...]' (code)."))) |}] - - let no_double_crlf = - test "[foo\r\n\r\nbar]"; - [%expect - {| - ((output - (((f.ml (1 0) (3 4)) - (paragraph (((f.ml (1 0) (3 4)) (code_span "foo\ - \nbar"))))))) - (warnings - ( "File \"f.ml\", line 1, character 4 to line 3, character 0:\ - \nBlank line is not allowed in '[...]' (code)."))) |}] - - let not_merged = - test "[foo][bar]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 5)) (code_span foo)) - ((f.ml (1 5) (1 10)) (code_span bar))))))) - (warnings ())) |}] - - let explicit_space = - test "[foo] [bar]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 5)) (code_span foo)) ((f.ml (1 5) (1 6)) space) - ((f.ml (1 6) (1 11)) (code_span bar))))))) - (warnings ())) |}] - - let untermindated = - test "[foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (code_span foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 4-4:\ - \nEnd of text is not allowed in '[...]' (code)."))) |}] - end in - () - -let%expect_test _ = - let module Bold = struct - let basic = - test "{b foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (bold (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let extra_leading_whitespace = - test "{b \t foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) (bold (((f.ml (1 6) (1 9)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline = - test "{b\nfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) (bold (((f.ml (2 0) (2 3)) (word foo)))))))))) - (warnings ())) |}] - - let leading_cr_lf = - test "{b\r\nfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) (bold (((f.ml (2 0) (2 3)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline_and_whitespace = - test "{b\n foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (paragraph - (((f.ml (1 0) (2 5)) (bold (((f.ml (2 1) (2 4)) (word foo)))))))))) - (warnings ())) |}] - - let no_leading_whitespace = - test "{bfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph - (((f.ml (1 0) (1 6)) (bold (((f.ml (1 2) (1 5)) (word foo)))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-2:\ - \n'{b' should be followed by space, a tab, or a new line."))) |}] - - let trailing_whitespace = - test "{b foo }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (bold (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let trailing_newline = - test "{b foo\n}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 1)) - (paragraph - (((f.ml (1 0) (2 1)) (bold (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let trailing_cr_lf = - test "{b foo\r\n}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 1)) - (paragraph - (((f.ml (1 0) (2 1)) (bold (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let two_words = - test "{b foo bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) - (bold - (((f.ml (1 3) (1 6)) (word foo)) ((f.ml (1 6) (1 7)) space) - ((f.ml (1 7) (1 10)) (word bar)))))))))) - (warnings ())) |}] - - let not_merged = - test "{b foo}{b bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (paragraph - (((f.ml (1 0) (1 7)) (bold (((f.ml (1 3) (1 6)) (word foo))))) - ((f.ml (1 7) (1 14)) (bold (((f.ml (1 10) (1 13)) (word bar)))))))))) - (warnings ())) |}] - - let nested = - test "{b foo{b bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (paragraph - (((f.ml (1 0) (1 14)) - (bold - (((f.ml (1 3) (1 6)) (word foo)) - ((f.ml (1 6) (1 13)) (bold (((f.ml (1 9) (1 12)) (word bar))))))))))))) - (warnings ())) |}] - - let newline = - test "{b foo\nbar}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) - (bold - (((f.ml (1 3) (1 6)) (word foo)) ((f.ml (1 6) (2 0)) space) - ((f.ml (2 0) (2 3)) (word bar)))))))))) - (warnings ())) |}] - - let cr_lf = - test "{b foo\r\nbar}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) - (bold - (((f.ml (1 3) (1 6)) (word foo)) ((f.ml (1 6) (2 0)) space) - ((f.ml (2 0) (2 3)) (word bar)))))))))) - (warnings ())) |}] - - let minus = - test "{b -}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph (((f.ml (1 0) (1 5)) (bold (((f.ml (1 3) (1 4)) (word -)))))))))) - (warnings ())) |}] - - let minus_list_item = - test "{b foo\n - bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 7)) - (paragraph - (((f.ml (1 0) (2 7)) - (bold - (((f.ml (1 3) (1 6)) (word foo)) ((f.ml (1 6) (2 1)) space) - ((f.ml (2 1) (2 2)) (word -)) ((f.ml (2 2) (2 3)) space) - ((f.ml (2 3) (2 6)) (word bar)))))))))) - (warnings - ( "File \"f.ml\", line 2, characters 1-2:\ - \n'-' (bulleted list item) is not allowed in '{b ...}' (boldface text).\ - \nSuggestion: move '-' so it isn't the first thing on the line."))) |}] - - let plus_list_item = - test "{b foo\n + bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 7)) - (paragraph - (((f.ml (1 0) (2 7)) - (bold - (((f.ml (1 3) (1 6)) (word foo)) ((f.ml (1 6) (2 1)) space) - ((f.ml (2 1) (2 2)) (word +)) ((f.ml (2 2) (2 3)) space) - ((f.ml (2 3) (2 6)) (word bar)))))))))) - (warnings - ( "File \"f.ml\", line 2, characters 1-2:\ - \n'+' (numbered list item) is not allowed in '{b ...}' (boldface text).\ - \nSuggestion: move '+' so it isn't the first thing on the line."))) |}] - - let immediate_minus_list_item = - test "{b\n- foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 6)) - (paragraph - (((f.ml (1 0) (2 6)) - (bold - (((f.ml (2 0) (2 1)) (word -)) ((f.ml (2 1) (2 2)) space) - ((f.ml (2 2) (2 5)) (word foo)))))))))) - (warnings - ( "File \"f.ml\", line 2, characters 0-1:\ - \n'-' (bulleted list item) is not allowed in '{b ...}' (boldface text).\ - \nSuggestion: move '-' so it isn't the first thing on the line."))) |}] - - let immediate_plus_list_item = - test "{b\n+ foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 6)) - (paragraph - (((f.ml (1 0) (2 6)) - (bold - (((f.ml (2 0) (2 1)) (word +)) ((f.ml (2 1) (2 2)) space) - ((f.ml (2 2) (2 5)) (word foo)))))))))) - (warnings - ( "File \"f.ml\", line 2, characters 0-1:\ - \n'+' (numbered list item) is not allowed in '{b ...}' (boldface text).\ - \nSuggestion: move '+' so it isn't the first thing on the line."))) |}] - - let blank_line = - test "{b foo\n\nbar}"; - [%expect - {| - ((output - (((f.ml (1 0) (3 4)) - (paragraph - (((f.ml (1 0) (3 4)) - (bold - (((f.ml (1 3) (1 6)) (word foo)) ((f.ml (2 0) (2 0)) space) - ((f.ml (3 0) (3 3)) (word bar)))))))))) - (warnings - ( "File \"f.ml\", line 2, characters 0-0:\ - \nBlank line is not allowed in '{b ...}' (boldface text)."))) |}] - - let immediate_blank_line = - test "{b"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (bold ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-2:\ - \n'{b' should be followed by space, a tab, or a new line." - "File \"f.ml\", line 1, characters 2-2:\ - \nEnd of text is not allowed in '{b ...}' (boldface text)." - "File \"f.ml\", line 1, characters 0-2:\ - \n'{b ...}' (boldface text) should not be empty."))) |}] - - let end_of_comment = - test "{b foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph - (((f.ml (1 0) (1 6)) (bold (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 6-6:\ - \nEnd of text is not allowed in '{b ...}' (boldface text)."))) |}] - - let nested_code_block = - test "{b {[foo]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (bold ()))))) - ((f.ml (1 3) (1 10)) (code_block foo)))) - (warnings - ( "File \"f.ml\", line 1, characters 3-10:\ - \n'{[...]}' (code block) is not allowed in '{b ...}' (boldface text)." - "File \"f.ml\", line 1, characters 0-2:\ - \n'{b ...}' (boldface text) should not be empty." - "File \"f.ml\", line 1, characters 3-10:\ - \n'{[...]}' (code block) should begin on its own line."))) |}] - - let degenerate = - test "{b}"; - [%expect - {| - ((output (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (bold ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-3:\ - \n'{b ...}' (boldface text) should not be empty."))) |}] - - let empty = - test "{b }"; - [%expect - {| - ((output (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (bold ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'{b ...}' (boldface text) should not be empty."))) |}] - end in - () - -let%expect_test _ = - let module Italic = struct - let basic = - test "{i foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (italic (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let extra_leading_whitespace = - test "{i \t foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) (italic (((f.ml (1 6) (1 9)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline = - test "{i\nfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) (italic (((f.ml (2 0) (2 3)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline_and_whitespace = - test "{i\n foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (paragraph - (((f.ml (1 0) (2 5)) (italic (((f.ml (2 1) (2 4)) (word foo)))))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Emphasis = struct - let basic = - test "{e foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (emphasis (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let extra_leading_whitespace = - test "{e \t foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) (emphasis (((f.ml (1 6) (1 9)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline = - test "{e\nfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) (emphasis (((f.ml (2 0) (2 3)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline_and_whitespace = - test "{e\n foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (paragraph - (((f.ml (1 0) (2 5)) (emphasis (((f.ml (2 1) (2 4)) (word foo)))))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Superscript = struct - let basic = - test "{^ foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (superscript (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let extra_leading_whitespace = - test "{^ \t foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) (superscript (((f.ml (1 6) (1 9)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline = - test "{^\nfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) (superscript (((f.ml (2 0) (2 3)) (word foo)))))))))) - (warnings ())) |}] - - let leading_cr_lf = - test "{^\r\nfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) (superscript (((f.ml (2 0) (2 3)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline_and_whitespace = - test "{^\n foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (paragraph - (((f.ml (1 0) (2 5)) (superscript (((f.ml (2 1) (2 4)) (word foo)))))))))) - (warnings ())) |}] - - let no_whitespace = - test "{^foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph - (((f.ml (1 0) (1 6)) (superscript (((f.ml (1 2) (1 5)) (word foo)))))))))) - (warnings ())) |}] - - let degenerate = - test "{^}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (superscript ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-3:\ - \n'{^...}' (superscript) should not be empty."))) |}] - - let empty = - test "{^ }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (superscript ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'{^...}' (superscript) should not be empty."))) |}] - end in - () - -let%expect_test _ = - let module Subscript = struct - let basic = - test "{_ foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (subscript (((f.ml (1 3) (1 6)) (word foo)))))))))) - (warnings ())) |}] - - let extra_leading_whitespace = - test "{_ \t foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) (subscript (((f.ml (1 6) (1 9)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline = - test "{_\nfoo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (paragraph - (((f.ml (1 0) (2 4)) (subscript (((f.ml (2 0) (2 3)) (word foo)))))))))) - (warnings ())) |}] - - let leading_newline_and_whitespace = - test "{_\n foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (paragraph - (((f.ml (1 0) (2 5)) (subscript (((f.ml (2 1) (2 4)) (word foo)))))))))) - (warnings ())) |}] - - let no_whitespace = - test "{_foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph - (((f.ml (1 0) (1 6)) (subscript (((f.ml (1 2) (1 5)) (word foo)))))))))) - (warnings ())) |}] - - let v_verbose = - test "{_uv}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph - (((f.ml (1 0) (1 5)) (subscript (((f.ml (1 2) (1 4)) (word uv)))))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Simple_reference = struct - let basic = - test "{!foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph (((f.ml (1 0) (1 6)) (simple ((f.ml (1 2) (1 6)) foo) ()))))))) - (warnings ())) |}] - - let leading_whitespace = - test "{! foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (simple ((f.ml (1 2) (1 7)) " foo") ()))))))) - (warnings ())) |}] - - let trailing_whitespace = - test "{!foo }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (simple ((f.ml (1 2) (1 7)) "foo ") ()))))))) - (warnings ())) |}] - - let adjacent_word_leading = - test "bar{!foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (paragraph - (((f.ml (1 0) (1 3)) (word bar)) - ((f.ml (1 3) (1 9)) (simple ((f.ml (1 5) (1 9)) foo) ()))))))) - (warnings ())) |}] - - let explicit_leading_space = - test "bar {!foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 3)) (word bar)) ((f.ml (1 3) (1 4)) space) - ((f.ml (1 4) (1 10)) (simple ((f.ml (1 6) (1 10)) foo) ()))))))) - (warnings ())) |}] - - let adjacent_word_trailing = - test "{!foo}bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (paragraph - (((f.ml (1 0) (1 6)) (simple ((f.ml (1 2) (1 6)) foo) ())) - ((f.ml (1 6) (1 9)) (word bar))))))) - (warnings ())) |}] - - let explicit_trailing_space = - test "{!foo} bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 6)) (simple ((f.ml (1 2) (1 6)) foo) ())) - ((f.ml (1 6) (1 7)) space) ((f.ml (1 7) (1 10)) (word bar))))))) - (warnings ())) |}] - - let kind = - test "{!val:foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) (simple ((f.ml (1 2) (1 10)) val:foo) ()))))))) - (warnings ())) |}] - - let empty = - test "{!}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) - (paragraph (((f.ml (1 0) (1 3)) (simple ((f.ml (1 2) (1 3)) "") ()))))))) - (warnings ())) |}] - - let whitespace_only = - test "{! }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (paragraph (((f.ml (1 0) (1 4)) (simple ((f.ml (1 2) (1 4)) " ") ()))))))) - (warnings ())) |}] - - let internal_whitespace = - test "{!( * )}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (simple ((f.ml (1 2) (1 8)) "( * )") ()))))))) - (warnings ())) |}] - - (* TODO Limiting the character combinations allowed will make it easier to - catch expressions accidentally written inside references. This can also - be caught by a good resolver and resolver error messages. *) - (* t "expression" *) - let unterminated = - test "{!foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph (((f.ml (1 0) (1 5)) (simple ((f.ml (1 2) (1 5)) foo) ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 5-5:\ - \nEnd of text is not allowed in '{!...}' (cross-reference)."))) |}] - - let empty_kind = - test "{!:foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph (((f.ml (1 0) (1 7)) (simple ((f.ml (1 2) (1 7)) :foo) ()))))))) - (warnings ())) |}] - - let whitespace_kind = - test "{! :foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (simple ((f.ml (1 2) (1 8)) " :foo") ()))))))) - (warnings ())) |}] - - let with_kind_but_empty = - test "{!val:}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph (((f.ml (1 0) (1 7)) (simple ((f.ml (1 2) (1 7)) val:) ()))))))) - (warnings ())) |}] - - let with_kind_but_whitespace = - test "{!val: }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (simple ((f.ml (1 2) (1 8)) "val: ") ()))))))) - (warnings ())) |}] - - let leading_whitespace_in_kind = - test "{! val:foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) (simple ((f.ml (1 2) (1 11)) " val:foo") ()))))))) - (warnings ())) |}] - - let internal_whitespace_in_kind = - test "{!va l:foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) (simple ((f.ml (1 2) (1 11)) "va l:foo") ()))))))) - (warnings ())) |}] - - let internal_whitespace_in_referent = - test "{!val:( * )}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 12)) - (paragraph - (((f.ml (1 0) (1 12)) (simple ((f.ml (1 2) (1 12)) "val:( * )") ()))))))) - (warnings ())) |}] - - let two_colons = - test "{!val:foo:bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (paragraph - (((f.ml (1 0) (1 14)) (simple ((f.ml (1 2) (1 14)) val:foo:bar) ()))))))) - (warnings ())) |}] - - let space_before_colon = - test "{!val :foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) (simple ((f.ml (1 2) (1 11)) "val :foo") ()))))))) - (warnings ())) |}] - - let space_after_colon = - test "{!val: foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) (simple ((f.ml (1 2) (1 11)) "val: foo") ()))))))) - (warnings ())) |}] - - let unterminated_after_kind = - test "{!val:foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (paragraph - (((f.ml (1 0) (1 9)) (simple ((f.ml (1 2) (1 9)) val:foo) ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 9-9:\ - \nEnd of text is not allowed in '{!...}' (cross-reference)."))) |}] - - let operator = - test "{!(>>=)}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (simple ((f.ml (1 2) (1 8)) "(>>=)") ()))))))) - (warnings ())) |}] - - let operator_with_dash = - test "{!(@->)}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (simple ((f.ml (1 2) (1 8)) "(@->)") ()))))))) - (warnings ())) |}] - - let operator_with_dot = - test "{!(*.)}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph - (((f.ml (1 0) (1 7)) (simple ((f.ml (1 2) (1 7)) "(*.)") ()))))))) - (warnings ())) |}] - - let operator_with_colon = - test "{!(>::)}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (simple ((f.ml (1 2) (1 8)) "(>::)") ()))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Reference_with_text = struct - let basic = - test "{{!foo} bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 12)) - (paragraph - (((f.ml (1 0) (1 12)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 11)) (word bar)))))))))) - (warnings ())) |}] - - let degenerate = - test "{{!foo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 8)) (with_text ((f.ml (1 3) (1 7)) foo) ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-8:\ - \n'{{!...} ...}' (cross-reference) should not be empty."))) |}] - - let empty = - test "{{!foo} }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (paragraph - (((f.ml (1 0) (1 9)) (with_text ((f.ml (1 3) (1 7)) foo) ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-9:\ - \n'{{!...} ...}' (cross-reference) should not be empty."))) |}] - - let nested_markup = - test "{{!foo} {b bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (paragraph - (((f.ml (1 0) (1 16)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 15)) (bold (((f.ml (1 11) (1 14)) (word bar))))))))))))) - (warnings ())) |}] - - let in_markup = - test "{e {{!foo} bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (paragraph - (((f.ml (1 0) (1 16)) - (emphasis - (((f.ml (1 3) (1 15)) - (with_text ((f.ml (1 6) (1 10)) foo) - (((f.ml (1 11) (1 14)) (word bar))))))))))))) - (warnings ())) |}] - - let no_separating_space = - test "{{!foo}bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 7) (1 10)) (word bar)))))))))) - (warnings ())) |}] - - let kind = - test "{{!val:foo} bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (paragraph - (((f.ml (1 0) (1 16)) - (with_text ((f.ml (1 3) (1 11)) val:foo) - (((f.ml (1 12) (1 15)) (word bar)))))))))) - (warnings ())) |}] - - let nested_reference = - test "{{!foo} {!bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 15)) - (paragraph - (((f.ml (1 0) (1 15)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 14)) (simple ((f.ml (1 10) (1 14)) bar) ())))))))))) - (warnings ())) |}] - - let nested_empty = - test "{{!foo} {{!bar}}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 17)) - (paragraph - (((f.ml (1 0) (1 17)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 16)) (with_text ((f.ml (1 11) (1 15)) bar) ())))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-16:\ - \n'{{!...} ...}' (cross-reference) should not be empty."))) |}] - - let nested_through_emphasis = - test "{{!foo} {e {{!bar} baz}}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 25)) - (paragraph - (((f.ml (1 0) (1 25)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 24)) - (emphasis - (((f.ml (1 11) (1 23)) - (with_text ((f.ml (1 14) (1 18)) bar) - (((f.ml (1 19) (1 22)) (word baz)))))))))))))))) - (warnings ())) |}] - - let simple_through_emphasis = - test "{{!foo} {e {!bar}}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 19)) - (paragraph - (((f.ml (1 0) (1 19)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 18)) - (emphasis - (((f.ml (1 11) (1 17)) (simple ((f.ml (1 13) (1 17)) bar) ()))))))))))))) - (warnings ())) |}] - - let empty_target = - test "{{!} foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (paragraph - (((f.ml (1 0) (1 9)) - (with_text ((f.ml (1 3) (1 4)) "") (((f.ml (1 5) (1 8)) (word foo)))))))))) - (warnings ())) |}] - - let whitespace_only_in_target = - test "{{! } foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) - (with_text ((f.ml (1 3) (1 5)) " ") (((f.ml (1 6) (1 9)) (word foo)))))))))) - (warnings ())) |}] - - let internal_whitespace = - test "{{!( * )} baz}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (paragraph - (((f.ml (1 0) (1 14)) - (with_text ((f.ml (1 3) (1 9)) "( * )") - (((f.ml (1 10) (1 13)) (word baz)))))))))) - (warnings ())) |}] - - let unterminated = - test "{{!foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph - (((f.ml (1 0) (1 6)) (with_text ((f.ml (1 3) (1 6)) foo) ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 6-6:\ - \nEnd of text is not allowed in '{{!...} ...}' (cross-reference)." - "File \"f.ml\", line 1, characters 6-6:\ - \nEnd of text is not allowed in '{{!...} ...}' (cross-reference)." - "File \"f.ml\", line 1, characters 0-6:\ - \n'{{!...} ...}' (cross-reference) should not be empty."))) |}] - - let unterminated_content = - test "{{!foo} bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 11)) (word bar)))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 11-11:\ - \nEnd of text is not allowed in '{{!...} ...}' (cross-reference)."))) |}] - end in - () - -let%expect_test _ = - let module Link = struct - let basic = - test "{{:foo} bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 12)) - (paragraph - (((f.ml (1 0) (1 12)) (foo (((f.ml (1 8) (1 11)) (word bar)))))))))) - (warnings ())) |}] - - let nested_markup = - test "{{:foo} {b bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (paragraph - (((f.ml (1 0) (1 16)) - (foo - (((f.ml (1 8) (1 15)) (bold (((f.ml (1 11) (1 14)) (word bar))))))))))))) - (warnings ())) |}] - - let in_markup = - test "{e {{:foo} bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (paragraph - (((f.ml (1 0) (1 16)) - (emphasis - (((f.ml (1 3) (1 15)) (foo (((f.ml (1 11) (1 14)) (word bar))))))))))))) - (warnings ())) |}] - - let no_separating_space = - test "{{:foo}bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph - (((f.ml (1 0) (1 11)) (foo (((f.ml (1 7) (1 10)) (word bar)))))))))) - (warnings ())) |}] - - let nested_link = - test "{{:foo} {{:bar} baz}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 21)) - (paragraph - (((f.ml (1 0) (1 21)) - (foo - (((f.ml (1 8) (1 20)) (bar (((f.ml (1 16) (1 19)) (word baz))))))))))))) - (warnings ())) |}] - - let nested_through_emphasis = - test "{{:foo} {e {{:bar} baz}}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 25)) - (paragraph - (((f.ml (1 0) (1 25)) - (foo - (((f.ml (1 8) (1 24)) - (emphasis - (((f.ml (1 11) (1 23)) (bar (((f.ml (1 19) (1 22)) (word baz)))))))))))))))) - (warnings ())) |}] - - let reference_through_emphasis = - test "{{:foo} {e {!bar}}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 19)) - (paragraph - (((f.ml (1 0) (1 19)) - (foo - (((f.ml (1 8) (1 18)) - (emphasis - (((f.ml (1 11) (1 17)) (simple ((f.ml (1 13) (1 17)) bar) ()))))))))))))) - (warnings ())) |}] - - let nested_in_reference = - test "{{!foo} {e {{:bar} baz}}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 25)) - (paragraph - (((f.ml (1 0) (1 25)) - (with_text ((f.ml (1 3) (1 7)) foo) - (((f.ml (1 8) (1 24)) - (emphasis - (((f.ml (1 11) (1 23)) (bar (((f.ml (1 19) (1 22)) (word baz)))))))))))))))) - (warnings ())) |}] - - let empty_target = - test "{{:} foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (paragraph (((f.ml (1 0) (1 9)) ("" (((f.ml (1 5) (1 8)) (word foo)))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'{{:...} ...}' (external link) should not be empty."))) |}] - - let whitespace_only_in_target = - test "{{: } foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph - (((f.ml (1 0) (1 10)) ("" (((f.ml (1 6) (1 9)) (word foo)))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-5:\ - \n'{{:...} ...}' (external link) should not be empty."))) |}] - - let empty = - test "{{:foo}}"; - [%expect - {| - ((output (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (foo ()))))))) - (warnings ())) |}] - - let internal_whitespace = - test "{{:foo bar} baz}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (paragraph - (((f.ml (1 0) (1 16)) ("foo bar" (((f.ml (1 12) (1 15)) (word baz)))))))))) - (warnings ())) |}] - - let unterminated = - test "{{:foo"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (paragraph (((f.ml (1 0) (1 6)) (foo ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 6-6:\ - \nEnd of text is not allowed in '{{:...} ...}' (external link)." - "File \"f.ml\", line 1, characters 6-6:\ - \nEnd of text is not allowed in '{{:...} ...}' (external link)."))) |}] - - let single_braces = - test "{:foo}"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (paragraph (((f.ml (1 0) (1 6)) (foo ()))))))) - (warnings ())) |}] - - let unterminated_single_braces = - test "{:foo"; - [%expect - {| - ((output (((f.ml (1 0) (1 5)) (paragraph (((f.ml (1 0) (1 5)) (foo ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 5-5:\ - \nEnd of text is not allowed in '{:...} (external link)'."))) |}] - - let empty_single_braces = - test "{:}"; - [%expect - {| - ((output (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) ("" ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-3:\ - \n'{:...} (external link)' should not be empty."))) |}] - - let single_braces_whitespace_only = - test "{: }"; - [%expect - {| - ((output (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) ("" ()))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'{:...} (external link)' should not be empty."))) |}] - end in - () - -let%expect_test _ = - let module Module_list = struct - let basic = - test "{!modules:Foo}"; - [%expect - {| - ((output (((f.ml (1 0) (1 14)) (modules (((f.ml (1 0) (1 14)) Foo)))))) - (warnings ())) |}] - - let two = - test "{!modules:Foo Bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 18)) - (modules (((f.ml (1 0) (1 18)) Foo) ((f.ml (1 0) (1 18)) Bar)))))) - (warnings ())) |}] - - let extra_whitespace = - test "{!modules: Foo Bar }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 21)) - (modules (((f.ml (1 0) (1 21)) Foo) ((f.ml (1 0) (1 21)) Bar)))))) - (warnings ())) |}] - - let newline = - test "{!modules:Foo\nBar}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (modules (((f.ml (1 0) (2 4)) Foo) ((f.ml (1 0) (2 4)) Bar)))))) - (warnings ())) |}] - - let cr_lf = - test "{!modules:Foo\r\nBar}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 4)) - (modules (((f.ml (1 0) (2 4)) Foo) ((f.ml (1 0) (2 4)) Bar)))))) - (warnings ())) |}] - - let empty = - test "{!modules:}"; - [%expect - {| - ((output (((f.ml (1 0) (1 11)) (modules ())))) - (warnings - ( "File \"f.ml\", line 1, characters 0-11:\ - \n'{!modules ...}' should not be empty."))) |}] - - let whitespace_only = - test "{!modules: }"; - [%expect - {| - ((output (((f.ml (1 0) (1 12)) (modules ())))) - (warnings - ( "File \"f.ml\", line 1, characters 0-12:\ - \n'{!modules ...}' should not be empty."))) |}] - - let unterminated = - test "{!modules:"; - [%expect - {| - ((output (((f.ml (1 0) (1 10)) (modules ())))) - (warnings - ( "File \"f.ml\", line 1, characters 10-10:\ - \nEnd of text is not allowed in '{!modules ...}'." - "File \"f.ml\", line 1, characters 0-10:\ - \n'{!modules ...}' should not be empty."))) |}] - - let in_paragraph = - test "foo {!modules:Foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (paragraph (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) space)))) - ((f.ml (1 4) (1 18)) (modules (((f.ml (1 4) (1 18)) Foo)))))) - (warnings - ( "File \"f.ml\", line 1, characters 4-18:\ - \n'{!modules ...}' should begin on its own line."))) |}] - - let followed_by_word = - test "{!modules:Foo} foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) (modules (((f.ml (1 0) (1 14)) Foo)))) - ((f.ml (1 15) (1 18)) (paragraph (((f.ml (1 15) (1 18)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 15-18:\ - \nParagraph should begin on its own line."))) |}] - - let in_list = - test "- {!modules:Foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (unordered light - ((((f.ml (1 2) (1 16)) (modules (((f.ml (1 2) (1 16)) Foo)))))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Code_block = struct - let basic = - test "{[foo]}"; - [%expect - {| ((output (((f.ml (1 0) (1 7)) (code_block foo)))) (warnings ())) |}] - - let empty = - test "{[]}"; - [%expect - {| - ((output (((f.ml (1 0) (1 4)) (code_block "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'{[...]}' (code block) should not be empty."))) |}] - - let whitespace_only = - test "{[ ]}"; - [%expect - {| - ((output (((f.ml (1 0) (1 5)) (code_block "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-5:\ - \n'{[...]}' (code block) should not be empty."))) |}] - - let blank_line_only = - test "{[\n \n]}"; - [%expect - {| - ((output (((f.ml (1 0) (3 2)) (code_block "")))) - (warnings - ( "File \"f.ml\", line 1, character 0 to line 3, character 2:\ - \n'{[...]}' (code block) should not be empty."))) |}] - - let whitespace = - test "{[foo bar]}"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (code_block "foo bar")))) (warnings ())) |}] - - let newline = - test "{[foo\nbar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 5)) (code_block "foo\ - \nbar")))) (warnings ())) |}] - - let cr_lf = - test "{[foo\r\nbar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 5)) (code_block "foo\r\ - \nbar")))) (warnings ())) |}] - - let blank_line = - test "{[foo\n\nbar]}"; - [%expect - {| - ((output (((f.ml (1 0) (3 5)) (code_block "foo\ - \n\ - \nbar")))) (warnings ())) |}] - - let leading_whitespace = - test "{[ foo]}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (code_block foo)))) (warnings ())) |}] - - let leading_whitespace_two = - test "{[ foo\n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 6)) (code_block "foo\ - \nbar")))) (warnings ())) |}] - - let leading_whitespace_two_cr_lf = - test "{[ foo\r\n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 6)) (code_block "foo\r\ - \nbar")))) (warnings ())) |}] - - let leading_whitespace_two_different_indent = - test "{[ foo\n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 8)) (code_block "foo\ - \nbar")))) (warnings ())) |}] - - let leading_whitespace_two_different_indent_rev = - test "{[ foo\n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 6)) (code_block " foo\ - \nbar")))) (warnings ())) |}] - - let leading_whitespace_two_different_indent_reloc = - test "{[ foo\n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 11)) (code_block "foo\ - \n bar")))) (warnings ())) |}] - - let leading_whitespace_with_empty_line = - test "{[ foo\n\n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (3 6)) (code_block "foo\ - \n\ - \nbar")))) (warnings ())) |}] - - let leading_whitespace_with_whitespace_line_short = - test "{[ foo\n \n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (3 7)) (code_block "foo\ - \n \ - \nbar")))) (warnings ())) |}] - - let leading_whitespace_with_whitespace_line_long = - test "{[ foo\n \n bar]}"; - [%expect - {| - ((output (((f.ml (1 0) (3 6)) (code_block "foo\ - \n \ - \nbar")))) - (warnings ())) |}] - - let leading_whitespace_leading_newline = - test "{[\n foo\n bar\n]}"; - [%expect - {| - ((output (((f.ml (1 0) (4 2)) (code_block "foo\ - \nbar")))) (warnings ())) |}] - - let leading_tab = - test "{[\tfoo]}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (code_block foo)))) (warnings ())) |}] - - let leading_tab_two = - test "{[\tfoo\n\tbar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 6)) (code_block "foo\ - \nbar")))) (warnings ())) |}] - - let leading_tab_two_different_indent = - test "{[\tfoo\n\t\tbar]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 7)) (code_block "foo\ - \nbar")))) (warnings ())) |}] - - let leading_newline = - test "{[\nfoo]}"; - [%expect - {| ((output (((f.ml (1 0) (2 5)) (code_block foo)))) (warnings ())) |}] - - let leading_cr_lf = - test "{[\r\nfoo]}"; - [%expect - {| ((output (((f.ml (1 0) (2 5)) (code_block foo)))) (warnings ())) |}] - - let leading_newlines = - test "{[\n\nfoo]}"; - [%expect - {| ((output (((f.ml (1 0) (3 5)) (code_block foo)))) (warnings ())) |}] - - let leading_newline_with_space = - test "{[\n foo]}"; - [%expect - {| ((output (((f.ml (1 0) (2 6)) (code_block foo)))) (warnings ())) |}] - - let leading_newline_with_trash = - test "{[ \nfoo]}"; - [%expect - {| ((output (((f.ml (1 0) (2 5)) (code_block foo)))) (warnings ())) |}] - - let nested_opener = - test "{[{[]}"; - [%expect - {| ((output (((f.ml (1 0) (1 6)) (code_block {[)))) (warnings ())) |}] - - let nested_closer = - test "{[foo]}]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (1 7) (1 8)) (paragraph (((f.ml (1 7) (1 8)) (word ]))))) - ((f.ml (1 8) (1 9)) (paragraph (((f.ml (1 8) (1 9)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 7-8:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'." - "File \"f.ml\", line 1, characters 7-8:\ - \nParagraph should begin on its own line." - "File \"f.ml\", line 1, characters 8-9:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let nested_bracket = - test "{[]]}"; - [%expect - {| ((output (((f.ml (1 0) (1 5)) (code_block ])))) (warnings ())) |}] - - let two_nested_brackets = - test "{[]]]}"; - [%expect - {| ((output (((f.ml (1 0) (1 6)) (code_block ]])))) (warnings ())) |}] - - let nested_brackets_in_text = - test "{[foo]]bar]}"; - [%expect - {| ((output (((f.ml (1 0) (1 12)) (code_block foo]]bar)))) (warnings ())) |}] - - let trailing_whitespace = - test "{[foo ]}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (code_block "foo ")))) (warnings ())) |}] - - let trailing_tab = - test "{[foo\t]}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (code_block "foo\t")))) (warnings ())) |}] - - let trailing_newline = - test "{[foo\n]}"; - [%expect - {| ((output (((f.ml (1 0) (2 2)) (code_block foo)))) (warnings ())) |}] - - let trailing_cr_lf = - test "{[foo\r\n]}"; - [%expect - {| ((output (((f.ml (1 0) (2 2)) (code_block foo)))) (warnings ())) |}] - - let trailing_newlines = - test "{[foo\n\n]}"; - [%expect - {| ((output (((f.ml (1 0) (3 2)) (code_block foo)))) (warnings ())) |}] - - let preceded_by_whitespace = - test "{[foo]}"; - [%expect - {| ((output (((f.ml (1 0) (1 7)) (code_block foo)))) (warnings ())) |}] - - let followed_by_whitespace = - test "{[foo]}"; - [%expect - {| ((output (((f.ml (1 0) (1 7)) (code_block foo)))) (warnings ())) |}] - - let two_on_one_line = - test "{[foo]} {[bar]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (1 8) (1 15)) (code_block bar)))) - (warnings - ( "File \"f.ml\", line 1, characters 8-15:\ - \n'{[...]}' (code block) should begin on its own line."))) |}] - - let two = - test "{[foo]}\n{[bar]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (2 0) (2 7)) (code_block bar)))) - (warnings ())) |}] - - let two_with_blank_line = - test "{[foo]}\n\n{[bar]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (3 0) (3 7)) (code_block bar)))) - (warnings ())) |}] - - let followed_by_words = - test "{[foo]} bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word bar))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-11:\ - \nParagraph should begin on its own line."))) |}] - - let preceded_by_words = - test "foo {[bar]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (paragraph (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) space)))) - ((f.ml (1 4) (1 11)) (code_block bar)))) - (warnings - ( "File \"f.ml\", line 1, characters 4-11:\ - \n'{[...]}' (code block) should begin on its own line."))) |}] - - let preceded_by_paragraph = - test "foo\n{[bar]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (2 0) (2 7)) (code_block bar)))) - (warnings ())) |}] - - let followed_by_paragraph = - test "{[foo]}\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word bar))))))) - (warnings ())) |}] - - let unterminated = - test "{[foo"; - [%expect - {| - ((output (((f.ml (1 0) (1 5)) (code_block foo)))) - (warnings - ( "File \"f.ml\", line 1, characters 5-5:\ - \nEnd of text is not allowed in '{[...]}' (code block)."))) |}] - - let unterminated_bracket = - test "{[foo]"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (code_block foo])))) - (warnings - ( "File \"f.ml\", line 1, characters 6-6:\ - \nEnd of text is not allowed in '{[...]}' (code block)."))) |}] - - let trailing_cr = - test "{[foo\r]}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (code_block "foo\r")))) (warnings ())) |}] - - let comment = - test "{[(* foo *)\nlet bar = ()]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 14)) (code_block "(* foo *)\ - \nlet bar = ()")))) - (warnings ())) |}] - - let docstring = - test "{[(** foo *)\nlet bar = ()]}"; - [%expect - {| - ((output (((f.ml (1 0) (2 14)) (code_block "(** foo *)\ - \nlet bar = ()")))) - (warnings ())) |}] - - let docstring_with_code_block = - test "{[(** {[foo]} *)\nlet bar = ()]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 13)) (code_block "(** {[foo")) - ((f.ml (1 14) (2 13)) - (paragraph - (((f.ml (1 14) (1 16)) (word "*)")) ((f.ml (1 16) (2 0)) space) - ((f.ml (2 0) (2 3)) (word let)) ((f.ml (2 3) (2 4)) space) - ((f.ml (2 4) (2 7)) (word bar)) ((f.ml (2 7) (2 8)) space) - ((f.ml (2 8) (2 9)) (word =)) ((f.ml (2 9) (2 10)) space) - ((f.ml (2 10) (2 12)) (word "()")) ((f.ml (2 12) (2 13)) (word ]))))) - ((f.ml (2 13) (2 14)) (paragraph (((f.ml (2 13) (2 14)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 14-16:\ - \nParagraph should begin on its own line." - "File \"f.ml\", line 2, characters 12-13:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'." - "File \"f.ml\", line 2, characters 13-14:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - end in - () - -let%expect_test _ = - let module Verbatim = struct - let basic = - test "{v foo v}"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (verbatim foo)))) (warnings ())) |}] - - let empty = - test "{v v}"; - [%expect - {| - ((output (((f.ml (1 0) (1 5)) (verbatim "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-5:\ - \n'{v ... v}' (verbatim text) should not be empty."))) |}] - - let degenerate = - test "{vv}"; - [%expect - {| - ((output (((f.ml (1 0) (1 4)) (verbatim v})))) - (warnings - ( "File \"f.ml\", line 1, characters 2-4:\ - \n'v}' should be preceded by whitespace." - "File \"f.ml\", line 1, characters 0-2:\ - \n'{v' should be followed by whitespace."))) |}] - - let whitespace_only = - test "{v v}"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (verbatim "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'{v ... v}' (verbatim text) should not be empty."))) |}] - - let blank_line_only = - test "{v\n \nv}"; - [%expect - {| - ((output (((f.ml (1 0) (3 2)) (verbatim "")))) - (warnings - ( "File \"f.ml\", line 1, character 0 to line 3, character 2:\ - \n'{v ... v}' (verbatim text) should not be empty."))) |}] - - let no_leading_whitespace = - test "{vfoo v}"; - [%expect - {| - ((output (((f.ml (1 0) (1 8)) (verbatim foo)))) - (warnings - ( "File \"f.ml\", line 1, characters 0-2:\ - \n'{v' should be followed by whitespace."))) |}] - - let no_trailing_whitespace = - test "{v foov}"; - [%expect - {| - ((output (((f.ml (1 0) (1 8)) (verbatim foov})))) - (warnings - ( "File \"f.ml\", line 1, characters 6-8:\ - \n'v}' should be preceded by whitespace."))) |}] - - let multiple_leading_whitespace = - test "{v foo v}"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (verbatim " foo")))) (warnings ())) |}] - - let multiple_trailing_whitespace = - test "{v foo v}"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (verbatim "foo ")))) (warnings ())) |}] - - let leading_tab = - test "{v\tfoo v}"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (verbatim "\tfoo")))) (warnings ())) |}] - - let leading_newline = - test "{v\nfoo v}"; - [%expect - {| ((output (((f.ml (1 0) (2 6)) (verbatim foo)))) (warnings ())) |}] - - let leading_cr_lf = - test "{v\r\nfoo v}"; - [%expect - {| ((output (((f.ml (1 0) (2 6)) (verbatim foo)))) (warnings ())) |}] - - let trailing_tab = - test "{v foo\tv}"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (verbatim "foo\t")))) (warnings ())) |}] - - let trailing_newline = - test "{v foo\nv}"; - [%expect - {| ((output (((f.ml (1 0) (2 2)) (verbatim foo)))) (warnings ())) |}] - - let trailing_cr_lf = - test "{v foo\r\nv}"; - [%expect - {| ((output (((f.ml (1 0) (2 2)) (verbatim foo)))) (warnings ())) |}] - - let internal_whitespace = - test "{v foo bar v}"; - [%expect - {| ((output (((f.ml (1 0) (1 13)) (verbatim "foo bar")))) (warnings ())) |}] - - let newline = - test "{v foo\nbar v}"; - [%expect - {| - ((output (((f.ml (1 0) (2 6)) (verbatim "foo\ - \nbar")))) (warnings ())) |}] - - let cr_lf = - test "{v foo\r\nbar v}"; - [%expect - {| - ((output (((f.ml (1 0) (2 6)) (verbatim "foo\r\ - \nbar")))) (warnings ())) |}] - - let blank_line = - test "{v foo\n\nbar v}"; - [%expect - {| - ((output (((f.ml (1 0) (3 6)) (verbatim "foo\ - \n\ - \nbar")))) (warnings ())) |}] - - let leading_newlines = - test "{v\n\nfoo v}"; - [%expect - {| ((output (((f.ml (1 0) (3 6)) (verbatim foo)))) (warnings ())) |}] - - let leading_newline_with_space = - test "{v\n foo v}"; - [%expect - {| ((output (((f.ml (1 0) (2 7)) (verbatim " foo")))) (warnings ())) |}] - - let leading_newline_with_trash = - test "{v \nfoo v}"; - [%expect - {| ((output (((f.ml (1 0) (2 6)) (verbatim foo)))) (warnings ())) |}] - - let nested_opener = - test "{v {v v}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (verbatim {v)))) (warnings ())) |}] - - let nested_closer = - test "{v foo v} v}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (verbatim foo)) - ((f.ml (1 10) (1 11)) (paragraph (((f.ml (1 10) (1 11)) (word v))))) - ((f.ml (1 11) (1 12)) (paragraph (((f.ml (1 11) (1 12)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 10-11:\ - \nParagraph should begin on its own line." - "File \"f.ml\", line 1, characters 11-12:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let nested_closer_with_word = - test "{v {dev} v}"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (verbatim {dev})))) (warnings ())) |}] - - let nested_v = - test "{v v v}"; - [%expect - {| ((output (((f.ml (1 0) (1 7)) (verbatim v)))) (warnings ())) |}] - - let two_nested_vs = - test "{v vv v}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (verbatim vv)))) (warnings ())) |}] - - let nested_v_at_end = - test "{v vv}"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (verbatim vv})))) - (warnings - ( "File \"f.ml\", line 1, characters 4-6:\ - \n'v}' should be preceded by whitespace."))) |}] - - let two_nested_vs_at_end = - test "{v vvv}"; - [%expect - {| - ((output (((f.ml (1 0) (1 7)) (verbatim vvv})))) - (warnings - ( "File \"f.ml\", line 1, characters 5-7:\ - \n'v}' should be preceded by whitespace."))) |}] - - let nested_vs_in_text = - test "{v foovvbar v}"; - [%expect - {| ((output (((f.ml (1 0) (1 14)) (verbatim foovvbar)))) (warnings ())) |}] - - let trailing_newlines = - test "{v foo\n\nv}"; - [%expect - {| ((output (((f.ml (1 0) (3 2)) (verbatim foo)))) (warnings ())) |}] - - let preceded_by_whitespace = - test "{v foo v}"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (verbatim foo)))) (warnings ())) |}] - - let followed_by_whitespace = - test "{v foo v}"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (verbatim foo)))) (warnings ())) |}] - - let two_on_one_line = - test "{v foo v} {v bar v}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (verbatim foo)) ((f.ml (1 10) (1 19)) (verbatim bar)))) - (warnings - ( "File \"f.ml\", line 1, characters 10-19:\ - \n'{v ... v}' (verbatim text) should begin on its own line."))) |}] - - let two = - test "{v foo v}\n{v bar v}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (verbatim foo)) ((f.ml (2 0) (2 9)) (verbatim bar)))) - (warnings ())) |}] - - let two_with_blank_line = - test "{v foo v}\n\n{v bar v}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (verbatim foo)) ((f.ml (3 0) (3 9)) (verbatim bar)))) - (warnings ())) |}] - - let followed_by_words = - test "{v foo v} bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (verbatim foo)) - ((f.ml (1 10) (1 13)) (paragraph (((f.ml (1 10) (1 13)) (word bar))))))) - (warnings - ( "File \"f.ml\", line 1, characters 10-13:\ - \nParagraph should begin on its own line."))) |}] - - let preceded_by_words = - test "foo {v bar v}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (paragraph (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) space)))) - ((f.ml (1 4) (1 13)) (verbatim bar)))) - (warnings - ( "File \"f.ml\", line 1, characters 4-13:\ - \n'{v ... v}' (verbatim text) should begin on its own line."))) |}] - - let preceded_by_paragraph = - test "foo\n{v bar v}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (2 0) (2 9)) (verbatim bar)))) - (warnings ())) |}] - - let followed_by_paragraph = - test "{v foo v}\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (verbatim foo)) - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word bar))))))) - (warnings ())) |}] - - let unterminated = - test "{v foo"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (verbatim foo)))) - (warnings - ( "File \"f.ml\", line 1, characters 6-6:\ - \nEnd of text is not allowed in '{v ... v}' (verbatim text)."))) |}] - - let unterminated_v = - test "{v foo v"; - [%expect - {| - ((output (((f.ml (1 0) (1 8)) (verbatim "foo v")))) - (warnings - ( "File \"f.ml\", line 1, characters 8-8:\ - \nEnd of text is not allowed in '{v ... v}' (verbatim text)."))) |}] - - let unterminated_empty = - test "{v"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (verbatim "")))) - (warnings - ( "File \"f.ml\", line 1, characters 2-2:\ - \nEnd of text is not allowed in '{v ... v}' (verbatim text)." - "File \"f.ml\", line 1, characters 0-2:\ - \n'{v ... v}' (verbatim text) should not be empty."))) |}] - - let unterminated_whitespace = - test "{v"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (verbatim "")))) - (warnings - ( "File \"f.ml\", line 1, characters 2-2:\ - \nEnd of text is not allowed in '{v ... v}' (verbatim text)." - "File \"f.ml\", line 1, characters 0-2:\ - \n'{v ... v}' (verbatim text) should not be empty."))) |}] - - let unterminated_whitespace_2 = - test "{v"; - [%expect - {| - ((output (((f.ml (1 0) (1 2)) (verbatim "")))) - (warnings - ( "File \"f.ml\", line 1, characters 2-2:\ - \nEnd of text is not allowed in '{v ... v}' (verbatim text)." - "File \"f.ml\", line 1, characters 0-2:\ - \n'{v ... v}' (verbatim text) should not be empty."))) |}] - - let trailing_cr = - test "{v foo\rv}"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (verbatim "foo\r")))) (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Shorthand_list = struct - let basic = - test "- foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))))) - (warnings ())) |}] - - let multiple_items = - test "- foo\n- bar"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo)))))) - (((f.ml (2 2) (2 5)) (paragraph (((f.ml (2 2) (2 5)) (word bar))))))))))) - (warnings ())) |}] - - let two_lists = - test "- foo\n\n- bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))) - ((f.ml (3 0) (3 5)) - (unordered light - ((((f.ml (3 2) (3 5)) (paragraph (((f.ml (3 2) (3 5)) (word bar))))))))))) - (warnings ())) |}] - - let ordered = - test "+ foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (ordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))))) - (warnings ())) |}] - - let leading_whitespace = - test "- foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))))) - (warnings ())) |}] - - let trailing_whitespace = - test "- foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))))) - (warnings ())) |}] - - let bullet_in_line = - test "- foo - bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (unordered light - ((((f.ml (1 2) (1 11)) - (paragraph - (((f.ml (1 2) (1 5)) (word foo)) ((f.ml (1 5) (1 6)) space) - ((f.ml (1 6) (1 7)) (word -)) ((f.ml (1 7) (1 8)) space) - ((f.ml (1 8) (1 11)) (word bar))))))))))) - (warnings ())) |}] - - let bullet_in_line_immediately = - test "- - foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (unordered light - (() - (((f.ml (1 4) (1 7)) (paragraph (((f.ml (1 4) (1 7)) (word foo))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 2-3:\ - \n'-' (bulleted list item) should begin on its own line." - "File \"f.ml\", line 1, characters 0-1:\ - \n'-' (bulleted list item) should not be empty."))) |}] - - let code_block = - test "- {[foo]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (unordered light ((((f.ml (1 2) (1 9)) (code_block foo)))))))) - (warnings ())) |}] - - let verbatim = - test "- {v foo v}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (unordered light ((((f.ml (1 2) (1 11)) (verbatim foo)))))))) - (warnings ())) |}] - - let multiple_blocks = - test "- foo\n{[bar]}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 7)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))) - ((f.ml (2 0) (2 7)) (code_block bar)))))))) - (warnings ())) |}] - - let followed_by_code_block = - test "- foo\n\n{[bar]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))) - ((f.ml (3 0) (3 7)) (code_block bar)))) - (warnings ())) |}] - - let different_kinds = - test "- foo\n+ bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))) - ((f.ml (2 0) (2 5)) - (ordered light - ((((f.ml (2 2) (2 5)) (paragraph (((f.ml (2 2) (2 5)) (word bar))))))))))) - (warnings ())) |}] - - let no_content = - test "-"; - [%expect - {| - ((output (((f.ml (1 0) (1 1)) (unordered light (()))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \n'-' (bulleted list item) should not be empty."))) |}] - - let immediate_newline = - test "-\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (unordered light - ((((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))))))) - (warnings ())) |}] - - let immediate_blank_line = - test "-\n\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 1)) (unordered light (()))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \n'-' (bulleted list item) should not be empty."))) |}] - - let immediate_markup = - test "-{b foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (unordered light - ((((f.ml (1 1) (1 8)) - (paragraph - (((f.ml (1 1) (1 8)) (bold (((f.ml (1 4) (1 7)) (word foo)))))))))))))) - (warnings ())) |}] - - let after_code_block = - test "{[foo]} - bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (1 8) (1 13)) - (unordered light - ((((f.ml (1 10) (1 13)) (paragraph (((f.ml (1 10) (1 13)) (word bar))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-9:\ - \n'-' (bulleted list item) should begin on its own line."))) |}] - end in - () - -let%expect_test _ = - let module Explicit_list = struct - let basic = - test "{ul {li foo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 13)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))))))))) - (warnings ())) |}] - - let ordered = - test "{ol {li foo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 13)) - (ordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))))))))) - (warnings ())) |}] - - let two_items = - test "{ul {li foo} {li bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 22)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo)))))) - (((f.ml (1 17) (1 20)) (paragraph (((f.ml (1 17) (1 20)) (word bar))))))))))) - (warnings ())) |}] - - let items_on_separate_lines = - test "{ul {li foo}\n{li bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 9)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo)))))) - (((f.ml (2 4) (2 7)) (paragraph (((f.ml (2 4) (2 7)) (word bar))))))))))) - (warnings ())) |}] - - let blank_line = - test "{ul {li foo}\n\n{li bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (3 9)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo)))))) - (((f.ml (3 4) (3 7)) (paragraph (((f.ml (3 4) (3 7)) (word bar))))))))))) - (warnings ())) |}] - - let blank_line_in_item = - test "{ul {li foo\n\nbar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (3 5)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word bar))))))))))) - (warnings ())) |}] - - let junk = - test "{ul foo}"; - [%expect - {| - ((output (((f.ml (1 0) (1 8)) (unordered heavy ())))) - (warnings - ( "File \"f.ml\", line 1, characters 4-7:\ - \n'foo' is not allowed in '{ul ...}' (bulleted list).\ - \nSuggestion: move 'foo' into a list item, '{li ...}' or '{- ...}'." - "File \"f.ml\", line 1, characters 0-3:\ - \n'{ul ...}' (bulleted list) should not be empty."))) |}] - - let junk_with_no_whitespace = - test "{ulfoo}"; - [%expect - {| - ((output (((f.ml (1 0) (1 7)) (unordered heavy ())))) - (warnings - ( "File \"f.ml\", line 1, characters 3-6:\ - \n'foo' is not allowed in '{ul ...}' (bulleted list).\ - \nSuggestion: move 'foo' into a list item, '{li ...}' or '{- ...}'." - "File \"f.ml\", line 1, characters 0-3:\ - \n'{ul ...}' (bulleted list) should not be empty."))) |}] - - let empty = - test "{ul}"; - [%expect - {| - ((output (((f.ml (1 0) (1 4)) (unordered heavy ())))) - (warnings - ( "File \"f.ml\", line 1, characters 0-3:\ - \n'{ul ...}' (bulleted list) should not be empty."))) |}] - - let unterminated_list = - test "{ul"; - [%expect - {| - ((output (((f.ml (1 0) (1 3)) (unordered heavy ())))) - (warnings - ( "File \"f.ml\", line 1, characters 3-3:\ - \nEnd of text is not allowed in '{ul ...}' (bulleted list)." - "File \"f.ml\", line 1, characters 0-3:\ - \n'{ul ...}' (bulleted list) should not be empty."))) |}] - - let no_whitespace = - test "{ul{li foo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 12)) - (unordered heavy - ((((f.ml (1 7) (1 10)) (paragraph (((f.ml (1 7) (1 10)) (word foo))))))))))) - (warnings ())) |}] - - let whitespace_at_end_of_item = - test "{ul {li foo\n\n\n}}"; - [%expect - {| - ((output - (((f.ml (1 0) (4 2)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))))))))) - (warnings ())) |}] - - let unterminated_li_syntax = - test "{ul {li foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 11-11:\ - \nEnd of text is not allowed in '{li ...}' (list item)." - "File \"f.ml\", line 1, characters 11-11:\ - \nEnd of text is not allowed in '{ul ...}' (bulleted list)."))) |}] - - let unterminated_left_curly_brace = - test "{ul {- foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (unordered heavy - ((((f.ml (1 7) (1 10)) (paragraph (((f.ml (1 7) (1 10)) (word foo))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 10-10:\ - \nEnd of text is not allowed in '{- ...}' (list item)." - "File \"f.ml\", line 1, characters 10-10:\ - \nEnd of text is not allowed in '{ul ...}' (bulleted list)."))) |}] - - let empty_li_styntax = - test "{ul {li }}"; - [%expect - {| - ((output (((f.ml (1 0) (1 10)) (unordered heavy (()))))) - (warnings - ( "File \"f.ml\", line 1, characters 4-7:\ - \n'{li ...}' (list item) should not be empty."))) |}] - - let empty_left_curly_brace = - test "{ul {- }}"; - [%expect - {| - ((output (((f.ml (1 0) (1 9)) (unordered heavy (()))))) - (warnings - ( "File \"f.ml\", line 1, characters 4-6:\ - \n'{- ...}' (list item) should not be empty."))) |}] - - let li_syntax_without_whitespace = - test "{ul {lifoo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 12)) - (unordered heavy - ((((f.ml (1 7) (1 10)) (paragraph (((f.ml (1 7) (1 10)) (word foo))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 4-7:\ - \n'{li ...}' should be followed by space, a tab, or a new line."))) |}] - - let li_syntax_followed_by_newline = - test "{ul {li\nfoo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (unordered heavy - ((((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))))))) - (warnings ())) |}] - - let li_syntax_followed_by_cr_lf = - test "{ul {li\r\nfoo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (unordered heavy - ((((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))))))) - (warnings ())) |}] - - let li_syntax_followed_by_blank_line = - test "{ul {li\n\nfoo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (3 5)) - (unordered heavy - ((((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word foo))))))))))) - (warnings ())) |}] - - let left_curly_brace_without_whitespace = - test "{ul {-foo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (unordered heavy - ((((f.ml (1 6) (1 9)) (paragraph (((f.ml (1 6) (1 9)) (word foo))))))))))) - (warnings ())) |}] - - let mixed_list_items = - test "{ul {li foo} {- bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 21)) - (unordered heavy - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo)))))) - (((f.ml (1 16) (1 19)) (paragraph (((f.ml (1 16) (1 19)) (word bar))))))))))) - (warnings ())) |}] - - let nested = - test "{ul {li {ul {li foo}}}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 23)) - (unordered heavy - ((((f.ml (1 8) (1 21)) - (unordered heavy - ((((f.ml (1 16) (1 19)) - (paragraph (((f.ml (1 16) (1 19)) (word foo))))))))))))))) - (warnings ())) |}] - - let shorthand_in_explicit = - test "{ul {li - foo\n- bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 7)) - (unordered heavy - ((((f.ml (1 8) (2 5)) - (unordered light - ((((f.ml (1 10) (1 13)) - (paragraph (((f.ml (1 10) (1 13)) (word foo)))))) - (((f.ml (2 2) (2 5)) (paragraph (((f.ml (2 2) (2 5)) (word bar))))))))))))))) - (warnings ())) |}] - - let explicit_in_shorthand = - test "- {ul {li foo}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 15)) - (unordered light - ((((f.ml (1 2) (1 15)) - (unordered heavy - ((((f.ml (1 10) (1 13)) - (paragraph (((f.ml (1 10) (1 13)) (word foo))))))))))))))) - (warnings ())) |}] - - let bare_li_syntax = - test "{li foo}"; - [%expect - {| - ((output - (((f.ml (1 4) (1 7)) (paragraph (((f.ml (1 4) (1 7)) (word foo))))) - ((f.ml (1 7) (1 8)) (paragraph (((f.ml (1 7) (1 8)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-3:\ - \n'{li ...}' (list item) is not allowed in top-level text.\ - \nSuggestion: move '{li ...}' into '{ul ...}' (bulleted list), or use '-' (bulleted list item)." - "File \"f.ml\", line 1, characters 7-8:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let bare_left_curly_brace = - test "{- foo"; - [%expect - {| - ((output - (((f.ml (1 3) (1 6)) (paragraph (((f.ml (1 3) (1 6)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-2:\ - \n'{- ...}' (list item) is not allowed in top-level text.\ - \nSuggestion: move '{- ...}' into '{ul ...}' (bulleted list), or use '-' (bulleted list item)."))) |}] - - let after_code_block = - test "{[foo]} {ul {li bar}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (1 8) (1 21)) - (unordered heavy - ((((f.ml (1 16) (1 19)) (paragraph (((f.ml (1 16) (1 19)) (word bar))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-11:\ - \n'{ul ...}' (bulleted list) should begin on its own line."))) |}] - end in - () - -let%expect_test _ = - let module Deprecated = struct - let basic = - test "@deprecated"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (@deprecated)))) (warnings ())) |}] - - let words = - test "@deprecated foo bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 19)) - (@deprecated - ((f.ml (1 12) (1 19)) - (paragraph - (((f.ml (1 12) (1 15)) (word foo)) ((f.ml (1 15) (1 16)) space) - ((f.ml (1 16) (1 19)) (word bar))))))))) - (warnings ())) |}] - - let multiline = - test "@deprecated foo\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (@deprecated - ((f.ml (1 12) (2 3)) - (paragraph - (((f.ml (1 12) (1 15)) (word foo)) ((f.ml (1 15) (2 0)) space) - ((f.ml (2 0) (2 3)) (word bar))))))))) - (warnings ())) |}] - - let paragraphs = - test "@deprecated foo\n\nbar"; - [%expect - {| - ((output - (((f.ml (1 0) (3 3)) - (@deprecated - ((f.ml (1 12) (1 15)) (paragraph (((f.ml (1 12) (1 15)) (word foo))))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word bar))))))))) - (warnings ())) |}] - - let whitespace_only = - test "@deprecated"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (@deprecated)))) (warnings ())) |}] - - let immediate_newline = - test "@deprecated\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (@deprecated - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))))) - (warnings ())) |}] - - let immediate_cr_lf = - test "@deprecated\r\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (@deprecated - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))))) - (warnings ())) |}] - - let immediate_blank_line = - test "@deprecated\n\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (3 3)) - (@deprecated - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word foo))))))))) - (warnings ())) |}] - - let extra_whitespace = - test "@deprecated foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 16)) - (@deprecated - ((f.ml (1 13) (1 16)) (paragraph (((f.ml (1 13) (1 16)) (word foo))))))))) - (warnings ())) |}] - - let followed_by_deprecated = - test "@deprecated foo\n@deprecated bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 15)) - (@deprecated - ((f.ml (1 12) (1 15)) (paragraph (((f.ml (1 12) (1 15)) (word foo))))))) - ((f.ml (2 0) (2 15)) - (@deprecated - ((f.ml (2 12) (2 15)) (paragraph (((f.ml (2 12) (2 15)) (word bar))))))))) - (warnings ())) |}] - - let followed_by_deprecated_cr_lf = - test "@deprecated foo\r\n@deprecated bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 15)) - (@deprecated - ((f.ml (1 12) (1 15)) (paragraph (((f.ml (1 12) (1 15)) (word foo))))))) - ((f.ml (2 0) (2 15)) - (@deprecated - ((f.ml (2 12) (2 15)) (paragraph (((f.ml (2 12) (2 15)) (word bar))))))))) - (warnings ())) |}] - - let nested_in_self = - test "@deprecated foo @deprecated bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 31)) - (@deprecated - ((f.ml (1 12) (1 16)) - (paragraph - (((f.ml (1 12) (1 15)) (word foo)) ((f.ml (1 15) (1 16)) space)))) - ((f.ml (1 16) (1 27)) - (paragraph (((f.ml (1 16) (1 27)) (word @deprecated))))) - ((f.ml (1 28) (1 31)) (paragraph (((f.ml (1 28) (1 31)) (word bar))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 16-27:\ - \n'@deprecated' is not allowed in '@deprecated'.\ - \nSuggestion: move '@deprecated' outside of any other markup."))) |}] - - let nested_in_self_at_start = - test "@deprecated @deprecated foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 27)) - (@deprecated - ((f.ml (1 12) (1 23)) - (paragraph (((f.ml (1 12) (1 23)) (word @deprecated))))) - ((f.ml (1 24) (1 27)) (paragraph (((f.ml (1 24) (1 27)) (word foo))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 12-23:\ - \n'@deprecated' is not allowed in '@deprecated'.\ - \nSuggestion: move '@deprecated' outside of any other markup."))) |}] - - let preceded_by_paragraph = - test "foo\n@deprecated"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (2 0) (2 11)) (@deprecated)))) - (warnings ())) |}] - - let preceded_by_shorthand_list = - test "- foo\n@deprecated"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))) - ((f.ml (2 0) (2 11)) (@deprecated)))) - (warnings ())) |}] - - let with_shorthand_list = - test "@deprecated - foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 17)) - (@deprecated - ((f.ml (1 12) (1 17)) - (unordered light - ((((f.ml (1 14) (1 17)) - (paragraph (((f.ml (1 14) (1 17)) (word foo))))))))))))) - (warnings ())) |}] - - let with_shorthand_list_after_newline = - test "@deprecated\n- foo"; - [%expect - {| - ((output - (((f.ml (1 0) (2 5)) - (@deprecated - ((f.ml (2 0) (2 5)) - (unordered light - ((((f.ml (2 2) (2 5)) (paragraph (((f.ml (2 2) (2 5)) (word foo))))))))))))) - (warnings ())) |}] - - let prefix = - test "@deprecatedfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (paragraph (((f.ml (1 0) (1 14)) (word @deprecatedfoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-14:\ - \nUnknown tag '@deprecatedfoo'."))) |}] - - let after_code_block = - test "{[foo]} @deprecated"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) ((f.ml (1 8) (1 19)) (@deprecated)))) - (warnings - ( "File \"f.ml\", line 1, characters 8-19:\ - \n'@deprecated' should begin on its own line."))) |}] - - let followed_by_section = - test "@deprecated foo\n{2 Bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (2 7)) - (@deprecated - ((f.ml (1 12) (1 15)) (paragraph (((f.ml (1 12) (1 15)) (word foo))))) - ((f.ml (2 0) (2 7)) (paragraph (((f.ml (2 3) (2 6)) (word Bar))))))))) - (warnings - ( "File \"f.ml\", line 2, characters 0-2:\ - \n'{2 ...}' (section heading) is not allowed in '@deprecated'.\ - \nSuggestion: move '{2' outside of any other markup."))) |}] - end in - () - -let%expect_test _ = - let module Param = struct - let basic = - test "@param foo"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@param foo)))) (warnings ())) |}] - - let bare = - test "@param"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (@param "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'@param' expects parameter name on the same line."))) |}] - - let bare_with_whitespace = - test "@param"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (@param "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'@param' expects parameter name on the same line."))) |}] - - let immediate_newline = - test "@param\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (@param "" - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'@param' expects parameter name on the same line."))) |}] - - let followed_by_whitespace = - test "@param foo"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@param foo)))) (warnings ())) |}] - - let extra_whitespace = - test "@param foo"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (@param foo)))) (warnings ())) |}] - - let words = - test "@param foo bar baz"; - [%expect - {| - ((output - (((f.ml (1 0) (1 18)) - (@param foo - ((f.ml (1 11) (1 18)) - (paragraph - (((f.ml (1 11) (1 14)) (word bar)) ((f.ml (1 14) (1 15)) space) - ((f.ml (1 15) (1 18)) (word baz))))))))) - (warnings ())) |}] - - let multiline = - test "@param foo\nbar\nbaz"; - [%expect - {| - ((output - (((f.ml (1 0) (3 3)) - (@param foo - ((f.ml (2 0) (3 3)) - (paragraph - (((f.ml (2 0) (2 3)) (word bar)) ((f.ml (2 3) (3 0)) space) - ((f.ml (3 0) (3 3)) (word baz))))))))) - (warnings ())) |}] - - let paragraphs = - test "@param foo bar\n\nbaz"; - [%expect - {| - ((output - (((f.ml (1 0) (3 3)) - (@param foo - ((f.ml (1 11) (1 14)) (paragraph (((f.ml (1 11) (1 14)) (word bar))))) - ((f.ml (3 0) (3 3)) (paragraph (((f.ml (3 0) (3 3)) (word baz))))))))) - (warnings ())) |}] - - let two = - test "@param foo\n@param bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) (@param foo)) ((f.ml (2 0) (2 10)) (@param bar)))) - (warnings ())) |}] - - let nested = - test "@param foo @param bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 21)) - (@param foo - ((f.ml (1 11) (1 21)) - (paragraph - (((f.ml (1 11) (1 21)) (word @param)) ((f.ml (1 11) (1 21)) space) - ((f.ml (1 11) (1 21)) (word bar))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 11-21:\ - \n'@param' is not allowed in '@param'.\ - \nSuggestion: move '@param' outside of any other markup."))) |}] - - let preceded_by_paragraph = - test "foo\n@param bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (2 0) (2 10)) (@param bar)))) - (warnings ())) |}] - - let prefix = - test "@paramfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (paragraph (((f.ml (1 0) (1 9)) (word @paramfoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-9:\ - \nUnknown tag '@paramfoo'."))) |}] - - let after_code_block = - test "{[foo]} @param foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) ((f.ml (1 8) (1 18)) (@param foo)))) - (warnings - ( "File \"f.ml\", line 1, characters 8-18:\ - \n'@param' should begin on its own line."))) |}] - end in - () - -let%expect_test _ = - let module Raise = struct - let basic = - test "@raise Foo"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@raise Foo)))) (warnings ())) |}] - - let bare = - test "@raise"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (@raise "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'@raise' expects exception constructor on the same line."))) |}] - - let words = - test "@raise foo bar baz"; - [%expect - {| - ((output - (((f.ml (1 0) (1 18)) - (@raise foo - ((f.ml (1 11) (1 18)) - (paragraph - (((f.ml (1 11) (1 14)) (word bar)) ((f.ml (1 14) (1 15)) space) - ((f.ml (1 15) (1 18)) (word baz))))))))) - (warnings ())) |}] - - let prefix = - test "@raisefoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (paragraph (((f.ml (1 0) (1 9)) (word @raisefoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-9:\ - \nUnknown tag '@raisefoo'."))) |}] - end in - () - -let%expect_test _ = - let module Return = struct - let basic = - test "@return"; - [%expect {| ((output (((f.ml (1 0) (1 7)) (@return)))) (warnings ())) |}] - - let words = - test "@return foo bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 15)) - (@return - ((f.ml (1 8) (1 15)) - (paragraph - (((f.ml (1 8) (1 11)) (word foo)) ((f.ml (1 11) (1 12)) space) - ((f.ml (1 12) (1 15)) (word bar))))))))) - (warnings ())) |}] - - let prefix = - test "@returnfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph (((f.ml (1 0) (1 10)) (word @returnfoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-10:\ - \nUnknown tag '@returnfoo'."))) |}] - end in - () - -let%expect_test _ = - let module See = struct - let url = - test "@see "; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@see url foo)))) (warnings ())) |}] - - let file = - test "@see 'foo'"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@see file foo)))) (warnings ())) |}] - - let document = - test "@see \"foo\""; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@see document foo)))) (warnings ())) |}] - - let bare = - test "@see"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (word @see))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'@see' should be followed by , 'file', or \"document title\"."))) |}] - - let unterminated_url = - test "@see , 'file', or \"document title\"."))) |}] - - let unterminated_file = - test "@see 'foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) - (paragraph - (((f.ml (1 0) (1 4)) (word @see)) ((f.ml (1 4) (1 5)) space) - ((f.ml (1 5) (1 9)) (word 'foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'@see' should be followed by , 'file', or \"document title\"."))) |}] - - let unterminated_document = - test "@see foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) - (paragraph - (((f.ml (1 0) (1 4)) (word @see)) ((f.ml (1 4) (1 5)) space) - ((f.ml (1 5) (1 8)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-4:\ - \n'@see' should be followed by , 'file', or \"document title\"."))) |}] - - let no_space = - test "@see"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (@see url foo)))) (warnings ())) |}] - - let words = - test "@see bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (@see url foo - ((f.ml (1 11) (1 14)) (paragraph (((f.ml (1 11) (1 14)) (word bar))))))))) - (warnings ())) |}] - - let prefix = - test "@seefoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 0) (1 7)) (word @seefoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \nUnknown tag '@seefoo'."))) |}] - - let after_code_block = - test "{[foo]} @see "; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (code_block foo)) - ((f.ml (1 8) (1 18)) (@see url foo)))) - (warnings - ( "File \"f.ml\", line 1, characters 8-18:\ - \n'@see' should begin on its own line."))) |}] - - let url_attempted_nested_closer = - test "@see bar>"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (@see url foo - ((f.ml (1 10) (1 14)) (paragraph (((f.ml (1 10) (1 14)) (word bar>))))))))) - (warnings ())) |}] - - let file_attempted_nested_closer = - test "@see 'foo'bar'"; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (@see file foo - ((f.ml (1 10) (1 14)) (paragraph (((f.ml (1 10) (1 14)) (word bar'))))))))) - (warnings ())) |}] - - let document_attempted_nested_closer = - test "@see \"foo\"bar\""; - [%expect - {| - ((output - (((f.ml (1 0) (1 14)) - (@see document foo - ((f.ml (1 10) (1 14)) - (paragraph (((f.ml (1 10) (1 14)) (word "bar\""))))))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Since = struct - let basic = - test "@since foo"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@since foo)))) (warnings ())) |}] - - let bare = - test "@since"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (@since "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'@since' should not be empty."))) |}] - - let prefix = - test "@sincefoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 9)) (paragraph (((f.ml (1 0) (1 9)) (word @sincefoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-9:\ - \nUnknown tag '@sincefoo'."))) |}] - - let with_whitespace = - test "@since foo bar"; - [%expect - {| ((output (((f.ml (1 0) (1 14)) (@since "foo bar")))) (warnings ())) |}] - - let leading_whitespace = - test "@since foo"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (@since foo)))) (warnings ())) |}] - - let trailing_whitespace = - test "@since foo"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@since foo)))) (warnings ())) |}] - - let whitespace_only = - test "@since"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (@since "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'@since' should not be empty."))) |}] - end in - () - -let%expect_test _ = - let module Before = struct - let basic = - test "@before Foo"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (@before Foo)))) (warnings ())) |}] - - let bare = - test "@before"; - [%expect - {| - ((output (((f.ml (1 0) (1 7)) (@before "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \n'@before' expects version number on the same line."))) |}] - - let words = - test "@before foo bar baz"; - [%expect - {| - ((output - (((f.ml (1 0) (1 19)) - (@before foo - ((f.ml (1 12) (1 19)) - (paragraph - (((f.ml (1 12) (1 15)) (word bar)) ((f.ml (1 15) (1 16)) space) - ((f.ml (1 16) (1 19)) (word baz))))))))) - (warnings ())) |}] - - let prefix = - test "@beforefoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph (((f.ml (1 0) (1 10)) (word @beforefoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-10:\ - \nUnknown tag '@beforefoo'."))) |}] - end in - () - -let%expect_test _ = - let module Version = struct - let basic = - test "@version foo"; - [%expect - {| ((output (((f.ml (1 0) (1 12)) (@version foo)))) (warnings ())) |}] - - let bare = - test "@version"; - [%expect - {| - ((output (((f.ml (1 0) (1 8)) (@version "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-8:\ - \n'@version' should not be empty."))) |}] - - let prefix = - test "@versionfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (paragraph (((f.ml (1 0) (1 11)) (word @versionfoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-11:\ - \nUnknown tag '@versionfoo'."))) |}] - - let with_whitespace = - test "@version foo bar"; - [%expect - {| ((output (((f.ml (1 0) (1 16)) (@version "foo bar")))) (warnings ())) |}] - - let leading_whitespace = - test "@version foo"; - [%expect - {| ((output (((f.ml (1 0) (1 13)) (@version foo)))) (warnings ())) |}] - - let trailing_whitespace = - test "@version foo"; - [%expect - {| ((output (((f.ml (1 0) (1 12)) (@version foo)))) (warnings ())) |}] - - let whitespace_only = - test "@version"; - [%expect - {| - ((output (((f.ml (1 0) (1 8)) (@version "")))) - (warnings - ( "File \"f.ml\", line 1, characters 0-8:\ - \n'@version' should not be empty."))) |}] - end in - () - -let%expect_test _ = - let module Canonical = struct - let basic = - test "@canonical Foo"; - [%expect - {| - ((output (((f.ml (1 0) (1 14)) (@canonical ((f.ml (1 11) (1 14)) Foo))))) - (warnings ())) |}] - - let empty = - test "@canonical"; - [%expect - {| - ((output (((f.ml (1 0) (1 10)) (@canonical ((f.ml (1 11) (1 10)) ""))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-10:\ - \n'@canonical' should not be empty."))) |}] - - let whitespace_only = - test "@canonical"; - [%expect - {| - ((output (((f.ml (1 0) (1 10)) (@canonical ((f.ml (1 11) (1 10)) ""))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-10:\ - \n'@canonical' should not be empty."))) |}] - - let extra_whitespace = - test "@canonical Foo"; - [%expect - {| - ((output (((f.ml (1 0) (1 15)) (@canonical ((f.ml (1 11) (1 15)) Foo))))) - (warnings ())) |}] - - let prefix = - test "@canonicalfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 13)) - (paragraph (((f.ml (1 0) (1 13)) (word @canonicalfoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-13:\ - \nUnknown tag '@canonicalfoo'."))) |}] - - (* TODO This should probably be an error of some kind, as Foo Bar is not a - valid module path. *) - let with_whitespace = - test "@canonical Foo Bar"; - [%expect - {| - ((output - (((f.ml (1 0) (1 18)) (@canonical ((f.ml (1 11) (1 18)) "Foo Bar"))))) - (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Inline = struct - let basic = - test "@inline"; - [%expect {| ((output (((f.ml (1 0) (1 7)) @inline))) (warnings ())) |}] - - let prefix = - test "@inlinefoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph (((f.ml (1 0) (1 10)) (word @inlinefoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-10:\ - \nUnknown tag '@inlinefoo'."))) |}] - - let extra_whitespace = - test "@inline"; - [%expect {| ((output (((f.ml (1 0) (1 7)) @inline))) (warnings ())) |}] - - let followed_by_junk = - test "@inline foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) @inline) - ((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-11:\ - \nParagraph is not allowed in the tags section.\ - \nSuggestion: move 'foo' before any tags." - "File \"f.ml\", line 1, characters 8-11:\ - \nParagraph should begin on its own line."))) |}] - - let followed_by_paragraph = - test "@inline\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) @inline) - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 2, characters 0-3:\ - \nParagraph is not allowed in the tags section.\ - \nSuggestion: move 'foo' before any tags."))) |}] - - let followed_by_tag = - test "@inline\n@deprecated"; - [%expect - {| - ((output (((f.ml (1 0) (1 7)) @inline) ((f.ml (2 0) (2 11)) (@deprecated)))) - (warnings ())) |}] - - let with_list = - test "@inline - foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) @inline) - ((f.ml (1 8) (1 13)) - (unordered light - ((((f.ml (1 10) (1 13)) (paragraph (((f.ml (1 10) (1 13)) (word foo))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-9:\ - \n'-' (bulleted list item) should begin on its own line." - "File \"f.ml\", line 1, characters 8-9:\ - \n'-' (bulleted list item) is not allowed in the tags section.\ - \nSuggestion: move '-' (bulleted list item) before any tags."))) |}] - end in - () - -let%expect_test _ = - let module Open = struct - let basic = - test "@open"; - [%expect {| ((output (((f.ml (1 0) (1 5)) @open))) (warnings ())) |}] - - let prefix = - test "@openfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 8)) (paragraph (((f.ml (1 0) (1 8)) (word @openfoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-8:\ - \nUnknown tag '@openfoo'."))) |}] - - let extra_whitespace = - test "@open"; - [%expect {| ((output (((f.ml (1 0) (1 5)) @open))) (warnings ())) |}] - - let followed_by_junk = - test "@open foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) @open) - ((f.ml (1 6) (1 9)) (paragraph (((f.ml (1 6) (1 9)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 6-9:\ - \nParagraph is not allowed in the tags section.\ - \nSuggestion: move 'foo' before any tags." - "File \"f.ml\", line 1, characters 6-9:\ - \nParagraph should begin on its own line."))) |}] - - let followed_by_paragraph = - test "@open\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) @open) - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 2, characters 0-3:\ - \nParagraph is not allowed in the tags section.\ - \nSuggestion: move 'foo' before any tags."))) |}] - - let followed_by_tag = - test "@open\n@deprecated"; - [%expect - {| - ((output (((f.ml (1 0) (1 5)) @open) ((f.ml (2 0) (2 11)) (@deprecated)))) - (warnings ())) |}] - - let with_list = - test "@open - foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) @open) - ((f.ml (1 6) (1 11)) - (unordered light - ((((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 6-7:\ - \n'-' (bulleted list item) should begin on its own line." - "File \"f.ml\", line 1, characters 6-7:\ - \n'-' (bulleted list item) is not allowed in the tags section.\ - \nSuggestion: move '-' (bulleted list item) before any tags."))) |}] - end in - () - -let%expect_test _ = - let module Closed = struct - let basic = - test "@closed"; - [%expect {| ((output (((f.ml (1 0) (1 7)) @closed))) (warnings ())) |}] - - let prefix = - test "@closedfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph (((f.ml (1 0) (1 10)) (word @closedfoo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-10:\ - \nUnknown tag '@closedfoo'."))) |}] - - let extra_whitespace = - test "@closed"; - [%expect {| ((output (((f.ml (1 0) (1 7)) @closed))) (warnings ())) |}] - - let followed_by_junk = - test "@closed foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) @closed) - ((f.ml (1 8) (1 11)) (paragraph (((f.ml (1 8) (1 11)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-11:\ - \nParagraph is not allowed in the tags section.\ - \nSuggestion: move 'foo' before any tags." - "File \"f.ml\", line 1, characters 8-11:\ - \nParagraph should begin on its own line."))) |}] - - let followed_by_paragraph = - test "@closed\nfoo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) @closed) - ((f.ml (2 0) (2 3)) (paragraph (((f.ml (2 0) (2 3)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 2, characters 0-3:\ - \nParagraph is not allowed in the tags section.\ - \nSuggestion: move 'foo' before any tags."))) |}] - - let followed_by_tag = - test "@closed\n@deprecated"; - [%expect - {| - ((output (((f.ml (1 0) (1 7)) @closed) ((f.ml (2 0) (2 11)) (@deprecated)))) - (warnings ())) |}] - - let with_list = - test "@closed - foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) @closed) - ((f.ml (1 8) (1 13)) - (unordered light - ((((f.ml (1 10) (1 13)) (paragraph (((f.ml (1 10) (1 13)) (word foo))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-9:\ - \n'-' (bulleted list item) should begin on its own line." - "File \"f.ml\", line 1, characters 8-9:\ - \n'-' (bulleted list item) is not allowed in the tags section.\ - \nSuggestion: move '-' (bulleted list item) before any tags."))) |}] - end in - () - -let%expect_test _ = - let module Bad_markup = struct - let left_brace = - test "{"; - [%expect - {| - ((output (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word {))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \n'{': bad markup.\ - \nSuggestion: escape the brace with '\\{'."))) |}] - - let left_brace_with_letter = - test "{g"; - [%expect - {| - ((output - (((f.ml (1 0) (1 2)) - (paragraph (((f.ml (1 0) (1 1)) (word {)) ((f.ml (1 1) (1 2)) (word g))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \n'{': bad markup.\ - \nSuggestion: escape the brace with '\\{'."))) |}] - - let left_brace_with_letters = - test "{gg"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) - (paragraph - (((f.ml (1 0) (1 1)) (word {)) ((f.ml (1 1) (1 3)) (word gg))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \n'{': bad markup.\ - \nSuggestion: escape the brace with '\\{'."))) |}] - - let empty_braces = - test "{}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word {))))) - ((f.ml (1 1) (1 2)) (paragraph (((f.ml (1 1) (1 2)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \n'{': bad markup.\ - \nSuggestion: escape the brace with '\\{'." - "File \"f.ml\", line 1, characters 1-2:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let left_space = - test "{ foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) (paragraph (((f.ml (1 0) (1 6)) (code_span " foo"))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-6:\ - \n'{ foo}': bad markup.\ - \nSuggestion: did you mean '{! foo}' or '[ foo]'?"))) |}] - - let left_spaces = - test "{ foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph (((f.ml (1 0) (1 7)) (code_span " foo"))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \n'{ foo}': bad markup.\ - \nSuggestion: did you mean '{! foo}' or '[ foo]'?"))) |}] - - let left_space_eof = - test "{"; - [%expect - {| - ((output (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word {))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \n'{': bad markup.\ - \nSuggestion: escape the brace with '\\{'."))) |}] - - let braces_instead_of_brackets = - test "{foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) (paragraph (((f.ml (1 0) (1 5)) (code_span foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-5:\ - \n'{foo}': bad markup.\ - \nSuggestion: did you mean '{!foo}' or '[foo]'?"))) |}] - - let right_brace = - test "}"; - [%expect - {| - ((output (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let right_brace_in_paragraph = - test "foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (1 3) (1 4)) (paragraph (((f.ml (1 3) (1 4)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 3-4:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let multiple_right_brace = - test "foo } bar } baz"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) (paragraph (((f.ml (1 0) (1 3)) (word foo))))) - ((f.ml (1 4) (1 5)) (paragraph (((f.ml (1 4) (1 5)) (word }))))) - ((f.ml (1 6) (1 9)) (paragraph (((f.ml (1 6) (1 9)) (word bar))))) - ((f.ml (1 10) (1 11)) (paragraph (((f.ml (1 10) (1 11)) (word }))))) - ((f.ml (1 12) (1 15)) (paragraph (((f.ml (1 12) (1 15)) (word baz))))))) - (warnings - ( "File \"f.ml\", line 1, characters 4-5:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'." - "File \"f.ml\", line 1, characters 10-11:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let right_brace_in_list_item = - test "- foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (unordered light - ((((f.ml (1 2) (1 5)) (paragraph (((f.ml (1 2) (1 5)) (word foo))))))))) - ((f.ml (1 5) (1 6)) (paragraph (((f.ml (1 5) (1 6)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 5-6:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let right_brace_in_code_span = - test "[foo}]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) (paragraph (((f.ml (1 0) (1 6)) (code_span foo}))))))) - (warnings ())) |}] - - let right_brace_in_code_block = - test "{[foo}]}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (code_block foo})))) (warnings ())) |}] - - let right_brace_in_verbatim_text = - test "{v foo} v}"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (verbatim foo})))) (warnings ())) |}] - - let right_brace_in_author = - test "@author Foo}"; - [%expect - {| ((output (((f.ml (1 0) (1 12)) (@author Foo})))) (warnings ())) |}] - - let right_brace_in_deprecated = - test "@deprecated }"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) (@deprecated)) - ((f.ml (1 12) (1 13)) (paragraph (((f.ml (1 12) (1 13)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 12-13:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - - let right_bracket = - test "]"; - [%expect - {| - ((output (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word ]))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-1:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'."))) |}] - - let right_bracket_in_paragraph = - test "foo]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (paragraph - (((f.ml (1 0) (1 3)) (word foo)) ((f.ml (1 3) (1 4)) (word ]))))))) - (warnings - ( "File \"f.ml\", line 1, characters 3-4:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'."))) |}] - - let right_bracket_in_shorthand_list = - test "- foo]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (unordered light - ((((f.ml (1 2) (1 6)) - (paragraph - (((f.ml (1 2) (1 5)) (word foo)) ((f.ml (1 5) (1 6)) (word ]))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 5-6:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'."))) |}] - - let right_bracket_in_code_span = - test "[]]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 3)) - (paragraph - (((f.ml (1 0) (1 2)) (code_span "")) ((f.ml (1 2) (1 3)) (word ]))))))) - (warnings - ( "File \"f.ml\", line 1, characters 2-3:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'."))) |}] - - let right_bracket_in_style = - test "{b]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (paragraph (((f.ml (1 0) (1 4)) (bold (((f.ml (1 2) (1 3)) (word ])))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 2-3:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'." - "File \"f.ml\", line 1, characters 0-2:\ - \n'{b' should be followed by space, a tab, or a new line."))) |}] - - let right_bracket_in_verbatim = - test "{v ] v}"; - [%expect - {| ((output (((f.ml (1 0) (1 7)) (verbatim ])))) (warnings ())) |}] - - let right_bracket_in_list = - test "{ul ]}"; - [%expect - {| - ((output (((f.ml (1 0) (1 6)) (unordered heavy ())))) - (warnings - ( "File \"f.ml\", line 1, characters 4-5:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'." - "File \"f.ml\", line 1, characters 4-5:\ - \n']' is not allowed in '{ul ...}' (bulleted list).\ - \nSuggestion: move ']' into a list item, '{li ...}' or '{- ...}'." - "File \"f.ml\", line 1, characters 0-3:\ - \n'{ul ...}' (bulleted list) should not be empty."))) |}] - - let right_bracket_in_list_item = - test "{ul {li ]}}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 11)) - (unordered heavy - ((((f.ml (1 8) (1 9)) (paragraph (((f.ml (1 8) (1 9)) (word ]))))))))))) - (warnings - ( "File \"f.ml\", line 1, characters 8-9:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'."))) |}] - - let right_bracket_in_heading = - test "{2 ]}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) (2 (label ()) (((f.ml (1 3) (1 4)) (word ]))))))) - (warnings - ( "File \"f.ml\", line 1, characters 3-4:\ - \nUnpaired ']' (end of code).\ - \nSuggestion: try '\\]'."))) |}] - - let right_bracket_in_author = - test "@author Foo]"; - [%expect - {| ((output (((f.ml (1 0) (1 12)) (@author Foo])))) (warnings ())) |}] - - let at = - test "@"; - [%expect - {| - ((output (((f.ml (1 0) (1 1)) (paragraph (((f.ml (1 0) (1 1)) (word @))))))) - (warnings ( "File \"f.ml\", line 1, characters 0-1:\ - \nStray '@'."))) |}] - - let cr = - test ""; - [%expect {| ((output ()) (warnings ())) |}] - end in - () - -let%expect_test _ = - let module Utf_8 = struct - let lambda = - test "\xce\xbb"; - [%expect - {| - ((output - (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word "\206\187"))))))) - (warnings ())) |}] - - let words = - test "\xce\xbb \xce\xbb"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph - (((f.ml (1 0) (1 2)) (word "\206\187")) ((f.ml (1 2) (1 3)) space) - ((f.ml (1 3) (1 5)) (word "\206\187"))))))) - (warnings ())) |}] - - let no_validation = - test "Î"; - [%expect - {| - ((output - (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word "\195\142"))))))) - (warnings ())) |}] - - let escapes = - test "\xce\xbb\\}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (word "\206\187}"))))))) - (warnings ())) |}] - - let newline = - test "\xce\xbb \n \xce\xbb"; - [%expect - {| - ((output - (((f.ml (1 0) (2 3)) - (paragraph - (((f.ml (1 0) (1 2)) (word "\206\187")) ((f.ml (1 2) (2 1)) space) - ((f.ml (2 1) (2 3)) (word "\206\187"))))))) - (warnings ())) |}] - - let paragraphs = - test "\xce\xbb \n\n \xce\xbb"; - [%expect - {| - ((output - (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word "\206\187"))))) - ((f.ml (3 1) (3 3)) (paragraph (((f.ml (3 1) (3 3)) (word "\206\187"))))))) - (warnings ())) |}] - - let code_span = - test "[\xce\xbb]"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (paragraph (((f.ml (1 0) (1 4)) (code_span "\206\187"))))))) - (warnings ())) |}] - - let minus = - test "\xce\xbb-\xce\xbb"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph (((f.ml (1 0) (1 5)) (word "\206\187-\206\187"))))))) - (warnings ())) |}] - - let shorthand_list = - test "- \xce\xbb"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) - (unordered light - ((((f.ml (1 2) (1 4)) - (paragraph (((f.ml (1 2) (1 4)) (word "\206\187"))))))))))) - (warnings ())) |}] - - let styled = - test "{b \xce\xbb}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 6)) - (paragraph - (((f.ml (1 0) (1 6)) (bold (((f.ml (1 3) (1 5)) (word "\206\187")))))))))) - (warnings ())) |}] - - let reference_target = - test "{!\xce\xbb}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 5)) - (paragraph - (((f.ml (1 0) (1 5)) (simple ((f.ml (1 2) (1 5)) "\206\187") ()))))))) - (warnings ())) |}] - - let code_block = - test "{[\xce\xbb]}"; - [%expect - {| ((output (((f.ml (1 0) (1 6)) (code_block "\206\187")))) (warnings ())) |}] - - let verbatim = - test "{v \xce\xbb v}"; - [%expect - {| ((output (((f.ml (1 0) (1 8)) (verbatim "\206\187")))) (warnings ())) |}] - - let label = - test "{2:\xce\xbb Bar}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (2 (label ("\206\187")) (((f.ml (1 6) (1 9)) (word Bar))))))) - (warnings ())) |}] - - let author = - test "@author \xce\xbb"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@author "\206\187")))) (warnings ())) |}] - - let param = - test "@param \xce\xbb"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (@param "\206\187")))) (warnings ())) |}] - - let raise = - test "@raise \xce\xbb"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (@raise "\206\187")))) (warnings ())) |}] - - let see = - test "@see <\xce\xbb>"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (@see url "\206\187")))) (warnings ())) |}] - - let since = - test "@since \xce\xbb"; - [%expect - {| ((output (((f.ml (1 0) (1 9)) (@since "\206\187")))) (warnings ())) |}] - - let before = - test "@before \xce\xbb"; - [%expect - {| ((output (((f.ml (1 0) (1 10)) (@before "\206\187")))) (warnings ())) |}] - - let version = - test "@version \xce\xbb"; - [%expect - {| ((output (((f.ml (1 0) (1 11)) (@version "\206\187")))) (warnings ())) |}] - - let right_brace = - test "\xce\xbb}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 2)) (paragraph (((f.ml (1 0) (1 2)) (word "\206\187"))))) - ((f.ml (1 2) (1 3)) (paragraph (((f.ml (1 2) (1 3)) (word }))))))) - (warnings - ( "File \"f.ml\", line 1, characters 2-3:\ - \nUnpaired '}' (end of markup).\ - \nSuggestion: try '\\}'."))) |}] - end in - () - -let%expect_test _ = - let module Comment_location = struct - let error_on_first_line = - test "@foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 4)) (paragraph (((f.ml (1 0) (1 4)) (word @foo))))))) - (warnings ( "File \"f.ml\", line 1, characters 0-4:\ - \nUnknown tag '@foo'."))) |}] - - let error_on_second_line = - test " \n @foo"; - [%expect - {| - ((output - (((f.ml (2 2) (2 6)) (paragraph (((f.ml (2 2) (2 6)) (word @foo))))))) - (warnings ( "File \"f.ml\", line 2, characters 2-6:\ - \nUnknown tag '@foo'."))) |}] - end in - () - -let%expect_test _ = - let module Unsupported = struct - (* test "index list" - "{!indexlist}" - (Ok []); *) - - let left_alignment = - test "{L foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 3) (1 6)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \n'{L ...}' (left alignment) should not be used because it has no effect."))) |}] - - let center_alignment = - test "{C foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 3) (1 6)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \n'{C ...}' (center alignment) should not be used because it has no effect."))) |}] - - let right_alignment = - test "{R foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 3) (1 6)) (word foo))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \n'{R ...}' (right alignment) should not be used because it has no effect."))) |}] - - let custom_style = - test "{c foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) - (paragraph (((f.ml (1 0) (1 7)) (code_span "c foo"))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \n'{c foo}': bad markup.\ - \nSuggestion: did you mean '{!c foo}' or '[c foo]'?"))) |}] - - let custom_tag = - test "@custom"; - [%expect - {| - ((output - (((f.ml (1 0) (1 7)) (paragraph (((f.ml (1 0) (1 7)) (word @custom))))))) - (warnings - ( "File \"f.ml\", line 1, characters 0-7:\ - \nUnknown tag '@custom'."))) |}] - - let custom_reference_kind = - test "{!custom:foo}"; - [%expect - {| - ((output - (((f.ml (1 0) (1 13)) - (paragraph - (((f.ml (1 0) (1 13)) (simple ((f.ml (1 2) (1 13)) custom:foo) ()))))))) - (warnings ())) |}] - - let html_tag = - test "foo"; - [%expect - {| - ((output - (((f.ml (1 0) (1 10)) - (paragraph (((f.ml (1 0) (1 10)) (word foo))))))) - (warnings ())) |}] - end in - () diff --git a/src/parser/token.ml b/src/parser/token.ml deleted file mode 100644 index ae5687ad1b..0000000000 --- a/src/parser/token.ml +++ /dev/null @@ -1,165 +0,0 @@ -(* This module contains the token type, emitted by the lexer, and consumed by - the comment syntax parser. It also contains two functions that format tokens - for error messages. *) - -type section_heading = [ `Begin_section_heading of int * string option ] - -type style = [ `Bold | `Italic | `Emphasis | `Superscript | `Subscript ] - -type paragraph_style = [ `Left | `Center | `Right ] - -type tag = - [ `Tag of - [ `Author of string - | `Deprecated - | `Param of string - | `Raise of string - | `Return - | `See of [ `Url | `File | `Document ] * string - | `Since of string - | `Before of string - | `Version of string - | `Canonical of string - | `Inline - | `Open - | `Closed ] ] - -type t = - [ (* End of input. *) - `End - | (* Runs of whitespace. [Blank_line] is any run of whitespace that contains two - or more newline characters. [Single_newline] is any run of whitespace that - contains exactly one newline character. [Space] is any run of whitespace - that contains no newline characters. - - It is an important invariant in the parser that no adjacent whitespace - tokens are emitted by the lexer. Otherwise, there would be the need for - unbounded lookahead, a (co-?)ambiguity between - [Single_newline Single_newline] and [Blank_line], and other problems. *) - `Space of - string - | `Single_newline of string - | `Blank_line of string - | (* A right curly brace ([}]), i.e. end of markup. *) - `Right_brace - | (* Words are anything that is not whitespace or markup. Markup symbols can be - be part of words if escaped. - - Words can contain plus and minus symbols, but those are emitted as [Plus] - and [Minus] tokens. The parser combines plus and minus into words, except - when they appear first on a line, in which case the tokens are list item - bullets. *) - `Word of - string - | `Code_span of string - | `Raw_markup of string option * string - | `Begin_style of style - | `Begin_paragraph_style of paragraph_style - | (* Other inline element markup. *) - `Simple_reference of string - | `Begin_reference_with_replacement_text of string - | `Simple_link of string - | `Begin_link_with_replacement_text of string - | (* Leaf block element markup. *) - `Code_block of string - | `Verbatim of string - | `Modules of string - | (* List markup. *) - `Begin_list of [ `Unordered | `Ordered ] - | `Begin_list_item of [ `Li | `Dash ] - | `Minus - | `Plus - | section_heading - | tag ] - -let print : [< t ] -> string = function - | `Begin_paragraph_style `Left -> "'{L'" - | `Begin_paragraph_style `Center -> "'{C'" - | `Begin_paragraph_style `Right -> "'{R'" - | `Begin_style `Bold -> "'{b'" - | `Begin_style `Italic -> "'{i'" - | `Begin_style `Emphasis -> "'{e'" - | `Begin_style `Superscript -> "'{^'" - | `Begin_style `Subscript -> "'{_'" - | `Begin_reference_with_replacement_text _ -> "'{{!'" - | `Begin_link_with_replacement_text _ -> "'{{:'" - | `Begin_list_item `Li -> "'{li ...}'" - | `Begin_list_item `Dash -> "'{- ...}'" - | `Minus -> "'-'" - | `Plus -> "'+'" - | `Begin_section_heading (level, label) -> - let label = match label with None -> "" | Some label -> ":" ^ label in - Printf.sprintf "'{%i%s'" level label - | `Tag (`Author _) -> "'@author'" - | `Tag `Deprecated -> "'@deprecated'" - | `Tag (`Param _) -> "'@param'" - | `Tag (`Raise _) -> "'@raise'" - | `Tag `Return -> "'@return'" - | `Tag (`See _) -> "'@see'" - | `Tag (`Since _) -> "'@since'" - | `Tag (`Before _) -> "'@before'" - | `Tag (`Version _) -> "'@version'" - | `Tag (`Canonical _) -> "'@canonical'" - | `Tag `Inline -> "'@inline'" - | `Tag `Open -> "'@open'" - | `Tag `Closed -> "'@closed'" - | `Raw_markup (None, _) -> "'{%...%}'" - | `Raw_markup (Some target, _) -> "'{%" ^ target ^ ":...%}'" - -(* [`Minus] and [`Plus] are interpreted as if they start list items. Therefore, - for error messages based on [Token.describe] to be accurate, formatted - [`Minus] and [`Plus] should always be plausibly list item bullets. *) -let describe : [< t | `Comment ] -> string = function - | `Word w -> Printf.sprintf "'%s'" w - | `Code_span _ -> "'[...]' (code)" - | `Raw_markup _ -> "'{%...%}' (raw markup)" - | `Begin_paragraph_style `Left -> "'{L ...}' (left alignment)" - | `Begin_paragraph_style `Center -> "'{C ...}' (center alignment)" - | `Begin_paragraph_style `Right -> "'{R ...}' (right alignment)" - | `Begin_style `Bold -> "'{b ...}' (boldface text)" - | `Begin_style `Italic -> "'{i ...}' (italic text)" - | `Begin_style `Emphasis -> "'{e ...}' (emphasized text)" - | `Begin_style `Superscript -> "'{^...}' (superscript)" - | `Begin_style `Subscript -> "'{_...}' (subscript)" - | `Simple_reference _ -> "'{!...}' (cross-reference)" - | `Begin_reference_with_replacement_text _ -> - "'{{!...} ...}' (cross-reference)" - | `Simple_link _ -> "'{:...} (external link)'" - | `Begin_link_with_replacement_text _ -> "'{{:...} ...}' (external link)" - | `End -> "end of text" - | `Space _ -> "whitespace" - | `Single_newline _ -> "line break" - | `Blank_line _ -> "blank line" - | `Right_brace -> "'}'" - | `Code_block _ -> "'{[...]}' (code block)" - | `Verbatim _ -> "'{v ... v}' (verbatim text)" - | `Modules _ -> "'{!modules ...}'" - | `Begin_list `Unordered -> "'{ul ...}' (bulleted list)" - | `Begin_list `Ordered -> "'{ol ...}' (numbered list)" - | `Begin_list_item `Li -> "'{li ...}' (list item)" - | `Begin_list_item `Dash -> "'{- ...}' (list item)" - | `Minus -> "'-' (bulleted list item)" - | `Plus -> "'+' (numbered list item)" - | `Begin_section_heading (level, _) -> - Printf.sprintf "'{%i ...}' (section heading)" level - | `Tag (`Author _) -> "'@author'" - | `Tag `Deprecated -> "'@deprecated'" - | `Tag (`Param _) -> "'@param'" - | `Tag (`Raise _) -> "'@raise'" - | `Tag `Return -> "'@return'" - | `Tag (`See _) -> "'@see'" - | `Tag (`Since _) -> "'@since'" - | `Tag (`Before _) -> "'@before'" - | `Tag (`Version _) -> "'@version'" - | `Tag (`Canonical _) -> "'@canonical'" - | `Tag `Inline -> "'@inline'" - | `Tag `Open -> "'@open'" - | `Tag `Closed -> "'@closed'" - | `Comment -> "top-level text" - -let describe_element = function - | `Reference (`Simple, _, _) -> describe (`Simple_reference "") - | `Reference (`With_text, _, _) -> - describe (`Begin_reference_with_replacement_text "") - | `Link _ -> describe (`Begin_link_with_replacement_text "") - | `Heading (level, _, _) -> describe (`Begin_section_heading (level, None)) diff --git a/src/xref2/lookup_failures.ml b/src/xref2/lookup_failures.ml index 188658fcb0..98420e83e2 100644 --- a/src/xref2/lookup_failures.ml +++ b/src/xref2/lookup_failures.ml @@ -18,10 +18,8 @@ let add ~kind msg = | Some (`Full_loc loc) -> Error.make "%s" msg loc | None -> failwith "Lookup_failures: Uncaught failure." in - let non_fatal = - match kind with `Internal | `Warning -> false | `Root -> true - in - Error.raise_warning ~non_fatal w + ignore kind; + Error.raise_warning ~non_fatal:true w let catch_failures ~filename f = with_location' (`Filename_only filename) (fun () -> Error.catch_warnings f) diff --git a/test/model/semantics/test.ml b/test/model/semantics/test.ml index 464f6fdc07..edb19c9c9b 100644 --- a/test/model/semantics/test.ml +++ b/test/model/semantics/test.ml @@ -1917,7 +1917,10 @@ let%expect_test _ = [%expect {| { - "value": [ { "`Tag": { "`Author": "Foo" } }, { "`Code_block": "bar" } ], + "value": [ + { "`Tag": { "`Author": "Foo" } }, + { "`Code_block": [ "None", "bar" ] } + ], "warnings": [ "File \"f.ml\", line 2, characters 0-7:\n'{[...]}' (code block) is not allowed in the tags section.\nSuggestion: move '{[...]}' (code block) before any tags." ] @@ -2304,7 +2307,7 @@ let%expect_test _ = test "{[@author Foo]}"; [%expect {| - { "value": [ { "`Code_block": "@author Foo" } ], "warnings": [] } |}] + { "value": [ { "`Code_block": [ "None", "@author Foo" ] } ], "warnings": [] } |}] let in_verbatim = test "{v @author Foo v}"; @@ -2317,7 +2320,10 @@ let%expect_test _ = [%expect {| { - "value": [ { "`Code_block": "foo" }, { "`Tag": { "`Author": "Bar" } } ], + "value": [ + { "`Code_block": [ "None", "foo" ] }, + { "`Tag": { "`Author": "Bar" } } + ], "warnings": [ "File \"f.ml\", line 1, characters 8-19:\n'@author' should begin on its own line." ]