| 1065 | } |
| 1066 | |
| 1067 | void emit_value_indented(SB *out, const JsonNode *node, const char *space, int indent_level) |
| 1068 | { |
| 1069 | ASSERT(tag_is_valid(node->tag)); |
| 1070 | switch (node->tag) |
| 1071 | { |
| 1072 | case JSON_NULL: |
| 1073 | sb_puts(out, "null"); |
| 1074 | break; |
| 1075 | case JSON_BOOL: |
| 1076 | sb_puts(out, node->bool_ ? "true" : "false"); |
| 1077 | break; |
| 1078 | case JSON_STRING: |
| 1079 | emit_string(out, node->string_); |
| 1080 | break; |
| 1081 | case JSON_NUMBER: |
| 1082 | emit_number(out, node->number_); |
| 1083 | break; |
| 1084 | case JSON_ARRAY: |
| 1085 | emit_array_indented(out, node, space, indent_level); |
| 1086 | break; |
| 1087 | case JSON_OBJECT: |
| 1088 | emit_object_indented(out, node, space, indent_level); |
| 1089 | break; |
| 1090 | default: |
| 1091 | die("invalid JSON tag type"); |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | static void emit_array(SB *out, const JsonNode *array) |
| 1096 | { |
no test coverage detected