|
@@ -3952,6 +3952,12 @@ protected:
|
|
curOffset++;
|
|
curOffset++;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+ inline bool checkStartReadNext()
|
|
|
|
+ {
|
|
|
|
+ if (curOffset || nextChar) //not at starting state
|
|
|
|
+ return true;
|
|
|
|
+ return readNextToken();
|
|
|
|
+ }
|
|
inline bool readNextToken();
|
|
inline bool readNextToken();
|
|
inline bool checkSkipWS()
|
|
inline bool checkSkipWS()
|
|
{
|
|
{
|
|
@@ -6290,6 +6296,9 @@ public:
|
|
typedef CommonReaderBase<X> PARENT;
|
|
typedef CommonReaderBase<X> PARENT;
|
|
using PARENT::reset;
|
|
using PARENT::reset;
|
|
using PARENT::nextChar;
|
|
using PARENT::nextChar;
|
|
|
|
+ using PARENT::readNextToken;
|
|
|
|
+ using PARENT::checkReadNext;
|
|
|
|
+ using PARENT::checkStartReadNext;
|
|
using PARENT::readNext;
|
|
using PARENT::readNext;
|
|
using PARENT::expecting;
|
|
using PARENT::expecting;
|
|
using PARENT::match;
|
|
using PARENT::match;
|
|
@@ -6447,6 +6456,7 @@ class CJSONReader : public CJSONReaderBase<X>, implements IPTreeReader
|
|
using PARENT::readName;
|
|
using PARENT::readName;
|
|
using PARENT::checkReadNext;
|
|
using PARENT::checkReadNext;
|
|
using PARENT::checkSkipWS;
|
|
using PARENT::checkSkipWS;
|
|
|
|
+ using PARENT::checkStartReadNext;
|
|
using PARENT::expecting;
|
|
using PARENT::expecting;
|
|
using PARENT::error;
|
|
using PARENT::error;
|
|
using PARENT::eos;
|
|
using PARENT::eos;
|
|
@@ -6478,6 +6488,7 @@ public:
|
|
}
|
|
}
|
|
void readValueNotify(const char *name, bool skipAttributes)
|
|
void readValueNotify(const char *name, bool skipAttributes)
|
|
{
|
|
{
|
|
|
|
+ offset_t startOffset = curOffset;
|
|
StringBuffer value;
|
|
StringBuffer value;
|
|
if (readValue(value)==elementTypeNull)
|
|
if (readValue(value)==elementTypeNull)
|
|
return;
|
|
return;
|
|
@@ -6489,7 +6500,7 @@ public:
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- iEvent->beginNode(name, curOffset);
|
|
|
|
|
|
+ iEvent->beginNode(name, startOffset);
|
|
iEvent->beginNodeContent(name);
|
|
iEvent->beginNodeContent(name);
|
|
iEvent->endNode(name, value.length(), value.str(), false, curOffset);
|
|
iEvent->endNode(name, value.length(), value.str(), false, curOffset);
|
|
|
|
|
|
@@ -6576,9 +6587,10 @@ public:
|
|
}
|
|
}
|
|
iEvent->endNode(name, 0, "", false, curOffset);
|
|
iEvent->endNode(name, 0, "", false, curOffset);
|
|
}
|
|
}
|
|
|
|
+
|
|
void loadJSON()
|
|
void loadJSON()
|
|
{
|
|
{
|
|
- if (!checkReadNext())
|
|
|
|
|
|
+ if (!checkStartReadNext())
|
|
return;
|
|
return;
|
|
if (checkBOM() && !checkReadNext())
|
|
if (checkBOM() && !checkReadNext())
|
|
return;
|
|
return;
|
|
@@ -6656,6 +6668,7 @@ class CPullJSONReader : public CJSONReaderBase<X>, implements IPullPTreeReader
|
|
using PARENT::readName;
|
|
using PARENT::readName;
|
|
using PARENT::checkReadNext;
|
|
using PARENT::checkReadNext;
|
|
using PARENT::checkSkipWS;
|
|
using PARENT::checkSkipWS;
|
|
|
|
+ using PARENT::checkStartReadNext;
|
|
using PARENT::expecting;
|
|
using PARENT::expecting;
|
|
using PARENT::error;
|
|
using PARENT::error;
|
|
using PARENT::eos;
|
|
using PARENT::eos;
|
|
@@ -6700,6 +6713,7 @@ class CPullJSONReader : public CJSONReaderBase<X>, implements IPullPTreeReader
|
|
enum ParseStates { headerStart, nameStart, valueStart, itemStart, objAttributes, itemContent, itemEnd } state;
|
|
enum ParseStates { headerStart, nameStart, valueStart, itemStart, objAttributes, itemContent, itemEnd } state;
|
|
bool endOfRoot;
|
|
bool endOfRoot;
|
|
bool preReadItemName;
|
|
bool preReadItemName;
|
|
|
|
+ bool more;
|
|
StringBuffer tag, value;
|
|
StringBuffer tag, value;
|
|
|
|
|
|
void init()
|
|
void init()
|
|
@@ -6708,6 +6722,7 @@ class CPullJSONReader : public CJSONReaderBase<X>, implements IPullPTreeReader
|
|
stateInfo = NULL;
|
|
stateInfo = NULL;
|
|
endOfRoot = false;
|
|
endOfRoot = false;
|
|
preReadItemName = false;
|
|
preReadItemName = false;
|
|
|
|
+ more = true;
|
|
}
|
|
}
|
|
|
|
|
|
virtual void resetState()
|
|
virtual void resetState()
|
|
@@ -6903,7 +6918,6 @@ public:
|
|
}
|
|
}
|
|
bool endNode(offset_t offset, bool notify=true)
|
|
bool endNode(offset_t offset, bool notify=true)
|
|
{
|
|
{
|
|
- bool more = true;
|
|
|
|
if (stack.ordinality()<2)
|
|
if (stack.ordinality()<2)
|
|
{
|
|
{
|
|
state = headerStart;
|
|
state = headerStart;
|
|
@@ -6919,7 +6933,7 @@ public:
|
|
freeStateInfo.append(*stateInfo);
|
|
freeStateInfo.append(*stateInfo);
|
|
stack.pop();
|
|
stack.pop();
|
|
stateInfo = (stack.ordinality()) ? &stack.tos() : NULL;
|
|
stateInfo = (stack.ordinality()) ? &stack.tos() : NULL;
|
|
- return more;
|
|
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
// IPullPTreeReader
|
|
// IPullPTreeReader
|
|
@@ -6938,6 +6952,9 @@ public:
|
|
|
|
|
|
virtual bool next()
|
|
virtual bool next()
|
|
{
|
|
{
|
|
|
|
+ if (!more)
|
|
|
|
+ return false;
|
|
|
|
+ checkStartReadNext();
|
|
checkSkipWS();
|
|
checkSkipWS();
|
|
switch (state)
|
|
switch (state)
|
|
{
|
|
{
|