mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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.
This commit is contained in:
@@ -35,6 +35,7 @@ I<directives>:
|
|||||||
| directives & directives -- Concatenation
|
| directives & directives -- Concatenation
|
||||||
| [ directives> ] -- Optional
|
| [ directives> ] -- Optional
|
||||||
| ( directives> ) -- Parentheses
|
| ( directives> ) -- Parentheses
|
||||||
|
| %b PATH -- Use bison at PATH for this bench
|
||||||
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
||||||
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
||||||
| %s skeleton -- %skeleton "skeleton"
|
| %s skeleton -- %skeleton "skeleton"
|
||||||
@@ -806,7 +807,8 @@ sub compile ($)
|
|||||||
|
|
||||||
my $compiler = $language eq 'C++' ? $cxx : $cc;
|
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";
|
run "$compiler -o $base $cflags $base.c";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1048,6 +1050,12 @@ sub parse_dirs ()
|
|||||||
@res = ("%skeleton \"$token[0]\"");
|
@res = ("%skeleton \"$token[0]\"");
|
||||||
shift @token;
|
shift @token;
|
||||||
}
|
}
|
||||||
|
elsif ($token[0] eq '%b')
|
||||||
|
{
|
||||||
|
shift @token;
|
||||||
|
@res = ("/*\n%bison \"$token[0]\"\\\n*/");
|
||||||
|
shift @token;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@res = $token[0];
|
@res = $token[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user