(ocamllex prelexer REBracketExpressionLexer)

(menhir
 (flags --explain --inspection --table)
 (modules parser REBracketExpressionParser))

(rule
 (targets version.ml)
 (action
  (with-stdout-to version.ml
   (echo "let current=\"%{version:morbig}\"\n"))))

(executable
 (name CST_derivings_generator)
 (modules CST_derivings_generator)
 (libraries str))

(rule
 (targets CSTSerializers.ml) (deps CST.mli)
 (action (with-stdout-to %{targets} (run ./CST_derivings_generator.exe serializers))))

(rule
 (targets CSTVisitors.ml) (deps CST.mli)
 (action (with-stdout-to %{targets} (run ./CST_derivings_generator.exe visitors))))

(library
 (name morbig)
 (public_name morbig)
 (libraries str menhirLib ppx_deriving_yojson.runtime visitors.runtime)
 (preprocess (pps ppx_deriving_yojson visitors.ppx))
 (flags :standard -w -3) ; FIXME: remove this when Yojson and its PPX are fixed.
 (modules :standard \ morbigDriver CST_derivings_generator)
 (modules_without_implementation CST))

(executable
 (name morbigDriver)
 (public_name morbig)
 (ocamlopt_flags :standard)
 (libraries morbig)
 (preprocess (pps ppx_deriving_yojson visitors.ppx)) ;; Avoid warning about incomplete merlin files.
 (modules morbigDriver))
