1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253(*
* Copyright (c) 2018 Thomas Gazagnaire <thomas@gazagnaire.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)letwarn?replacements~since=letreplacement =matchreplacementwith|Somer->Format.sprintf"Please use %s instead."r|None->Format.sprintf"There is no replacement for this feature."inFormat.eprintf"Warning: %s is deprecated since %s and will be removed in 2.0.0. %s\n%!"ssincereplacementmoduleMissing_double_semicolon=structletmissing_semicolon=reffalseletcheck_toplevel :Toplevel.t->unit=funtoplevel ->matchList.revtoplevel.commandwith|cmd::_->letends_with_semi=cmd|>Astring.String.trim|>Astring.String.is_suffix~affix:";;"inifnotends_with_semithenmissing_semicolon:=true|[]->()letcheck_blockblock=List.itercheck_toplevelblockletreport~filename=if!missing_semicolonthenFormat.eprintf"Warning: OCaml toplevel block without trailing ;; detected in file \
'%s'.\n\
Non-semicolon terminated phrases are deprecated.\n\
MDX 2.0 will accept them as input but will output them with ;; \
appended.\n\
In MDX 3.0 support for toplevel blocks without ;; will be removed \
completely.\n"filenameend