How can I add the -ml flag (or any flag, really) to ocamllex in a dune file?

40 views Asked by At

Here is my current dune file:

(library
(name parsing)
(libraries toto fmt menhirLib)
(modules parser lexer lex_and_parse)
)

(ocamllex lexer)

(menhir
 (modules parser)
 (flags --explain -v))

I know it's probably not a great idea to have too big an automaton, but it would be handy for me to be able to debug my lexer in its current state, which implies allowing for greater automata with the -ml flag. I haven't been able to provide flags to ocamllex. Any ideas?

1

There are 1 answers

0
ivg On

Substitute (ocamllex lexer) with

(rule
 (target lexer.ml)
 (deps   lexer.mll)
 (action (chdir %{workspace_root}
          (run %{bin:ocamllex} -q -o %{target} %{deps}))))
;                             ^^^^^^^^
;                       add your flags here