X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/3a2803df74bf43b384db752e87be94a1f64fa847..8901f32e:/etc/bench.pl.in?ds=sidebyside diff --git a/etc/bench.pl.in b/etc/bench.pl.in index 22328cfa..91c35b99 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: " << $$; } @@ -590,7 +581,7 @@ EOF } else { - # Not using Boost variants. + # Not using Bison variants. print $out <<'EOF'; %union {int ival; std::string* sval;} %token TEXT @@ -819,12 +810,13 @@ sub bench_variant_parser () bench_grammar ('variant', ( - "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-union" => ['%skeleton "lalr1.cc"'], + "f-uni-deb" => ['%skeleton "lalr1.cc"', '%debug'], + "f-var" => ['%skeleton "lalr1.cc"', '%define variant'], + "f-var-deb" => ['%skeleton "lalr1.cc"', '%debug', '%define variant'], + "f-var-dtr" => ['%skeleton "lalr1.cc"', '%define variant', "%code {\n#define VARIANT_DESTROY\n}"], + "f-var-deb-dtr" => ['%skeleton "lalr1.cc"', '%debug', '%define variant', "%code {\n#define VARIANT_DESTROY\n}"], + "f-var-deb-dtr-ass" => ['%skeleton "lalr1.cc"', '%debug', '%define variant', "%code {\n#define VARIANT_DESTROY\n}", "%define assert"], ) ); } @@ -842,8 +834,8 @@ sub bench_fusion_parser () bench_grammar ('variant', ( - "split" => [], - "fused" => ['%skeleton "lalr1-fusion.cc"'], + "split" => ['%skeleton "lalr1-split.cc"'], + "fused" => ['%skeleton "lalr1.cc"'], ) ); }