From f6038cb8c35c6b1a827fd3f6356d8cc9a002abe0 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 22 Oct 2008 05:57:46 -0500 Subject: [PATCH] Use "%define variant" in bench.pl. * etc/bench.pl.in: No longer use the pseudo directive %variants, just use %define variants. --- ChangeLog | 6 ++++++ etc/bench.pl.in | 21 ++++++--------------- examples/variant.yy | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index f575d055..8054b254 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-11-07 Akim Demaille + + Use "%define variant" in bench.pl. + * etc/bench.pl.in: No longer use the pseudo directive %variants, + just use %define variants. + 2008-11-07 Akim Demaille Regen. diff --git a/etc/bench.pl.in b/etc/bench.pl.in index 22328cfa..f4f5a7e5 100755 --- a/etc/bench.pl.in +++ b/etc/bench.pl.in @@ -147,21 +147,13 @@ sub verbose($$) Format the list of directives for Bison for bench named C<$bench>. -The special fake C<%variant> directive requests the use of -Boost.Variants instead of a regular union. So don't pass it, it is -not a valid directive. - =cut sub directives($@) { my ($bench, @directive) = @_; my $res = "/* Directives for bench `$bench'. */\n"; - for my $d (@directive) - { - $res .= $d . "\n" - unless $d eq '%variant'; - } + $res .= join ("\n", @directive) . "\n"; $res .= "/* End of directives for bench `$bench'. */\n"; return $res; } @@ -527,7 +519,7 @@ sub generate_grammar_variant ($$@) { my ($base, $max, @directive) = @_; my $directives = directives ($base, @directive); - my $variant = grep { $_ eq '%variant' } @directive; + my $variant = grep { $_ eq '%define variant' } @directive; my $out = new IO::File ">$base.y" or die; @@ -563,7 +555,6 @@ EOF if ($variant) { print $out <<'EOF'; -%code variant {int,std::string} %token TEXT %token NUMBER %printer { std::cerr << "Number: " << $$; } @@ -821,10 +812,10 @@ sub bench_variant_parser () ( "f-union" => ['%skeleton "lalr1-fusion.cc"'], "f-uni-deb" => ['%skeleton "lalr1-fusion.cc"', '%debug'], - "f-var" => ['%skeleton "lalr1-fusion.cc"', '%variant'], - "f-var-deb" => ['%skeleton "lalr1-fusion.cc"', '%debug', '%variant'], - "f-var-dtr" => ['%skeleton "lalr1-fusion.cc"', '%variant', "%code {\n#define VARIANT_DESTROY\n}"], - "f-var-deb-dtr" => ['%skeleton "lalr1-fusion.cc"', '%debug', '%variant', "%code {\n#define VARIANT_DESTROY\n}"], + "f-var" => ['%skeleton "lalr1-fusion.cc"', '%define variant'], + "f-var-deb" => ['%skeleton "lalr1-fusion.cc"', '%debug', '%define variant'], + "f-var-dtr" => ['%skeleton "lalr1-fusion.cc"', '%define variant', "%code {\n#define VARIANT_DESTROY\n}"], + "f-var-deb-dtr" => ['%skeleton "lalr1-fusion.cc"', '%debug', '%define variant', "%code {\n#define VARIANT_DESTROY\n}"], ) ); } diff --git a/examples/variant.yy b/examples/variant.yy index be43c60d..cba6d08c 100644 --- a/examples/variant.yy +++ b/examples/variant.yy @@ -58,7 +58,7 @@ typedef std::list strings_type; %% result: - list { std::cout << $1 << std::endl; } + list { std::cout << $1 << std::endl; } ; list: -- 2.47.2