From 159fe729c5c9c2816d1578bd30ecb5d7f3a14ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pottier?= Date: Mon, 5 Oct 2015 10:55:45 +0200 Subject: [PATCH] Modified the build rules for [calc-two] so as to avoid unused token warnings. --- demos/calc-two/_tags | 2 ++ demos/calc-two/myocamlbuild.ml | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/demos/calc-two/_tags b/demos/calc-two/_tags index 7c7482ee..e76793bd 100644 --- a/demos/calc-two/_tags +++ b/demos/calc-two/_tags @@ -1,3 +1,5 @@ : only_tokens : external_tokens(Tokens) : external_tokens(Tokens) +: unused_token(LPAREN) +: unused_token(RPAREN) diff --git a/demos/calc-two/myocamlbuild.ml b/demos/calc-two/myocamlbuild.ml index 8bdc26f5..0520a489 100644 --- a/demos/calc-two/myocamlbuild.ml +++ b/demos/calc-two/myocamlbuild.ml @@ -1,25 +1,31 @@ open Ocamlbuild_plugin open Command + +(* Define ocamlbuild flags [only_tokens] and [external_tokens(Foo)] and + [unused_token(Bar)] which correspond to menhir's [--only-tokens] and + [--external-tokens Foo] and [--unused-token Bar]. When they are used, these + flags should be passed both to [menhir] and to [menhir --raw-depend]. *) + let menhir_flags() = - (* 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]. *) List.iter (fun mode -> flag [ mode; "only_tokens" ] (S[A "--only-tokens"]); pflag [ mode ] "external_tokens" (fun name -> S[A "--external-tokens"; A name] + ); + + pflag [ mode ] "unused_token" (fun name -> + S[A "--unused-token"; A name] ) - + ) [ "menhir"; "menhir_ocamldep" ] let () = dispatch (fun event -> match event with | After_rules -> - menhir_flags() + menhir_flags() | _ -> () ) -- GitLab