Skip to content

Commit

Permalink
Fix newlines in radix values, bug507.
Browse files Browse the repository at this point in the history
  • Loading branch information
wsnyder committed May 7, 2012
1 parent e97541d commit 0c1e184
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ indicates the contributor was also the author of the fix; Thanks!


**** Fix imports causing symbol table error, bug490. [Alex Solomatnikov] **** Fix imports causing symbol table error, bug490. [Alex Solomatnikov]


**** Fix newlines in radix values, bug507. [Walter Lavino]


* Verilator 3.833 2012/04/15 * Verilator 3.833 2012/04/15


*** Support += and -= in standard for loops, bug463. [Alex Solomatnikov] *** Support += and -= in standard for loops, bug463. [Alex Solomatnikov]
Expand Down
17 changes: 9 additions & 8 deletions src/verilog.l
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extern void yyerrorf(const char* format, ...);
//====================================================================== //======================================================================


#define NEXTLINE() {PARSEP->linenoInc();} #define NEXTLINE() {PARSEP->linenoInc();}
#define LINECHECK() { const char* cp=yytext; for (int n=yyleng; n; --n) if (cp[n]=='\n') NEXTLINE(); }
#define CRELINE() (PARSEP->copyOrSameFileLine()) #define CRELINE() (PARSEP->copyOrSameFileLine())


#define FL { yylval.fl = CRELINE(); } #define FL { yylval.fl = CRELINE(); }
Expand Down Expand Up @@ -894,25 +895,25 @@ word [a-zA-Z0-9_]+
} }
\" { yy_push_state(STRING); yymore(); } \" { yy_push_state(STRING); yymore(); }
[0-9]*?['']s?[bcodhBCODH][ \t]*[A-Fa-f0-9xXzZ_?]* { [0-9]*?['']s?[bcodhBCODH][ \t\n]*[A-Fa-f0-9xXzZ_?]* {
FL; yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext); FL; LINECHECK(); yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
[0-9]*?['']s?[01xXzZ] { /* SystemVerilog */ [0-9]*?['']s?[01xXzZ] { /* SystemVerilog */
FL; yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext); FL; yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
/* Note below is constructed to not match the ' that begins a '( or '{ */ /* Note below is constructed to not match the ' that begins a '( or '{ */
[0-9][_0-9]*[ \t]*['']s?[bcodhBCODH]?[ \t]*[A-Fa-f0-9xXzZ_?]+ { [0-9][_0-9]*[ \t\n]*['']s?[bcodhBCODH]?[ \t]*[A-Fa-f0-9xXzZ_?]+ {
FL; yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext); FL; LINECHECK(); yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
[0-9][_0-9]*[ \t]*['']s?[bcodhBCODH] { [0-9][_0-9]*[ \t\n]*['']s?[bcodhBCODH] {
FL; yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext); FL; LINECHECK(); yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
[0-9][_0-9]*[ \t]*['']s { [0-9][_0-9]*[ \t\n]*['']s {
FL; yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext); FL; LINECHECK(); yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
[0-9][_0-9]* { [0-9][_0-9]* {
Expand Down

0 comments on commit 0c1e184

Please sign in to comment.