-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathjson.patch
More file actions
97 lines (88 loc) · 4.17 KB
/
json.patch
File metadata and controls
97 lines (88 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b93c6e47..11448a52 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.10)
##
## PROJECT
diff --git a/include/nlohmann/detail/exceptions.hpp b/include/nlohmann/detail/exceptions.hpp
index b4b18049..597f835d 100644
--- a/include/nlohmann/detail/exceptions.hpp
+++ b/include/nlohmann/detail/exceptions.hpp
@@ -127,9 +127,8 @@ class parse_error : public exception
template<typename BasicJsonType>
static parse_error create(int id_, const position_t& pos, const std::string& what_arg, const BasicJsonType& context)
{
- std::string w = exception::name("parse_error", id_) + "parse error" +
- position_string(pos) + ": " + exception::diagnostics(context) + what_arg;
- return {id_, pos.chars_read_total, w.c_str()};
+ std::string w = exception::diagnostics(context) + what_arg;
+ return {id_, pos.chars_read_total, w.c_str(), {pos.chars_read_total, pos.chars_read_current_line, pos.lines_read + 1}};
}
template<typename BasicJsonType>
@@ -138,7 +137,7 @@ class parse_error : public exception
std::string w = exception::name("parse_error", id_) + "parse error" +
(byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") +
": " + exception::diagnostics(context) + what_arg;
- return {id_, byte_, w.c_str()};
+ return {id_, byte_, w.c_str(), {0, 0, 0}};
}
/*!
@@ -153,14 +152,8 @@ class parse_error : public exception
const std::size_t byte;
private:
- parse_error(int id_, std::size_t byte_, const char* what_arg)
- : exception(id_, what_arg), byte(byte_) {}
-
- static std::string position_string(const position_t& pos)
- {
- return " at line " + std::to_string(pos.lines_read + 1) +
- ", column " + std::to_string(pos.chars_read_current_line);
- }
+ parse_error(int id_, std::size_t byte_, const char* what_arg, position_t pos_)
+ : exception(id_, what_arg), byte(byte_), pos(pos_) {}
};
/// @brief exception indicating errors with iterators
diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp
index 92308c55..479aad4a 100644
--- a/single_include/nlohmann/json.hpp
+++ b/single_include/nlohmann/json.hpp
@@ -2912,9 +2912,8 @@ class parse_error : public exception
template<typename BasicJsonType>
static parse_error create(int id_, const position_t& pos, const std::string& what_arg, const BasicJsonType& context)
{
- std::string w = exception::name("parse_error", id_) + "parse error" +
- position_string(pos) + ": " + exception::diagnostics(context) + what_arg;
- return {id_, pos.chars_read_total, w.c_str()};
+ std::string w = exception::diagnostics(context) + what_arg;
+ return {id_, pos.chars_read_total,w.c_str(), {pos.chars_read_total, pos.chars_read_current_line, pos.lines_read+1}};
}
template<typename BasicJsonType>
@@ -2923,7 +2922,7 @@ class parse_error : public exception
std::string w = exception::name("parse_error", id_) + "parse error" +
(byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") +
": " + exception::diagnostics(context) + what_arg;
- return {id_, byte_, w.c_str()};
+ return {id_, byte_,w.c_str(), {0,0,0}};
}
/*!
@@ -2936,16 +2935,11 @@ class parse_error : public exception
This also holds true when reading a byte vector (CBOR or MessagePack).
*/
const std::size_t byte;
+ position_t pos;
private:
- parse_error(int id_, std::size_t byte_, const char* what_arg)
- : exception(id_, what_arg), byte(byte_) {}
-
- static std::string position_string(const position_t& pos)
- {
- return " at line " + std::to_string(pos.lines_read + 1) +
- ", column " + std::to_string(pos.chars_read_current_line);
- }
+ parse_error(int id_, std::size_t byte_, const char* what_arg, position_t pos_)
+ : exception(id_, what_arg), byte(byte_), pos(pos_) {}
};
/// @brief exception indicating errors with iterators