Commit Graph

2316 Commits

Author SHA1 Message Date
Vladimir Petrigo
8edb0cd15c Add VS17 image to appveyor matrix 2017-03-25 14:57:58 +03:00
Niels Lohmann
a93ec07c8c
Merge branch 'develop' into feature/manual_lexer 2017-03-24 19:53:19 +01:00
Niels Lohmann
3d597dda5d
📝 update after #534 2017-03-24 19:51:11 +01:00
Niels Lohmann
40160f482a
🚧 manual lexer
This commit removed the re2c lexer and replaced it by a manual version.
Its integration is not yet complete: number parsing does not respect
locales or overflows. Furthermore, parsing does not need to end with
EOF. Therefore, a lot of test cases fail. The idea is to push this
branch forward so we can conduct performance comparisons. So far, a
nice side effect are better diagnosis messages in case of parse errors.
2017-03-24 19:49:02 +01:00
Niels Lohmann
bba688f53e Merge pull request #534 from TedLyngmo/utf8_encoding_enhancement
UTF8 encoding enhancement
2017-03-24 19:38:29 +01:00
Ted Lyngmo
cea2426731 UTF8 encoding enhancement 2017-03-24 14:56:48 +01:00
Niels Lohmann
8a872927e8 Merge pull request #530 from berkus/patch-1
Fix typo
2017-03-23 13:57:54 +01:00
Berkus Decker
b14629b0a6 Fix typo 2017-03-23 14:50:41 +02:00
Niels Lohmann
54db53c230
📝 update after #527 and #525 2017-03-22 08:10:31 +01:00
Niels Lohmann
d60851168e
🚨 fixed a compiler warning #527
The result of snprintf is later used in situations where a long may
overflow.
2017-03-22 08:10:02 +01:00
Niels Lohmann
67a06834b0 Merge pull request #526 from krzysztofwos/feature/exception-base-class
Make exception base class visible in basic_json
2017-03-22 07:50:34 +01:00
Krzysztof Woś
b9c3b8d688 Exit with an error if re2c is not available
Instead of overwriting src/json.hpp with an empty file
2017-03-20 16:00:58 +09:00
Krzysztof Woś
86579209c8 Make exception base class visible in basic_json 2017-03-20 16:00:58 +09:00
Niels Lohmann
31a6c0910e
🚑 fix for #519
Added catch branch for out_of_range exception that can occur if input
file contains a number overflow.
2017-03-17 22:18:48 +01:00
Niels Lohmann
f547679de5
🚑 fix for #516 and #518
We should compare the binary serializations rather than the JSON values
themselves. This fix was already done for CBOR and apparently forgotten
for MessagePack.
2017-03-17 22:18:05 +01:00
Niels Lohmann
2d474b5273 Merge pull request #510 from alex-weej/patch-1
🎨 Namespace `uint8_t` from the C++ stdlib
2017-03-17 06:47:11 +01:00
Alexander “weej” Jones
836f1c4189 🎨 Namespace uint8_t from the C++ stdlib 2017-03-16 18:24:41 +00:00
Niels Lohmann
cd43600e6f
💄 cleanup after #508 2017-03-16 19:02:05 +01:00
Niels Lohmann
773b33e016 Merge pull request #508 from theodelrieu/feature/c_array_conversion
add to_json method for C arrays
2017-03-16 19:00:58 +01:00
Niels Lohmann
c5711f3072
🚧 a lot of minor changes
- Removed unused headers.
- Added override where needed.
- Added description for parse_error.113 exception.
- Fixed some conversion warnings.
- Integrated cbor_expect_string function for CBOR maps.
- Added documentation on the supported CBOR/MessagePack features.
- Added test to check all initial bytes for CBOR input.
2017-03-16 18:39:33 +01:00
Niels Lohmann
483a58f625
🚨 added pedantic flags for GCC
With GCC 7, there are even more diagnostic flags.
2017-03-16 18:35:45 +01:00
Théo DELRIEU
dbebf8de47
add to_json method for C arrays
If the array can be converted to basic_json::string_t, the overload
in this commit is not chosen.
2017-03-16 15:20:39 +01:00
Niels Lohmann
100bf3ef2c
Merge branch 'feature/getline' into develop 2017-03-14 23:08:19 +01:00
Niels Lohmann
710f8a2686
📝 improved documentation for to-CBOR and to-msgpack functions 2017-03-14 23:08:05 +01:00
Niels Lohmann
1de80e8af4
🔨 added user-defined exception #493
Replaced old std::invalid_argument exception by parse_error.111 to have
unified exceptions in case of input stream errors.
2017-03-14 21:31:36 +01:00
Niels Lohmann
63c2c62f19
🔨 changed call from "not good()" to "fail()" #493
Also merged develop into this feature branch.
2017-03-14 21:24:53 +01:00
Niels Lohmann
95474e420d
🏁 added parentheses around max/min calls #506
When <Windows.h> is included with MSVC, a macro NOMINMAX is defined
that yields compilation errors when max/min calls are encountered. This
can be fixed by un-defining NOMINMAX, or by placing parentheses around
all min/max calls. We chose the latter.
2017-03-14 21:11:20 +01:00
Niels Lohmann
b026591e9e
🚑 added special case to fuzzers to fix #504
Since #329, NaN and inf numbers do not yield an exception, but are
stored internally and are dumped as “null”. This commit adjusts the
fuzz testers to deal with this special case.
2017-03-14 21:05:38 +01:00
Niels Lohmann
bfe4788e32
🚑 fix for #500
Removed a check that already failed in MSVC.
2017-03-14 16:14:05 +01:00
Niels Lohmann
84072fbd6d
💄 fixed indentation 2017-03-14 16:07:28 +01:00
Niels Lohmann
b8b4362ca4
🔥 removed accidentally committed binaries 2017-03-13 19:04:19 +01:00
Niels Lohmann
c5cf32e34d
🔨 added user-defined exception 406 2017-03-12 20:59:33 +01:00
Niels Lohmann
43b8285249
🔀 merge branch 'feature/exceptions_3.0.0' into develop 2017-03-12 20:34:30 +01:00
Niels Lohmann
855cdcf05c
🔀 merge branch 'develop' into feature/exceptions_3.0.0 2017-03-12 20:22:30 +01:00
Niels Lohmann
8feaf8dc94
💥 implemented new handling of NaN and INF #70 #329 #388
- If an overflow occurs during parsing a number from a JSON text, an
exception (std::out_of_range for the moment, to be replaced by a
user-defined exception #244) is thrown so that the overflow is detected
early and roundtripping is guaranteed.
- NaN and INF floating-point values can be stored in a JSON value and
are not replaced by null. That is, the basic_json class behaves like
double in this regard (no exception occurs). However, NaN and INF are
serialized to “null”.
- Adjusted test cases appropriately.
2017-03-12 18:38:05 +01:00
Niels Lohmann
9355f05888
🔨 cleaned up array from_json methods #473
Removed some code that is not needed any more. Thus, streamlining the
array from_json methods.
2017-03-12 17:05:02 +01:00
Niels Lohmann
87eafd8d6a
added regression tests for #473
These tests currently pass without any adjustments to the source code.
2017-03-12 15:20:17 +01:00
Niels Lohmann
80dcf22fc3
🔨 added a check function for MsgPack strings #497
To avoid the error described in #497, I added a function
msgpack_expect_string that is executed every time a string is expected
during the parsing of a map. In case the current byte does not belong
to a MsgPack string, an exception is thrown.
2017-03-12 14:39:20 +01:00
Niels Lohmann
28dbe4e651
📝 overworked documentation for the at functions
Added all possible exceptions to the examples of the at functions.
2017-03-12 13:49:39 +01:00
Niels Lohmann
89f6068385
Merge branch 'develop' into feature/exceptions_3.0.0 2017-03-12 11:51:24 +01:00
Niels Lohmann
dfa4e83cd8
Merge branch 'feature/no_exceptions' into develop 2017-03-12 11:49:52 +01:00
Niels Lohmann
e3e941ef2b
👷 fixed a syntax error 2017-03-12 11:19:27 +01:00
Niels Lohmann
01470f388b
👷 fixed no_exceptions test case
This test case relied on logics that have been replaced by CMake with
#461. This change enables compilation and execution of the test suite
without exceptions by adding an after_success task.
2017-03-12 11:04:26 +01:00
Niels Lohmann
4d7c29923e
🚑 fix for #486
Implemented std::less<value_t> to allow using value_t as std::map key
in MSVC.
2017-03-12 10:40:36 +01:00
Niels Lohmann
4b9c2f1287
🔨 added __EXCEPTIONS to the list 2017-03-11 20:16:13 +01:00
Niels Lohmann
4e49829851
🚑 fix for #493
Added a test to check if the input stream is good() before executing
getline on it. Also added two test cases that set the failbit and
badbit before calling file_line_buffer.
2017-03-11 19:26:12 +01:00
Niels Lohmann
122afbf128
🔨 added defined() check 2017-03-11 18:43:21 +01:00
Niels Lohmann
e3e6cbecc7
🏁 added check for _CPPUNWIND
MSVC does not define __cpp_exceptions, but seems to use _CPPUNWIND when
exception support is switched on, see
https://msdn.microsoft.com/en-us/library/b0084kay.aspx.
2017-03-11 17:59:24 +01:00
Niels Lohmann
65dfc97d40
🔨 using __cpp_exceptions to detect exception support #498
I used __EXCEPTIONS to detect whether exceptions are supported.
Apparently, this is a macro that is only used by libstdc++
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64276). It’s much cleaner
to use __cpp_exceptions as it is in the standard since C++98.

Note that compiling the unit-tests with “-fno-exceptions” still does
not work, because Catch uses throw internally. However, the library’s
exceptions can be switched off by defining JSON_NOEXCEPTION.
2017-03-11 17:44:54 +01:00
Niels Lohmann
ff0b18d10c
Merge branch 'feature/vector_bool' into develop 2017-03-11 17:22:14 +01:00