From 0af14e0e8d9d6410cc6f01bf281d46bb2c80ce5a Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Mon, 30 Sep 2024 15:04:16 +0200 Subject: [PATCH] Add and export relop related utils Signed-off-by: Mathieu Barbin --- src/format/opamFormula.ml | 2 ++ src/format/opamFormula.mli | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/format/opamFormula.ml b/src/format/opamFormula.ml index 96e651175e7..1acff0411fc 100644 --- a/src/format/opamFormula.ml +++ b/src/format/opamFormula.ml @@ -11,6 +11,8 @@ type relop = [`Eq|`Neq|`Geq|`Gt|`Leq|`Lt] +let all_relop = [ `Eq ; `Neq ; `Geq ; `Gt ; `Leq ; `Lt ] + let neg_relop = function | `Eq -> `Neq | `Neq -> `Eq diff --git a/src/format/opamFormula.mli b/src/format/opamFormula.mli index 6b5539eb093..65d1dba4879 100644 --- a/src/format/opamFormula.mli +++ b/src/format/opamFormula.mli @@ -17,6 +17,13 @@ type relop = OpamParserTypes.FullPos.relop_kind (* = [ `Eq | `Neq | `Geq | `Gt | val compare_relop : relop -> relop -> int +(** A list containing each available operator once. *) +val all_relop : relop list + +(** Returns a string representing the operator in infix syntax, as + used in opam files (">", "=", etc.) *) +val string_of_relop : relop -> string + (** Version constraints for OPAM *) type version_constraint = relop * OpamPackage.Version.t