use warnings;
use strict;
-BEGIN { require 'regen/regen_lib.pl'; }
+our $Verbose;
+BEGIN { require './regen/regen_lib.pl'; }
my $bison = 'bison';
unless ($version =~ /\b(1\.875[a-z]?|2\.[0134567]|3\.[0])\b/) { die <<EOF; }
You have the wrong version of bison in your path; currently versions
-1.875, 2.0-2.7 or 3.0 are known toi work. Try installing
+1.875, 2.0-2.7 or 3.0 are known to work. Try installing
http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz
or similar. Your bison identifies itself as:
exit 0;
+# extract the tables and actions from the generated .c file
+
sub extract {
my $clines = shift;
my $tablines;
$tablines = $&;
+ # extract all the cases in the big action switch statement
+
$clines =~ m@
- switch \s* \( \s* \w+ \s* \) \s* { \s*
- (
- case \s* \d+ \s* :
- \s*
- (?: \s* /\* .*? \*/ \s* )* # optional C-comments
- \s*
- \#line [^\n]+"\Q$y_file\E"
- .*?
- )
- }
- \s*
- (?: \s* /\* .*? \*/ \s* )* # optional C-comments
- \s*
- (
- YY_SYMBOL_PRINT
- )
+ switch \s* \( \s* yyn \s* \) \s* { \s*
+ ( .*? default: \s* break; \s* )
+ }
@xms
or die "Can't extract actions from $tmpc_file\n";
$actlines = $1;
sub my_system {
+ if ($Verbose) {
+ print "executing: @_\n";
+ }
system(@_);
if ($? == -1) {
die "failed to execute command '@_': $!\n";