Merge pull request #1150 from rgrinberg/ocamllex-jbuild
Correctly parse ocamllex in jbuild
This commit is contained in:
commit
5b6496fac1
|
@ -17,6 +17,9 @@ next
|
|||
- Improve error message for `dune utop` without a library name (#1154, fix
|
||||
#1149, @emillon)
|
||||
|
||||
- Fix parsing `ocamllex` stanza in jbuild files (#1150, @rgrinberg)
|
||||
|
||||
|
||||
1.1.1 (08/08/2018)
|
||||
------------------
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -570,6 +570,14 @@
|
|||
test-cases/ocamldep-multi-stanzas
|
||||
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
|
||||
|
||||
(alias
|
||||
(name ocamllex-jbuild)
|
||||
(deps (package dune) (source_tree test-cases/ocamllex-jbuild))
|
||||
(action
|
||||
(chdir
|
||||
test-cases/ocamllex-jbuild
|
||||
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
|
||||
|
||||
(alias
|
||||
(name odoc)
|
||||
(deps (package dune) (source_tree test-cases/odoc))
|
||||
|
@ -875,6 +883,7 @@
|
|||
(alias ocaml-config-macro)
|
||||
(alias ocaml-syntax)
|
||||
(alias ocamldep-multi-stanzas)
|
||||
(alias ocamllex-jbuild)
|
||||
(alias odoc)
|
||||
(alias odoc-unique-mlds)
|
||||
(alias output-obj)
|
||||
|
@ -970,6 +979,7 @@
|
|||
(alias ocaml-config-macro)
|
||||
(alias ocaml-syntax)
|
||||
(alias ocamldep-multi-stanzas)
|
||||
(alias ocamllex-jbuild)
|
||||
(alias output-obj)
|
||||
(alias package-dep)
|
||||
(alias path-variables)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{}
|
||||
|
||||
rule f = parse
|
||||
| _ { () }
|
||||
|
||||
{
|
||||
print_endline "bar"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{}
|
||||
|
||||
rule f = parse
|
||||
| _ { () }
|
||||
|
||||
{
|
||||
print_endline "foo"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
(ocamllex
|
||||
((modules (foo))))
|
||||
|
||||
(ocamllex (bar))
|
||||
|
||||
(executable
|
||||
((name foo)))
|
|
@ -0,0 +1,2 @@
|
|||
$ dune exec ./foo.exe
|
||||
foo
|
Loading…
Reference in New Issue