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 =
enter
(if_list
~then_:(
record
(let%map modules = field "modules" (list string)
and mode = Mode.field in
{ modules; mode }))
~else_:(
repeat string >>| fun modules ->
{ modules
; mode = Standard
}))
peek_exn >>= function
| List (_, Atom (_, _) :: _) ->
enter (
repeat string >>| fun modules ->
{ modules
; mode = Standard
}
)
| _ ->
record
(let%map modules = field "modules" (list string)
and mode = Mode.field in
{ modules; mode })
let ocamllex_dune =
if_eos

View File

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