#!/usr/bin/perl -w ###################################################################### # # Copyright 2007-2018 by Wilson Snyder. This package is free software; you # can redistribute it and/or modify it under the terms of either the GNU # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # ###################################################################### # DESCRIPTION: Diff flex files use IO::File; use strict; my $Debug; diff($ARGV[0],$ARGV[1]); sub diff { my $a=shift; my $b=shift; my $ta = "/tmp/flexdiff.$$.a"; my $tb = "/tmp/flexdiff.$$.b"; prep($a,$ta); prep($b,$tb); system("diff -u -w $ta $tb"); } sub prep { my $filename = shift; my $wfilename = shift; my $fh = IO::File->new("<$filename") or die "%Error: $! $filename"; my $fho = IO::File->new(">$wfilename") or die "%Error: $! writing $wfilename"; my %declared; my %used; my @lines; while (defined(my $line = $fh->getline)) { # Productions #$line =~ s/[ \t]{[^}]*?}/\t{}/g; $line =~ s/StashPrefix;//g; $line =~ s/VALTEXT;//g; $line =~ s/CALLBACK\([^)]*\);//g; push @lines, $line; } #@lines = sort @lines; $fho->print(@lines); } # Local Variables: # compile-command: "./flexdiff $VP/Parser/VParseLex.l ../src/verilog.l" # End: