1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586(*********************************************************************************)(* Dunolint - A tool to lint and help manage files in dune projects *)(* Copyright (C) 2024-2025 Mathieu Barbin <mathieu.barbin@gmail.com> *)(* *)(* This file is part of Dunolint. *)(* *)(* Dunolint is free software; you can redistribute it and/or modify it *)(* under the terms of the GNU Lesser General Public License as published by *)(* the Free Software Foundation either version 3 of the License, or any later *)(* version, with the LGPL-3.0 Linking Exception. *)(* *)(* Dunolint is distributed in the hope that it will be useful, but WITHOUT *)(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *)(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *)(* and the file `NOTICE.md` at the root of this repository for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* and the LGPL-3.0 Linking Exception along with this library. If not, see *)(* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively. *)(*********************************************************************************)typet={pps:Pps.t}[@@derivingsexp_of]letcreate?pps()={pps=(matchppswith|Somepps->pps|None->Pps.create~args:[])};;letfield_name="lint"letread~sexps_rewriter~field=letargs=Dunolinter.Sexp_handler.get_args~field_name~sexps_rewriter~fieldinmatchargswith|[(List(Atom"pps"::_)asfield)]->letpps=Pps.read~sexps_rewriter~fieldin{pps}|_->letloc=Sexps_rewriter.locsexps_rewriterfieldinErr.raise~locPp.O.[Pp.text"Unexpected "++Pp_tty.kwd(moduleString)"lint"++Pp.text" field value."];;letwrite(t:t)=Sexp.List[Atomfield_name;Pps.writet.pps]letrewritet~sexps_rewriter~field=letargs=Dunolinter.Sexp_handler.get_args~field_name~sexps_rewriter~fieldinmatchargswith|[(List(Atom"pps"::_)asfield)]->Pps.rewritet.pps~sexps_rewriter~field|_->letloc=Sexps_rewriter.locsexps_rewriterfieldinErr.raise~locPp.O.[Pp.text"Unexpected "++Pp_tty.kwd(moduleString)"lint"++Pp.text" field value."];;typepredicate=Dune.Lint.Predicate.tletevalt~predicate=match(predicate:predicate)with|`ppscondition->Dunolint.Trilang.evalcondition~f:(funpredicate->Pps.evalt.pps~predicate);;letenforce=Dunolinter.Linter.enforce(moduleDune.Lint.Predicate)~eval~enforce:(funtpredicate->matchpredicatewith|Not(`pps_)->Eval|T(`ppscondition)->Pps.enforcet.pps~condition;Ok);;