如何在沙丘文件中将 -ml 标志(或任何标志)添加到 ocamllex?

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

提问人:user3078439 提问时间:9/22/2023 更新时间:9/23/2023 访问量:31

问:

这是我当前的文件:dune

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

(ocamllex lexer)

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

我知道拥有太大的自动机可能不是一个好主意,但对我来说,能够在当前状态下调试词法分析器会很方便,这意味着允许使用标志实现更大的自动机。我无法向 ocamllex 提供标志。有什么想法吗?-ml

OCAML Lexer 沙丘

评论


答:

1赞 ivg 9/23/2023 #1

替换为(ocamllex lexer)

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