Fix parsing of ocamllex in jbuild files

The long form would be rejected

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-08-18 10:00:40 +03:00
parent bb2bf59ff1
commit da3def9dc7
2 changed files with 14 additions and 17 deletions

View File

@ -1485,18 +1485,19 @@ module Rule = struct
} }
let ocamllex_jbuild = let ocamllex_jbuild =
enter peek_exn >>= function
(if_list | List (_, Atom (_, _) :: _) ->
~then_:( enter (
record
(let%map modules = field "modules" (list string)
and mode = Mode.field in
{ modules; mode }))
~else_:(
repeat string >>| fun modules -> repeat string >>| fun modules ->
{ modules { modules
; mode = Standard ; mode = Standard
})) }
)
| _ ->
record
(let%map modules = field "modules" (list string)
and mode = Mode.field in
{ modules; mode })
let ocamllex_dune = let ocamllex_dune =
if_eos if_eos

View File

@ -1,6 +1,2 @@
$ dune exec ./foo.exe $ dune exec ./foo.exe
File "jbuild", line 2, characters 3-10: foo
((modules (foo))))
^^^^^^^
Error: S-expression of the form (<name> <values>...) expected
[1]