Merged log_ lines in the JSON parser

This commit is contained in:
ZipCPU 2018-06-07 15:54:23 -04:00
parent 87775d3c6f
commit cbd0622fb8

View File

@ -70,8 +70,7 @@ struct JsonNode
ch = f.get(); ch = f.get();
if (ch == EOF) if (ch == EOF)
log_error("Unexpected EOF " log_error("Unexpected EOF in JSON string.\n");
"in JSON string.\n");
if (ch == '\"') if (ch == '\"')
break; break;
@ -80,8 +79,7 @@ struct JsonNode
int ch = f.get(); int ch = f.get();
if (ch == EOF) if (ch == EOF)
log_error("Unexpected EOF " log_error("Unexpected EOF in JSON string.\n");
"in JSON string.\n");
} }
data_string += ch; data_string += ch;
@ -145,8 +143,7 @@ struct JsonNode
ch = f.get(); ch = f.get();
if (ch == EOF) if (ch == EOF)
log_error("Unexpected EOF " log_error("Unexpected EOF in JSON file.\n");
"in JSON file.\n");
if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' || if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ||
ch == ',') ch == ',')
@ -169,8 +166,7 @@ struct JsonNode
ch = f.get(); ch = f.get();
if (ch == EOF) if (ch == EOF)
log_error("Unexpected EOF " log_error("Unexpected EOF in JSON file.\n");
"in JSON file.\n");
if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' || if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ||
ch == ',') ch == ',')
@ -186,8 +182,7 @@ struct JsonNode
ch = f.get(); ch = f.get();
if (ch == EOF) if (ch == EOF)
log_error("Unexpected EOF " log_error("Unexpected EOF in JSON file.\n");
"in JSON file.\n");
if (ch == ' ' || ch == '\t' || ch == '\r' || if (ch == ' ' || ch == '\t' || ch == '\r' ||
ch == '\n' || ch == ':') ch == '\n' || ch == ':')
@ -200,9 +195,7 @@ struct JsonNode
JsonNode *value = new JsonNode(f); JsonNode *value = new JsonNode(f);
if (key.type != 'S') if (key.type != 'S')
log_error("Unexpected " log_error("Unexpected non-string key in JSON dict.\n");
"non-string key "
"in JSON dict.\n");
data_dict[key.data_string] = value; data_dict[key.data_string] = value;
data_dict_keys.push_back(key.data_string); data_dict_keys.push_back(key.data_string);