package MlFront_Config

  1. Overview
  2. Docs

Source file ParseAst.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(* We use CPPO to make this safe across versions. Definitely don't
   pull in ppxlib for version insulation (this is not a preprocessor).

   To remove even the CPPO dependency, we could also use a Dune
   rule to copy the appropriate version of this module like
   [moonpool], or write our own preprocessor.ml like [codept]. *)

#ifndef OCAML_VERSION
#error "cppo -V OCAML was not used"
#endif

let parse_constant_string (desc : Parsetree.expression_desc) =
  match desc with
#if OCAML_VERSION >= (5, 3, 0)
  | Pexp_constant {pconst_desc = Pconst_string (label, _loc, _delim); _} -> Some label
#else
  | Pexp_constant (Pconst_string (label, _loc, _delim)) -> Some label
#endif
  | _ -> None