From: Theophile Ranquet Date: Wed, 26 Dec 2012 15:26:17 +0000 (+0100) Subject: bench: add %b directive to use a specific Bison X-Git-Tag: v2.7.90~192 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/ca42755f13e176c481a537ce2bb1ec735e09915f?ds=sidebyside bench: add %b directive to use a specific Bison For example, $ bench.pl -v '%s lalr1.cc & %d variant & ( %b ~/old-bison/bin/bison | %b ~/new-bison/bin/bison )' -g list -i 10000 * etc/bench.pl.in: Here. --- diff --git a/etc/bench.pl.in b/etc/bench.pl.in index 6b1e87dd..59cadee4 100755 --- a/etc/bench.pl.in +++ b/etc/bench.pl.in @@ -35,6 +35,7 @@ I: | directives & directives -- Concatenation | [ directives> ] -- Optional | ( directives> ) -- Parentheses + | %b PATH -- Use bison at PATH for this bench | #d NAME[=VALUE] -- %code { #define NAME [VALUE] } | %d NAME[=VALUE] -- %define NAME ["VALUE"] | %s skeleton -- %skeleton "skeleton" @@ -806,7 +807,8 @@ sub compile ($) my $compiler = $language eq 'C++' ? $cxx : $cc; - run "$bison $base.y -o $base.c"; + my $my_bison = `sed -ne '/%bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`; + run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c"); run "$compiler -o $base $cflags $base.c"; } @@ -1048,6 +1050,12 @@ sub parse_dirs () @res = ("%skeleton \"$token[0]\""); shift @token; } + elsif ($token[0] eq '%b') + { + shift @token; + @res = ("/*\n%bison \"$token[0]\"\\\n*/"); + shift @token; + } else { @res = $token[0];