1- /* auto-generated on 2025-02-14 16:11:36 -0500 . Do not edit! */
1+ /* auto-generated on 2025-03-27 15:01:10 -0400 . Do not edit! */
22/* including simdjson.cpp: */
33/* begin file simdjson.cpp */
44#define SIMDJSON_SRC_SIMDJSON_CPP
@@ -776,22 +776,22 @@ inline namespace literals {
776776inline namespace string_view_literals {
777777
778778
779- constexpr std::string_view operator "" _sv( const char* str, size_t len ) noexcept // (1)
779+ constexpr std::string_view operator ""_sv( const char* str, size_t len ) noexcept // (1)
780780{
781781 return std::string_view{ str, len };
782782}
783783
784- constexpr std::u16string_view operator "" _sv( const char16_t* str, size_t len ) noexcept // (2)
784+ constexpr std::u16string_view operator ""_sv( const char16_t* str, size_t len ) noexcept // (2)
785785{
786786 return std::u16string_view{ str, len };
787787}
788788
789- constexpr std::u32string_view operator "" _sv( const char32_t* str, size_t len ) noexcept // (3)
789+ constexpr std::u32string_view operator ""_sv( const char32_t* str, size_t len ) noexcept // (3)
790790{
791791 return std::u32string_view{ str, len };
792792}
793793
794- constexpr std::wstring_view operator "" _sv( const wchar_t* str, size_t len ) noexcept // (4)
794+ constexpr std::wstring_view operator ""_sv( const wchar_t* str, size_t len ) noexcept // (4)
795795{
796796 return std::wstring_view{ str, len };
797797}
@@ -2122,22 +2122,22 @@ nssv_inline_ns namespace string_view_literals {
21222122
21232123#if nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS
21242124
2125- nssv_constexpr nonstd::sv_lite::string_view operator "" sv( const char* str, size_t len ) nssv_noexcept // (1)
2125+ nssv_constexpr nonstd::sv_lite::string_view operator ""sv( const char* str, size_t len ) nssv_noexcept // (1)
21262126{
21272127 return nonstd::sv_lite::string_view{ str, len };
21282128}
21292129
2130- nssv_constexpr nonstd::sv_lite::u16string_view operator "" sv( const char16_t* str, size_t len ) nssv_noexcept // (2)
2130+ nssv_constexpr nonstd::sv_lite::u16string_view operator ""sv( const char16_t* str, size_t len ) nssv_noexcept // (2)
21312131{
21322132 return nonstd::sv_lite::u16string_view{ str, len };
21332133}
21342134
2135- nssv_constexpr nonstd::sv_lite::u32string_view operator "" sv( const char32_t* str, size_t len ) nssv_noexcept // (3)
2135+ nssv_constexpr nonstd::sv_lite::u32string_view operator ""sv( const char32_t* str, size_t len ) nssv_noexcept // (3)
21362136{
21372137 return nonstd::sv_lite::u32string_view{ str, len };
21382138}
21392139
2140- nssv_constexpr nonstd::sv_lite::wstring_view operator "" sv( const wchar_t* str, size_t len ) nssv_noexcept // (4)
2140+ nssv_constexpr nonstd::sv_lite::wstring_view operator ""sv( const wchar_t* str, size_t len ) nssv_noexcept // (4)
21412141{
21422142 return nonstd::sv_lite::wstring_view{ str, len };
21432143}
@@ -2146,22 +2146,22 @@ nssv_constexpr nonstd::sv_lite::wstring_view operator "" sv( const wchar_t* str,
21462146
21472147#if nssv_CONFIG_USR_SV_OPERATOR
21482148
2149- nssv_constexpr nonstd::sv_lite::string_view operator "" _sv( const char* str, size_t len ) nssv_noexcept // (1)
2149+ nssv_constexpr nonstd::sv_lite::string_view operator ""_sv( const char* str, size_t len ) nssv_noexcept // (1)
21502150{
21512151 return nonstd::sv_lite::string_view{ str, len };
21522152}
21532153
2154- nssv_constexpr nonstd::sv_lite::u16string_view operator "" _sv( const char16_t* str, size_t len ) nssv_noexcept // (2)
2154+ nssv_constexpr nonstd::sv_lite::u16string_view operator ""_sv( const char16_t* str, size_t len ) nssv_noexcept // (2)
21552155{
21562156 return nonstd::sv_lite::u16string_view{ str, len };
21572157}
21582158
2159- nssv_constexpr nonstd::sv_lite::u32string_view operator "" _sv( const char32_t* str, size_t len ) nssv_noexcept // (3)
2159+ nssv_constexpr nonstd::sv_lite::u32string_view operator ""_sv( const char32_t* str, size_t len ) nssv_noexcept // (3)
21602160{
21612161 return nonstd::sv_lite::u32string_view{ str, len };
21622162}
21632163
2164- nssv_constexpr nonstd::sv_lite::wstring_view operator "" _sv( const wchar_t* str, size_t len ) nssv_noexcept // (4)
2164+ nssv_constexpr nonstd::sv_lite::wstring_view operator ""_sv( const wchar_t* str, size_t len ) nssv_noexcept // (4)
21652165{
21662166 return nonstd::sv_lite::wstring_view{ str, len };
21672167}
@@ -2431,7 +2431,7 @@ enum error_code {
24312431 SUCCESS = 0, ///< No error
24322432 CAPACITY, ///< This parser can't support a document that big
24332433 MEMALLOC, ///< Error allocating memory, most likely out of memory
2434- TAPE_ERROR, ///< Something went wrong, this is a generic error
2434+ TAPE_ERROR, ///< Something went wrong, this is a generic error. Fatal/unrecoverable error.
24352435 DEPTH_ERROR, ///< Your document exceeds the user-specified depth limitation
24362436 STRING_ERROR, ///< Problem while parsing a string
24372437 T_ATOM_ERROR, ///< Problem while parsing an atom starting with the letter 't'
@@ -2456,13 +2456,21 @@ enum error_code {
24562456 PARSER_IN_USE, ///< parser is already in use.
24572457 OUT_OF_ORDER_ITERATION, ///< tried to iterate an array or object out of order (checked when SIMDJSON_DEVELOPMENT_CHECKS=1)
24582458 INSUFFICIENT_PADDING, ///< The JSON doesn't have enough padding for simdjson to safely parse it.
2459- INCOMPLETE_ARRAY_OR_OBJECT, ///< The document ends early.
2459+ INCOMPLETE_ARRAY_OR_OBJECT, ///< The document ends early. Fatal/unrecoverable error.
24602460 SCALAR_DOCUMENT_AS_VALUE, ///< A scalar document is treated as a value.
24612461 OUT_OF_BOUNDS, ///< Attempted to access location outside of document.
24622462 TRAILING_CONTENT, ///< Unexpected trailing content in the JSON input
24632463 NUM_ERROR_CODES
24642464};
24652465
2466+ /**
2467+ * Some errors are fatal and invalidate the document. This function returns true if the
2468+ * error is fatal. It returns true for TAPE_ERROR and INCOMPLETE_ARRAY_OR_OBJECT.
2469+ * Once a fatal error is encountered, the on-demand document is no longer valid and
2470+ * processing should stop.
2471+ */
2472+ inline bool is_fatal(error_code error) noexcept;
2473+
24662474/**
24672475 * It is the convention throughout the code that the macro SIMDJSON_DEVELOPMENT_CHECKS determines whether
24682476 * we check for OUT_OF_ORDER_ITERATION. The logic behind it is that these errors only occurs when the code
@@ -2765,14 +2773,30 @@ SIMDJSON_IMPL_CONCEPT(op_append, operator+=)
27652773#undef SIMDJSON_IMPL_CONCEPT
27662774} // namespace details
27672775
2776+
2777+ template <typename T>
2778+ concept string_view_like = std::is_convertible_v<T, std::string_view> &&
2779+ !std::is_convertible_v<T, const char*>;
2780+
2781+ template<typename T>
2782+ concept constructible_from_string_view = std::is_constructible_v<T, std::string_view>
2783+ && !std::is_same_v<T, std::string_view>
2784+ && std::is_default_constructible_v<T>;
2785+
2786+ template<typename M>
2787+ concept string_view_keyed_map = string_view_like<typename M::key_type>
2788+ && requires(std::remove_cvref_t<M>& m, typename M::key_type sv, typename M::mapped_type v) {
2789+ { m.emplace(sv, v) } -> std::same_as<std::pair<typename M::iterator, bool>>;
2790+ };
2791+
27682792/// Check if T is a container that we can append to, including:
27692793/// std::vector, std::deque, std::list, std::string, ...
27702794template <typename T>
27712795concept appendable_containers =
2772- details::supports_emplace_back<T> || details::supports_emplace<T> ||
2796+ ( details::supports_emplace_back<T> || details::supports_emplace<T> ||
27732797 details::supports_push_back<T> || details::supports_push<T> ||
27742798 details::supports_add<T> || details::supports_append<T> ||
2775- details::supports_insert<T>;
2799+ details::supports_insert<T>) && !string_view_keyed_map<T> ;
27762800
27772801/// Insert into the container however possible
27782802template <appendable_containers T, typename... Args>
@@ -2840,6 +2864,8 @@ concept optional_type = requires(std::remove_cvref_t<T> obj) {
28402864 { static_cast<bool>(obj) } -> std::same_as<bool>; // convertible to bool
28412865};
28422866
2867+
2868+
28432869} // namespace concepts
28442870} // namespace simdjson
28452871#endif // SIMDJSON_SUPPORTS_DESERIALIZATION
@@ -4511,6 +4537,11 @@ extern SIMDJSON_DLLIMPORTEXPORT const uint32_t digit_to_val32[886];
45114537#include <iostream>
45124538
45134539namespace simdjson {
4540+
4541+ inline bool is_fatal(error_code error) noexcept {
4542+ return error == TAPE_ERROR || error == INCOMPLETE_ARRAY_OR_OBJECT;
4543+ }
4544+
45144545namespace internal {
45154546 // We store the error code so we can validate the error message is associated with the right code
45164547 struct error_code_info {
@@ -4696,7 +4727,7 @@ namespace internal {
46964727 { SUCCESS, "SUCCESS: No error" },
46974728 { CAPACITY, "CAPACITY: This parser can't support a document that big" },
46984729 { MEMALLOC, "MEMALLOC: Error allocating memory, we're most likely out of memory" },
4699- { TAPE_ERROR, "TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc." },
4730+ { TAPE_ERROR, "TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc. This is a fatal and unrecoverable error. " },
47004731 { DEPTH_ERROR, "DEPTH_ERROR: The JSON document was too deep (too many nested objects and arrays)" },
47014732 { STRING_ERROR, "STRING_ERROR: Problem while parsing a string" },
47024733 { T_ATOM_ERROR, "T_ATOM_ERROR: Problem while parsing an atom starting with the letter 't'" },
@@ -4721,7 +4752,7 @@ namespace internal {
47214752 { PARSER_IN_USE, "PARSER_IN_USE: Cannot parse a new document while a document is still in use." },
47224753 { OUT_OF_ORDER_ITERATION, "OUT_OF_ORDER_ITERATION: Objects and arrays can only be iterated when they are first encountered." },
47234754 { INSUFFICIENT_PADDING, "INSUFFICIENT_PADDING: simdjson requires the input JSON string to have at least SIMDJSON_PADDING extra bytes allocated, beyond the string's length. Consider using the simdjson::padded_string class if needed." },
4724- { INCOMPLETE_ARRAY_OR_OBJECT, "INCOMPLETE_ARRAY_OR_OBJECT: JSON document ended early in the middle of an object or array." },
4755+ { INCOMPLETE_ARRAY_OR_OBJECT, "INCOMPLETE_ARRAY_OR_OBJECT: JSON document ended early in the middle of an object or array. This is a fatal and unrecoverable error. " },
47254756 { SCALAR_DOCUMENT_AS_VALUE, "SCALAR_DOCUMENT_AS_VALUE: A JSON document made of a scalar (number, Boolean, null or string) is treated as a value. Use get_bool(), get_double(), etc. on the document instead. "},
47264757 { OUT_OF_BOUNDS, "OUT_OF_BOUNDS: Attempt to access location outside of document."},
47274758 { TRAILING_CONTENT, "TRAILING_CONTENT: Unexpected trailing content in the JSON input."}
@@ -6787,7 +6818,7 @@ class document {
67876818 * The memory allocation is strict: you
67886819 * can you use this function to increase
67896820 * or lower the amount of allocated memory.
6790- * Passsing zero clears the memory.
6821+ * Passing zero clears the memory.
67916822 */
67926823 error_code allocate(size_t len) noexcept;
67936824 /** @private Capacity in bytes, in terms
@@ -9185,7 +9216,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
91859216 // floor(log(5**power)/log(2))
91869217 //
91879218 // Note that this is not magic: 152170/(1<<16) is
9188- // approximatively equal to log(5)/log(2).
9219+ // approximately equal to log(5)/log(2).
91899220 // The 1<<16 value is a power of two; we could use a
91909221 // larger power of 2 if we wanted to.
91919222 //
@@ -15545,7 +15576,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
1554515576 // floor(log(5**power)/log(2))
1554615577 //
1554715578 // Note that this is not magic: 152170/(1<<16) is
15548- // approximatively equal to log(5)/log(2).
15579+ // approximately equal to log(5)/log(2).
1554915580 // The 1<<16 value is a power of two; we could use a
1555015581 // larger power of 2 if we wanted to.
1555115582 //
@@ -21769,7 +21800,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
2176921800 // floor(log(5**power)/log(2))
2177021801 //
2177121802 // Note that this is not magic: 152170/(1<<16) is
21772- // approximatively equal to log(5)/log(2).
21803+ // approximately equal to log(5)/log(2).
2177321804 // The 1<<16 value is a power of two; we could use a
2177421805 // larger power of 2 if we wanted to.
2177521806 //
@@ -28149,7 +28180,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
2814928180 // floor(log(5**power)/log(2))
2815028181 //
2815128182 // Note that this is not magic: 152170/(1<<16) is
28152- // approximatively equal to log(5)/log(2).
28183+ // approximately equal to log(5)/log(2).
2815328184 // The 1<<16 value is a power of two; we could use a
2815428185 // larger power of 2 if we wanted to.
2815528186 //
@@ -34891,7 +34922,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
3489134922 // floor(log(5**power)/log(2))
3489234923 //
3489334924 // Note that this is not magic: 152170/(1<<16) is
34894- // approximatively equal to log(5)/log(2).
34925+ // approximately equal to log(5)/log(2).
3489534926 // The 1<<16 value is a power of two; we could use a
3489634927 // larger power of 2 if we wanted to.
3489734928 //
@@ -41457,7 +41488,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
4145741488 // floor(log(5**power)/log(2))
4145841489 //
4145941490 // Note that this is not magic: 152170/(1<<16) is
41460- // approximatively equal to log(5)/log(2).
41491+ // approximately equal to log(5)/log(2).
4146141492 // The 1<<16 value is a power of two; we could use a
4146241493 // larger power of 2 if we wanted to.
4146341494 //
@@ -47468,7 +47499,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
4746847499 // floor(log(5**power)/log(2))
4746947500 //
4747047501 // Note that this is not magic: 152170/(1<<16) is
47471- // approximatively equal to log(5)/log(2).
47502+ // approximately equal to log(5)/log(2).
4747247503 // The 1<<16 value is a power of two; we could use a
4747347504 // larger power of 2 if we wanted to.
4747447505 //
@@ -53078,7 +53109,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
5307853109 // floor(log(5**power)/log(2))
5307953110 //
5308053111 // Note that this is not magic: 152170/(1<<16) is
53081- // approximatively equal to log(5)/log(2).
53112+ // approximately equal to log(5)/log(2).
5308253113 // The 1<<16 value is a power of two; we could use a
5308353114 // larger power of 2 if we wanted to.
5308453115 //
0 commit comments