125 Commits

Author SHA1 Message Date
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
miloyip
3a92374011 Try turning on slow test on number parsing 2015-04-14 12:01:41 +08:00
miloyip
f51c0141c5 Improve coverage of encodings 2015-04-14 00:39:54 +08:00
miloyip
4bcedab513 Try to improve coverage of encodings 2015-04-13 23:03:00 +08:00
miloyip
074554965d Improve Reading kParseErrorTermination coverage 2015-04-13 17:07:15 +08:00
miloyip
331009a321 Fix gcc warning 2015-04-13 16:49:10 +08:00
miloyip
7e1a6a1bb2 Add Reader kParseErrorTermination coverage 2015-04-13 16:45:00 +08:00
miloyip
55f8339a0a Compare exact binary representation for full precision test
Conflicts:
	doc/diagram/simpledom.png
2015-04-11 11:26:47 +08:00
Milo Yip
e04d66bdd8 Try to use EXPECT_NEAR 2015-04-10 23:47:53 +08:00
Milo Yip
c18812a36a Fix yet another -Wfloat-equal warning 2015-04-10 23:37:20 +08:00
Milo Yip
2524693cfd Suppress float-equal in readertest.cpp 2015-04-10 23:24:33 +08:00