forked from github/verilator
Fix display of empty string constant (#3207).
This commit is contained in:
parent
106d635d0f
commit
d2a8fa7440
1
Changes
1
Changes
@ -22,6 +22,7 @@ Verilator 4.215 devel
|
|||||||
* Fix array method names with parenthesis (#3181) (#3183). [Teng Huang]
|
* Fix array method names with parenthesis (#3181) (#3183). [Teng Huang]
|
||||||
* Fix split_var assign merging (#3177) (#3179). [Yutetsu TAKATSUKASA]
|
* Fix split_var assign merging (#3177) (#3179). [Yutetsu TAKATSUKASA]
|
||||||
* Fix nested generate if genblk naming (#3189). [yanx21]
|
* Fix nested generate if genblk naming (#3189). [yanx21]
|
||||||
|
* Fix display of empty string constant (#3207). [Julie Schwartz]
|
||||||
|
|
||||||
|
|
||||||
Verilator 4.214 2021-10-17
|
Verilator 4.214 2021-10-17
|
||||||
|
@ -233,6 +233,7 @@ public:
|
|||||||
V3Number(String, AstNode* nodep, const string& value) {
|
V3Number(String, AstNode* nodep, const string& value) {
|
||||||
init(nodep, 0);
|
init(nodep, 0);
|
||||||
setString(value);
|
setString(value);
|
||||||
|
m_fromString = true;
|
||||||
}
|
}
|
||||||
class Null {};
|
class Null {};
|
||||||
V3Number(Null, AstNode* nodep) {
|
V3Number(Null, AstNode* nodep) {
|
||||||
|
@ -5006,7 +5006,15 @@ str<strp>: // yaSTRING but with \{escapes} need decoded
|
|||||||
|
|
||||||
strAsInt<nodep>:
|
strAsInt<nodep>:
|
||||||
yaSTRING
|
yaSTRING
|
||||||
{ $$ = new AstConst{$<fl>1, AstConst::VerilogStringLiteral(), GRAMMARP->deQuote($<fl>1, *$1)}; }
|
{ if ($1->empty()) {
|
||||||
|
// else "" is not representable as number as is width 0
|
||||||
|
// TODO all strings should be represented this way
|
||||||
|
// until V3Width converts as/if needed to a numerical constant
|
||||||
|
$$ = new AstConst{$<fl>1, AstConst::String{}, GRAMMARP->deQuote($<fl>1, *$1)};
|
||||||
|
} else {
|
||||||
|
$$ = new AstConst{$<fl>1, AstConst::VerilogStringLiteral(), GRAMMARP->deQuote($<fl>1, *$1)};
|
||||||
|
}
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
strAsIntIgnore<nodep>: // strAsInt, but never matches for when expr shouldn't parse strings
|
strAsIntIgnore<nodep>: // strAsInt, but never matches for when expr shouldn't parse strings
|
||||||
|
@ -56,6 +56,7 @@ hello, from a concatenated string.
|
|||||||
hello, from a concatenated format string [0].
|
hello, from a concatenated format string [0].
|
||||||
extra argument: 0
|
extra argument: 0
|
||||||
0 : pre argument after
|
0 : pre argument after
|
||||||
|
empty: ><
|
||||||
[0] Embedded tab ' ' and <#013> return
|
[0] Embedded tab ' ' and <#013> return
|
||||||
[0] Embedded
|
[0] Embedded
|
||||||
multiline
|
multiline
|
||||||
|
@ -149,6 +149,7 @@ module t;
|
|||||||
$write("hel", "lo, fr", "om a concatenated format string [%0t].\n", $time);
|
$write("hel", "lo, fr", "om a concatenated format string [%0t].\n", $time);
|
||||||
$display("extra argument: ", $time);
|
$display("extra argument: ", $time);
|
||||||
$display($time,, ": pre argument",, "after");
|
$display($time,, ": pre argument",, "after");
|
||||||
|
$display("empty: >%s<", "");
|
||||||
$write("[%0t] Embedded tab '\t' and \r return\n", $time);
|
$write("[%0t] Embedded tab '\t' and \r return\n", $time);
|
||||||
$display("[%0t] Embedded\
|
$display("[%0t] Embedded\
|
||||||
multiline", $time);
|
multiline", $time);
|
||||||
|
Loading…
Reference in New Issue
Block a user