Change lexer to more closely match Verilog-Perl. Should be no functional change

This commit is contained in:
Wilson Snyder 2009-05-05 13:39:25 -04:00
parent 0985f675e3
commit 851b022c7a
3 changed files with 593 additions and 461 deletions

61
nodist/flexdiff Executable file
View File

@ -0,0 +1,61 @@
#!/usr/bin/perl -w
######################################################################
#
# Copyright 2007-2009 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;
push @lines, $line;
}
#@lines = sort @lines;
$fho->print(@lines);
}
# Local Variables:
# compile-command: "./flexdiff $WUP/Verilog/Parser/VParseLex.l ../src/verilog.l"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -243,8 +243,8 @@ class AstSenTree;
%token<fileline> yPOSEDGE "posedge"
%token<fileline> yPRIORITY "priority"
%token<fileline> yPROPERTY "property"
%token<fileline> yPULLDOWN "pulldown"
%token<fileline> yPULLUP "pullup"
%token<fileline> yPULLDOWN "pulldown"
%token<fileline> yPULLUP "pullup"
%token<fileline> yREG "reg"
%token<fileline> yREPEAT "repeat"
%token<fileline> ySCALARED "scalared"
@ -318,6 +318,8 @@ class AstSenTree;
%token<fileline> yVL_PUBLIC_FLAT "/*verilator public_flat*/"
%token<fileline> yVL_PUBLIC_MODULE "/*verilator public_module*/"
%token<fileline> yP_TICK "'"
%token<fileline> yP_TICKBRA "'{"
%token<fileline> yP_OROR "||"
%token<fileline> yP_ANDAND "&&"
%token<fileline> yP_NOR "~|"
@ -352,7 +354,12 @@ class AstSenTree;
%token<fileline> yP_COLONDIV ":/"
%token<fileline> yP_ORMINUSGT "|->"
%token<fileline> yP_OREQGT "|=>"
%token<fileline> yP_BRASTAR "[*"
%token<fileline> yP_BRAEQ "[="
%token<fileline> yP_BRAMINUSGT "[->"
%token<fileline> yP_PLUSPLUS "++"
%token<fileline> yP_MINUSMINUS "--"
%token<fileline> yP_PLUSEQ "+="
%token<fileline> yP_MINUSEQ "-="
%token<fileline> yP_TIMESEQ "*="
@ -1747,6 +1754,11 @@ AstText* V3Parse::createTextQuoted(FileLine* fileline, string text) {
return new AstText(fileline, newtext);
}
//YACC = /kits/sources/bison-2.4.1/src/bison --report=lookahead
// --report=lookahead
// --report=itemset
// --graph
//
// Local Variables:
// compile-command: "cd obj_dbg ; /usr/bin/bison -y -d -v ../verilog.y ; cat y.output"
// End: