Merge branch 'pboettch:main' into fix-multiple-of-float

This commit is contained in:
dhmemi 2023-11-14 14:27:44 +08:00 committed by GitHub
commit 7d84d546f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 28 deletions

View File

@ -80,26 +80,28 @@ endif ()
]==============================================================================================]
set(fetch_packages "")
# Fetch/Find nlohmann_json
# TODO: Remove when bumping cmake >= 3.24
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG ${JSON_FETCH_VERSION}
FIND_PACKAGE_ARGS
)
list(APPEND fetch_packages nlohmann_json)
else ()
# Try to get system installed version
find_package(nlohmann_json QUIET)
if (NOT nlohmann_json_FOUND)
# If failed fetch the desired version
FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG ${JSON_FETCH_VERSION}
)
list(APPEND fetch_packages nlohmann_json)
endif ()
if (NOT TARGET nlohmann_json)
# Fetch/Find nlohmann_json
# TODO: Remove when bumping cmake >= 3.24
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG ${JSON_FETCH_VERSION}
FIND_PACKAGE_ARGS
)
list(APPEND fetch_packages nlohmann_json)
else ()
# Try to get system installed version
find_package(nlohmann_json QUIET)
if (NOT nlohmann_json_FOUND)
# If failed fetch the desired version
FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG ${JSON_FETCH_VERSION}
)
list(APPEND fetch_packages nlohmann_json)
endif ()
endif ()
endif ()
# Handle configure flags

View File

@ -74,7 +74,7 @@ types, depending on if the schema type is "integer" or "number". Bignum
This library is based on Niels Lohmann's JSON-library and thus has
a build-dependency to it.
Currently at least version **3.6.0** of NLohmann's JSON library
Currently at least version **3.8.0** of NLohmann's JSON library
is required.
Various methods using CMake can be used to build this project.

View File

@ -28,10 +28,13 @@ public:
json_patch &replace(const json::json_pointer &, json value);
json_patch &remove(const json::json_pointer &);
json &get_json() { return j_; }
const json &get_json() const { return j_; }
operator json() const { return j_; }
private:
json j_;
json j_ = nlohmann::json::array();
static void validateJsonPatch(json const &patch);
};

View File

@ -436,12 +436,12 @@ class logical_combination : public schema
for (auto &s : subschemata_) {
first_error_handler esub;
json_patch old_patch(patch);
auto oldPatchSize = patch.get_json().size();
s->validate(ptr, instance, patch, esub);
if (!esub)
count++;
else
patch = old_patch;
patch.get_json().get_ref<nlohmann::json::array_t &>().resize(oldPatchSize);
if (is_validate_complete(instance, ptr, e, esub, count))
return;

View File

@ -669,10 +669,6 @@ static const short _address_eof_trans[] = {
1278, 1279, 1280, 1281, 1282, 1283, 0};
static const int address_start = 1;
static const int address_first_final = 196;
static const int address_error = 0;
static const int address_en_main = 1;
bool is_address(const char *p, const char *pe)
{