diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-04-25 08:51:52 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-04-25 11:06:16 +0200 |
commit | 30ce43b2b5384c6cb96a100942d996b40ac95599 (patch) | |
tree | d97afc8698d179fb96ce1a9152199974f57c116b | |
parent | 150dc95395bdd21ced63d6502c9bc04b835b0d54 (diff) | |
download | bison-30ce43b2b5384c6cb96a100942d996b40ac95599.tar.gz |
bench: minor improvements
* etc/bench.pl.in: Don't force parse.error=detailed
Use a simpler way to display the pseudo %bison directive.
(&bench_with_gbenchmark): Give details about the compiler.
-rwxr-xr-x | etc/bench.pl.in | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/etc/bench.pl.in b/etc/bench.pl.in index 6ba0be0c..1498dd6f 100755 --- a/etc/bench.pl.in +++ b/etc/bench.pl.in @@ -252,7 +252,6 @@ sub generate_grammar_triangular ($$@) my $out = new IO::File ">$base.y" or die; print $out <<EOF; -%define parse.error detailed %{ #include <stdio.h> #include <stdlib.h> @@ -388,7 +387,6 @@ sub generate_grammar_calc ($$@) %} %define api.value.type union -%define parse.error detailed $directives %{ @@ -812,7 +810,8 @@ sub compile ($) my ($base) = @_; my $compiler = compiler ($base); - my $my_bison = `sed -ne '/%bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`; + my $my_bison = `sed -ne '/[/][/] %bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`; + chop $my_bison; run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c"); if ($gbench) { @@ -902,8 +901,13 @@ directive list. sub bench_with_gbenchmark ($@) { my ($grammar, @directive) = @_; + my $compiler = compiler ("y0"); my $readme = new IO::File ">README.md"; + print $readme <<EOF; +compiler: $compiler $cflags +EOF + my @obj = (); for my $i (0 .. $#directive) { @@ -923,7 +927,6 @@ sub bench_with_gbenchmark ($@) BENCHMARK_MAIN(); EOF - my $compiler = compiler ("y0"); run "$compiler -o main $cflags main.c @obj -lbenchmark"; run "./main | tee -a README.md"; } @@ -1121,7 +1124,7 @@ sub parse_dir () elsif ($token[0] eq '%b') { shift @token; - @res = ("/*\n%bison \"$token[0]\"\\\n*/"); + @res = ("// %bison \"$token[0]\""); } else { |