X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/10c0d7324d1a25feebaaf6f5bf9b6054e03dd0b3..65eef741908a8005f8a1e11f1fa0f6c19afd3d0c:/stglibs/json.lib/parser.cpp?ds=sidebyside diff --git a/stglibs/json.lib/parser.cpp b/stglibs/json.lib/parser.cpp index 5547b697..57115048 100644 --- a/stglibs/json.lib/parser.cpp +++ b/stglibs/json.lib/parser.cpp @@ -34,8 +34,8 @@ class Parser::Impl yajl_free(m_handle); } - bool append(const char* data, size_t size) { return yajl_parse(m_handle, reinterpret_cast(data), size) != yajl_status_ok; } - bool done() { return yajl_complete_parse(m_handle) != yajl_status_ok; } + bool append(const char* data, size_t size) { return yajl_parse(m_handle, reinterpret_cast(data), size) == yajl_status_ok; } + bool last() { return yajl_complete_parse(m_handle) == yajl_status_ok; } static int parseNull(void* ctx) { return runParser(ctx, &NodeParser::parseNull); } @@ -100,6 +100,7 @@ Parser::Impl::Impl(NodeParser* topParser) : m_handle(yajl_alloc(&callbacks, NULL, this)), m_parser(topParser) { + yajl_config(m_handle, yajl_allow_multiple_values, 1); } Parser::Parser(NodeParser* topParser) @@ -116,7 +117,7 @@ bool Parser::append(const char* data, size_t size) return m_impl->append(data, size); } -bool Parser::done() +bool Parser::last() { - return m_impl->done(); + return m_impl->last(); }