Skip to content

Commit

Permalink
Merged log_ lines in the JSON parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ZipCPU committed Jun 7, 2018
1 parent 87775d3 commit cbd0622
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions frontend/json/jsonparse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ struct JsonNode
ch = f.get();

if (ch == EOF)
log_error("Unexpected EOF "
"in JSON string.\n");
log_error("Unexpected EOF in JSON string.\n");

if (ch == '\"')
break;
Expand All @@ -80,8 +79,7 @@ struct JsonNode
int ch = f.get();

if (ch == EOF)
log_error("Unexpected EOF "
"in JSON string.\n");
log_error("Unexpected EOF in JSON string.\n");
}

data_string += ch;
Expand Down Expand Up @@ -145,8 +143,7 @@ struct JsonNode
ch = f.get();

if (ch == EOF)
log_error("Unexpected EOF "
"in JSON file.\n");
log_error("Unexpected EOF in JSON file.\n");

if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ||
ch == ',')
Expand All @@ -169,8 +166,7 @@ struct JsonNode
ch = f.get();

if (ch == EOF)
log_error("Unexpected EOF "
"in JSON file.\n");
log_error("Unexpected EOF in JSON file.\n");

if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ||
ch == ',')
Expand All @@ -186,8 +182,7 @@ struct JsonNode
ch = f.get();

if (ch == EOF)
log_error("Unexpected EOF "
"in JSON file.\n");
log_error("Unexpected EOF in JSON file.\n");

if (ch == ' ' || ch == '\t' || ch == '\r' ||
ch == '\n' || ch == ':')
Expand All @@ -200,9 +195,7 @@ struct JsonNode
JsonNode *value = new JsonNode(f);

if (key.type != 'S')
log_error("Unexpected "
"non-string key "
"in JSON dict.\n");
log_error("Unexpected non-string key in JSON dict.\n");

data_dict[key.data_string] = value;
data_dict_keys.push_back(key.data_string);
Expand Down

0 comments on commit cbd0622

Please sign in to comment.