Commit d2d5f6f9 authored by Sergey Kosarevsky's avatar Sergey Kosarevsky

ParseNumber() handles kParseNumbersAsStringsFlag

parent 4abcfd1e
......@@ -1097,6 +1097,8 @@ private:
NumberStream<InputStream, (parseFlags & kParseFullPrecisionFlag) != 0> s(*this, copy.s);
size_t startOffset = s.Tell();
typename InputStream::Ch *head = is.PutBegin();
// Parse minus
bool minus = Consume(s, '-');
......@@ -1268,6 +1270,16 @@ private:
// Finish parsing, call event according to the type of number.
bool cont = true;
if (parseFlags & kParseNumbersAsStringsFlag)
{
s.Pop(); // Pop stack no matter if it will be used or not.
const size_t length = s.Tell() - startOffset;
cont = handler.Number(head, length, (parseFlags & kParseInsituFlag) ? false : true);
}
else
{
size_t length = s.Length();
const char* decimal = s.Pop(); // Pop stack no matter if it will be used or not.
......@@ -1294,6 +1306,7 @@ private:
cont = handler.Uint(i);
}
}
}
if (RAPIDJSON_UNLIKELY(!cont))
RAPIDJSON_PARSE_ERROR(kParseErrorTermination, startOffset);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment