123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125(********************************************************************************)(* crs - A tool for managing inline review comments embedded in source code *)(* Copyright (C) 2024-2026 Mathieu Barbin <mathieu.barbin@gmail.com> *)(* *)(* This file is part of crs. *)(* *)(* crs 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. *)(* *)(* crs 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=|All|Invalid|CRs|XCRs|Now|Soon|Somedayletvariant_constructor_name=function|All->"All"|Invalid->"Invalid"|CRs->"CRs"|XCRs->"XCRs"|Now->"Now"|Soon->"Soon"|Someday->"Someday";;letvariant_constructor_rank=function|All->0|Invalid->1|CRs->2|XCRs->3|Now->4|Soon->5|Someday->6;;letall=[All;Invalid;CRs;XCRs;Now;Soon;Someday]letcomparet1t2=Int.compare(variant_constructor_rankt1)(variant_constructor_rankt2);;letequalt1t2=Int.equal(variant_constructor_rankt1)(variant_constructor_rankt2)letto_dynt=Dyn.Variant(variant_constructor_namet,[])letto_stringt=String.lowercase_ascii(variant_constructor_namet)letshorthand=function|All->'a'|Invalid->'i'|CRs->'c'|XCRs->'x'|Now->'w'|Soon->'o'|Someday->'d';;letmatchest~cr=matchtwith|All->true|Invalid->(matchCr_comment0.headercrwith|Error_->true|Ok_->false)|CRs->(matchCr_comment0.headercrwith|Error_->false|Okh->(matchCr_comment0.Header.statushwith|XCR->false|CR->(matchCr_comment0.Header.qualifierhwith|None->true|Soon|Someday->false)))|XCRs->(matchCr_comment0.headercrwith|Error_->false|Okh->(matchCr_comment0.Header.statushwith|CR->false|XCR->true))|Now->(matchCr_comment0.headercrwith|Error_->false|Okh->(matchCr_comment0.Header.statushwith|XCR->true|CR->(matchCr_comment0.Header.qualifierhwith|None->true|Soon|Someday->false)))|Soon->(matchCr_comment0.headercrwith|Error_->false|Okh->(matchCr_comment0.Header.statushwith|XCR->false|CR->(matchCr_comment0.Header.qualifierhwith|Soon->true|None|Someday->false)))|Someday->(matchCr_comment0.headercrwith|Error_->false|Okh->(matchCr_comment0.Header.statushwith|XCR->false|CR->(matchCr_comment0.Header.qualifierhwith|Someday->true|None|Soon->false)));;