Fix erroring on strings with backslashed newlines, bug168.

This commit is contained in:
Wilson Snyder 2009-10-22 21:46:49 -04:00
parent b4d3806f10
commit e14695c96e
6 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix cell port connection to unsized integer causing false width warning.
**** Fix erroring on strings with backslashed newlines, bug168. [Pete Nixon]
* Verilator 3.714 2009/09/18
** Add --bbox-sys option to blackbox $system calls.

View File

@ -107,6 +107,7 @@ psl [p]sl
<STRMODE><<EOF>> { linenoInc(); yyerrorf("EOF in unterminated string"); yyleng=0; yyterminate(); }
<STRMODE>{crnl} { linenoInc(); yyerrorf("Unterminated string"); BEGIN(INITIAL); }
<STRMODE>[^\"\\] { yymore(); }
<STRMODE>{backslash}{crnl} { linenoInc(); yymore(); }
<STRMODE>{backslash}. { yymore(); }
<STRMODE>{quote} { yy_pop_state();
if (V3PreLex::s_currentLexp->m_parenLevel) appendDefValue(yytext,yyleng);

View File

@ -767,6 +767,7 @@ escid \\[^ \t\f\r\n]+
/************************************************************************/
/* STRINGS */
<STRING>{crnl} { yyerrorf("Unterminated string"); }
<STRING>\\{crnl} { yymore(); NEXTLINE(); }
<STRING>\\. { yymore(); }
<STRING>\" { yy_pop_state();
yylval.strp = V3Read::newString(yytext+1,yyleng-2);

View File

@ -27,6 +27,8 @@ execute (
[0] %s=! %s= what! %s= hmmm!1234
[0] hello, from a very long string. Percent %s are literally substituted in.
[0] Embedded <#013> return
[0] Embedded
multiline
*-* All Finished *-*
')),
);

View File

@ -38,6 +38,8 @@ module t;
$display("[%0t] %s%s%s", $time,
"hel", "lo, fr", "om a very long string. Percent %s are literally substituted in.");
$write("[%0t] Embedded \r return\n", $time);
$display("[%0t] Embedded\
multiline", $time);
// Str check
`ifndef nc // NC-Verilog 5.3 chokes on this test

View File

@ -30,6 +30,8 @@ execute (
[0] %s=! %s= what! %s= hmmm!1234
[0] hello, from a very long string. Percent %s are literally substituted in.
[0] Embedded <#013> return
[0] Embedded
multiline
*-* All Finished *-*
')),
);