135 Commits

Author SHA1 Message Date
Milo Yip
4a2f2729f1 Change from miloyip/rapidjson to Tencent/rapidjson 2017-09-13 17:03:23 +08:00
Christopher Warrington
e4c0ecf86b Guard against min/max macros in tests too 2017-09-05 18:27:02 -07:00
Alejandro Martinez
3c6e2cf030 Added unittests for invalid ascii control chars 2017-03-23 10:14:17 +00:00
StilesCrisis
ecf3d64293 Merge branch 'nan-inf-parse-fix' into token-by-token-parsing 2017-02-23 00:19:07 -08:00
StilesCrisis
5e785d3db2 Fix parsing of NaN/Inf
A failed half-consume of “NaN” now returns “value invalid” instead of
attempting to consume an “Inf”.
2017-02-23 00:11:12 -08:00
StilesCrisis
c4117c68cc Put in unit tests to catch parser failure
Noticed that the reader could over-consume “NaN” if token terminated in
the middle.
2017-02-22 21:54:31 -08:00
StilesCrisis
82a423db7d Added unit test for pull parsing
New unit test which ensures that IterativeParseNext always generates
exactly one element at a time, and that calling IterativeParseNext on a
complete document is harmless and generates zero events.
2017-02-03 21:12:53 -08:00
Milo Yip
738864c53c Remove non-ASCII character
Fix #824
2017-01-24 15:08:38 +08:00
Philipp A. Hartmann
ad32940da8 readertest: Suppress "dangling-else" warning on GCC 7 and later
GCC 6.x doesn't yet support this warning flag, as reported by
@ragnar-ouchterlony.
2016-06-27 19:05:29 +02:00
Philipp A. Hartmann
f6a07692f9 Fix warnings on GCC 6 and later (closes #666)
* document.h
  * suppress -Wterminate on GCC 6.x and later
  * simplify warning handling
* schema.h
  * drop RAPIDJSON_NOEXCEPT from GenericSchemaDocument constructor
    (calls RAPIDJSON_NEW anyway)
  * simplify warning handling
    (avoids RAPIDJSON_POP mismatch on Clang)
* encodingtest.cpp, istreamwrappertest.cpp
  * work around -Wdangling-else
* readertest.cpp
  * suppress -Wdangling-else
2016-06-23 21:42:16 +02:00
Michael Thon
135da7ab34 Allow options for writing and parsing NaN/Infinity
This adds kWriteNanAndInfFlag to Writer to allow writing of nan,
inf and -inf doubles as "NaN", "Infinity" and "-Infinity",
respectively, and kParseNanAndInfFlag to Reader to allow parsing
of "NaN", "Inf", "Infinity", "-Inf" and "-Infinity". This is part
of issue #36, adding optional support for relaxed JSON syntax.
2016-05-20 23:54:55 +02:00
Milo Yip
c843a2655b Try to fix all /W4 warnings in VC2015 2016-04-04 15:01:34 +08:00
Jarred Nicholls
926d7ffcc8 Later clang compilers will warn on float -> double promotion because it can add precision. In the context of RapidJSON – especially with its float methods on GenericValue – I think this warning holds no water and should be ignored.
Trim whitespace off the end of various lines.

Added an additional NumberStream specialization that will always perform a TakePush() even when just Take() is called. This supports RawNumber parsing by pushing onto our StackStream particular parts of the number that currently aren't captured because of full precision double parsing, such as the negative sign, scientific number exponents, etc.

RawNumber parsing fails with input streams that don't have copy optimization, such as the BasicIStreamWrapper stream. To work around this, instead do the Transcode copy operation by reading from a UTF8 StringStream instead of the original InputStream. Since the NumberStream downcasts all input Ch into chars, we know we're dealing with UTF8/ASCII compatible stack characters during the Transcoding.
2016-03-29 15:44:30 -04:00
Nicholas Fraser
68217548f3 Added trailing comma support to iterative parser
This also fixes cases where the iterative parser should have produced
kParseErrorValueInvalid rather than kParseErrorUnspecifiedSyntaxError
when expecting a value (after a colon in an object, after a comma in an
array, and at the start of an array.)
2016-03-20 12:52:48 -04:00
Nicholas Fraser
7c0e9d941d Added additional tests for trailing commas 2016-03-20 11:39:00 -04:00
Nicholas Fraser
3e21bb429d Added optional support for trailing commas
This adds kParseTrailingCommasFlag to allow a trailing comma at the
end of maps and arrays. This is part of issue #36, adding optional
support for relaxed JSON syntax.
2016-03-20 01:10:33 -04:00
Milo Yip
d9cf99baf6 Normalize all line endings 2016-03-04 09:44:01 +08:00
Sergey Kosarevsky
ae785ffb52 Don't use nullptr 2016-03-02 02:21:38 +01:00
Sergey Kosarevsky
57eae5595e Added new unit test for kParseNumbersAsStringsFlag 2016-03-02 02:08:59 +01:00
Sergey Kosarevsky
1ffb335915 Added RawNumber() to fix unit tests 2016-02-29 18:05:05 +01:00
Sergey Kosarevsky
3dba370486 Added IterativeParsingReaderHandler::RawNumber() 2016-02-29 17:51:32 +01:00
Jesse Schobben
995652e748 Add stream position check to reader unit tests 2016-02-13 23:04:21 +01:00
Milo Yip
f9d0f65ba0 Fix compilation 2016-02-09 17:39:46 +08:00
Milo Yip
ab250d21bc Rectify parsing error offsets 2016-02-09 17:33:49 +08:00
Milo Yip
b8a273705e Improve comment parsing code coverage 2016-02-03 09:32:34 +08:00
Milo Yip
a6eb15d274 Fix warnings in clang for C++11 2016-01-23 14:37:15 +08:00
Milo Yip
f13caadded Fix valgrind problem 2016-01-22 16:13:06 +08:00
Milo Yip
e392652754 Fix compilation 2016-01-22 16:05:46 +08:00
Milo Yip
69d0f41c4b Implemented ScanCopyUnescapeString optimization
Some performance issues to be fixed
2016-01-22 12:18:05 +08:00
Milo Yip
78c7d54aba Fix #498 VC2015 warnings 2016-01-20 22:29:50 +08:00
Milo Yip
5c003f3ecb Try to fix clang and gcc warnings problems again x9
Abandon RAPIDJSON_NORETURN_SUFFIX
2015-12-18 20:34:46 +08:00
Milo Yip
d72039f3ef Try to fix clang and gcc warnings problems again x6 2015-12-18 20:06:58 +08:00
Milo Yip
d6478991d0 Try to fix clang and gcc warnings problems again x4 2015-12-18 19:54:10 +08:00
Milo Yip
4cb7c88ca9 Try to fix clang and gcc warnings problems again x3 2015-12-18 19:47:11 +08:00
Milo Yip
74c8dcfd57 Fix clang -Weverything 2015-12-18 18:34:04 +08:00
Andrey
f7960ac0e8 Comments parsing fixes.
* Comments parsing function correctly handles EOF.
* Since SkipWhitespaceAndComments can generate errors, its calls should be followed by RAPIDJSON_PARSE_ERROR_EARLY_RETURN macro.
* Some tests to make the bug never appear again.
2015-10-14 00:04:29 +03:00
Andrey
5ce78b135d Introduce support of comments. 2015-10-11 15:09:58 +03:00
Milo Yip
add5a50581 Fix some numbers parsed incorrectly
Fix #340
2015-05-14 12:03:21 +08:00
Milo Yip
7708215b60 Try to fix #313 again 2015-04-25 00:13:09 +08:00
Milo Yip
735354efd3 Separate handling for pos/neg exp and improve pos exp overflow 2015-04-24 22:50:42 +08:00
Milo Yip
93d13ad2ac Fix #313 Assertion In Pow10.h is triggered in Document::Parse 2015-04-24 21:44:42 +08:00
miloyip
8d39282af5 Update license headers for tests 2015-04-18 21:41:38 +08:00
Milo Yip
fa32ec8991 Merge pull request #302 from thebusytypist/issue298_coverage
Improve code coverage for iterative parsing
2015-04-15 16:32:22 +08:00
thebusytypist
0d28bb13c7 Add a missing error handling check(a single number as JSON root). 2015-04-15 15:46:31 +08:00
thebusytypist
8576747373 Add unittest for state transition to IterativeParsingMemberKeyState. 2015-04-15 14:51:48 +08:00
thebusytypist
7cb031cc03 Add unittests for parsing root JSON value other than array and object. 2015-04-15 14:45:07 +08:00
miloyip
631302e68e Reduce random test iterations to speedup travis 2015-04-15 14:41:33 +08:00
miloyip
c69ff41fc2 Add tests for parsing number with exhaustive exponents and random signifcant 2015-04-15 14:23:00 +08:00
miloyip
4824f12efb Fixed a bug in trimming long number sequence 2015-04-14 13:59:05 +08:00
miloyip
4cc62876ae Add some parsing number tests 2015-04-14 13:22:39 +08:00