mirror of https://github.com/YosysHQ/yosys.git
fmt: correct parsing of {{ and }} for brace literals
This commit is contained in:
parent
3c8f84b70b
commit
289f8d42cb
|
@ -36,11 +36,13 @@ void Fmt::parse_rtlil(RTLIL::Cell *cell) {
|
||||||
|
|
||||||
FmtPart part;
|
FmtPart part;
|
||||||
for (size_t i = 0; i < fmt.size(); i++) {
|
for (size_t i = 0; i < fmt.size(); i++) {
|
||||||
if (fmt.substr(i, 2) == "}}")
|
if (fmt.substr(i, 2) == "}}") {
|
||||||
part.str += '}';
|
part.str += '}';
|
||||||
else if (fmt.substr(i, 2) == "{{")
|
++i;
|
||||||
|
} else if (fmt.substr(i, 2) == "{{") {
|
||||||
part.str += '{';
|
part.str += '{';
|
||||||
else if (fmt[i] == '}')
|
++i;
|
||||||
|
} else if (fmt[i] == '}')
|
||||||
log_assert(false && "Unexpected '}' in format string");
|
log_assert(false && "Unexpected '}' in format string");
|
||||||
else if (fmt[i] == '{') {
|
else if (fmt[i] == '{') {
|
||||||
if (!part.str.empty()) {
|
if (!part.str.empty()) {
|
||||||
|
|
Loading…
Reference in New Issue