mirror of https://github.com/YosysHQ/yosys.git
frontend: json: parse negative values
Signed-off-by: Karol Gugala <kgugala@antmicro.com>
This commit is contained in:
parent
4746ffd7b2
commit
cc7d18d29a
|
@ -72,10 +72,17 @@ struct JsonNode
|
|||
break;
|
||||
}
|
||||
|
||||
if ('0' <= ch && ch <= '9')
|
||||
if (('0' <= ch && ch <= '9') || ch == '-')
|
||||
{
|
||||
bool negative = false;
|
||||
type = 'N';
|
||||
data_number = ch - '0';
|
||||
if (ch == '-') {
|
||||
data_number = 0;
|
||||
negative = true;
|
||||
} else {
|
||||
data_number = ch - '0';
|
||||
}
|
||||
|
||||
data_string += ch;
|
||||
|
||||
while (1)
|
||||
|
@ -97,6 +104,7 @@ struct JsonNode
|
|||
data_string += ch;
|
||||
}
|
||||
|
||||
data_number = negative ? -data_number : data_number;
|
||||
data_string = "";
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue