CJsonNode CExecAndParseStructuredOutput::ParseObject(bool root_object) { CJsonNode result(CJsonNode::NewObjectNode()); CJsonNode new_node; do { while (isspace(*m_Ch)) ++m_Ch; if (*m_Ch != '\'' && *m_Ch != '"') break; // New attribute/value pair string attr_name(ParseString()); while (isspace(*m_Ch)) ++m_Ch; if (*m_Ch == ':' || *m_Ch == '=') while (isspace(*++m_Ch)) ; if (new_node = ParseNode()) result.SetNode(attr_name, new_node); else ThrowUnexpectedCharError(); } while (MoreNodes()); if (root_object ? *m_Ch != '\0' : *m_Ch != '}') ThrowUnexpectedCharError(); ++m_Ch; return result; }
CJsonNode CNetScheduleStructuredOutputParser::ParseObject(char closing_char) { CJsonNode result(CJsonNode::NewObjectNode()); while (isspace((unsigned char) *m_Ch)) ++m_Ch; if (*m_Ch == closing_char) { ++m_Ch; return result; } while (*m_Ch == '\'' || *m_Ch == '"') { // New attribute/value pair string attr_name(ParseString(GetRemainder())); while (isspace((unsigned char) *m_Ch)) ++m_Ch; if (*m_Ch == ':' || *m_Ch == '=') while (isspace((unsigned char) *++m_Ch)) ; result.SetByKey(attr_name, ParseValue()); if (!MoreNodes()) { if (*m_Ch != closing_char) break; ++m_Ch; return result; } } INVALID_FORMAT_ERROR(); }
CJsonNode CExecAndParseStructuredOutput::ParseArray() { CJsonNode result(CJsonNode::NewArrayNode()); CJsonNode new_node; do { while (isspace(*m_Ch)) ++m_Ch; if (new_node = ParseNode()) result.PushNode(new_node); else break; } while (MoreNodes()); if (*m_Ch != ']') ThrowUnexpectedCharError(); ++m_Ch; return result; }
CJsonNode CNetScheduleStructuredOutputParser::ParseArray(char closing_char) { CJsonNode result(CJsonNode::NewArrayNode()); while (isspace((unsigned char) *m_Ch)) ++m_Ch; if (*m_Ch == closing_char) { ++m_Ch; return result; } do result.Append(ParseValue()); while (MoreNodes()); if (*m_Ch == closing_char) { ++m_Ch; return result; } INVALID_FORMAT_ERROR(); }