menhir option `--only-tokens` does not work
Expected Behavior
This stanza should work and generate tokens.ml/.mli
(menhir
(modules tokens)
(flags --only-tokens)
)
Actual Behavior
instead one gets this error:
12 | (menhir
13 | (modules tokens)
14 | (flags --only-tokens)
15 | )
Error: Rule failed to generate the following targets:
- plantuml/tokens.conflicts
This works fine with (using menhir 2.0) but not with (using menhir 3.0), so this is a regression.
The issue is likely that in 3.0 the --explain option is default, but with --only-tokens no .conflict file is created by menhir.
Reproduction
See above
Specifications
- Version of
dune(output ofdune --version): 3.15.3 - Version of
ocaml(output ofocamlc --version): 4.14.2 - Operating system (distribution and version): MacOS
- menhir version: 20230608
The issue is likely that in 3.0 the
--explainoption is default, but with --only-tokens no .conflict file is created by menhir.
Well spotted. In the meantime you can untoggle --explain by passing (explain false) to the Menhir stanza.
Thanks, this works!
It is btw. not entirely trivial to get the correct set of stanzas in the external tokens case. In case the token definitions are not repeated in the parser file, the correct set of stanzas is:
(menhir
(modules tokens)
(explain false)
(flags --only-tokens)
)
(menhir
(modules parser tokens)
(merge_into parser)
(flags --external-tokens Tokens)
)
It might make sense to mention this in the dune manual.