PR#6774: new menhir-specific flags "only_tokens" and "external_tokens(Foo)"

(François Pottier)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15991 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Gabriel Scherer 2015-04-11 17:40:23 +00:00
parent bbf92df92c
commit a0ddc6ff30
2 changed files with 13 additions and 1 deletions

View File

@ -147,6 +147,8 @@ OCamlbuild:
(Peter Zotov)
- PR#6720: pass -g to C compilers when tag 'debug' is set
(Peter Zotov, Gabriel Scherer)
- PR#6774: new menhir-specific flags "only_tokens" and "external_tokens(Foo)"
(François Pottier)
- PR#6794: pass package-specific include flags when building C files
(Jérémie Dimino, request by Peter Zotov)

View File

@ -525,12 +525,22 @@ end;;
flag ["ocaml"; "ocamlyacc"] (atomize !Options.ocaml_yaccflags);;
flag ["ocaml"; "menhir"] (atomize !Options.ocaml_yaccflags);;
flag ["ocaml"; "doc"] (atomize !Options.ocaml_docflags);;
flag ["ocaml"; "ocamllex"] (atomize !Options.ocaml_lexflags);;
(* Tell menhir to explain conflicts *)
flag [ "ocaml" ; "menhir" ; "explain" ] (S[A "--explain"]);;
flag [ "ocaml" ; "menhir" ; "infer" ] (S[A "--infer"]);;
flag ["ocaml"; "ocamllex"] (atomize !Options.ocaml_lexflags);;
(* Define two ocamlbuild flags [only_tokens] and [external_tokens(Foo)]
which correspond to menhir's [--only-tokens] and [--external-tokens Foo].
When they are used, these flags should be passed both to [menhir] and to
[menhir --raw-depend]. *)
let () =
List.iter begin fun mode ->
flag [ mode; "only_tokens" ] (S[A "--only-tokens"]);
pflag [ mode ] "external_tokens" (fun name ->
S[A "--external-tokens"; A name]);
end [ "menhir"; "menhir_ocamldep" ];;
(* Tell ocamllex to generate ml code *)
flag [ "ocaml" ; "ocamllex" ; "generate_ml" ] (S[A "-ml"]);;