Skip to content

Commit 15e0be6

Browse files
committed
Upgrade Sourcemeta Core to the latest version
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent c7bb7f4 commit 15e0be6

File tree

222 files changed

+1388
-966
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+1388
-966
lines changed

DEPENDENCIES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
vendorpull https://github.com/sourcemeta/vendorpull 70342aaf458e6cb80baeb5b718901075fc42ede6
2-
core https://github.com/sourcemeta/core 918a17d1e4f82a12334bf99d67ffef4e77fd6722
2+
core https://github.com/sourcemeta/core 87f9621d7167b2d566de038f88bbaf767d188223
33
bootstrap https://github.com/twbs/bootstrap 1a6fdfae6be09b09eaced8f0e442ca6f7680a61e

config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if(NOT JSONBINPACK_COMPONENTS)
1010
endif()
1111

1212
include(CMakeFindDependencyMacro)
13-
find_dependency(Core COMPONENTS uri json jsonpointer jsonschema alterschema)
13+
find_dependency(Core COMPONENTS regex uri json jsonpointer jsonschema alterschema)
1414

1515
foreach(component ${JSONBINPACK_COMPONENTS})
1616
if(component STREQUAL "numeric")

src/compiler/compiler.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ auto canonicalize(sourcemeta::core::JSON &schema,
2727
sourcemeta::core::empty_pointer, default_dialect);
2828
}
2929

30-
auto make_encoding(sourcemeta::core::PointerProxy &document,
30+
auto make_encoding(sourcemeta::core::JSON &document,
3131
const std::string &encoding,
3232
const sourcemeta::core::JSON &options) -> void {
33-
document.replace(sourcemeta::core::JSON::make_object());
33+
document.into_object();
3434
document.assign("$schema", sourcemeta::core::JSON{ENCODING_V1});
3535
document.assign("binpackEncoding", sourcemeta::core::JSON{encoding});
3636
document.assign("binpackOptions", options);
@@ -87,8 +87,7 @@ auto compile(sourcemeta::core::JSON &schema,
8787
// The "any" encoding is always the last resort
8888
const auto dialect{sourcemeta::core::dialect(schema)};
8989
if (!dialect.has_value() || dialect.value() != ENCODING_V1) {
90-
sourcemeta::core::PointerProxy transformer{schema};
91-
make_encoding(transformer, "ANY_PACKED_TYPE_TAG_BYTE_PREFIX",
90+
make_encoding(schema, "ANY_PACKED_TYPE_TAG_BYTE_PREFIX",
9291
sourcemeta::core::JSON::make_object());
9392
}
9493
}

src/compiler/mapper/enum_8_bit.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ class Enum8Bit final : public sourcemeta::core::SchemaTransformRule {
1616
is_byte(schema.at("enum").size() - 1);
1717
}
1818

19-
auto transform(sourcemeta::core::PointerProxy &transformer) const
20-
-> void override {
19+
auto transform(sourcemeta::core::JSON &schema) const -> void override {
2120
auto options = sourcemeta::core::JSON::make_object();
22-
options.assign("choices", transformer.value().at("enum"));
23-
make_encoding(transformer, "BYTE_CHOICE_INDEX", options);
21+
options.assign("choices", schema.at("enum"));
22+
make_encoding(schema, "BYTE_CHOICE_INDEX", options);
2423
}
2524
};

src/compiler/mapper/enum_8_bit_top_level.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ class Enum8BitTopLevel final : public sourcemeta::core::SchemaTransformRule {
1616
is_byte(schema.at("enum").size() - 1);
1717
}
1818

19-
auto transform(sourcemeta::core::PointerProxy &transformer) const
20-
-> void override {
19+
auto transform(sourcemeta::core::JSON &schema) const -> void override {
2120
auto options = sourcemeta::core::JSON::make_object();
22-
options.assign("choices", transformer.value().at("enum"));
23-
make_encoding(transformer, "TOP_LEVEL_BYTE_CHOICE_INDEX", options);
21+
options.assign("choices", schema.at("enum"));
22+
make_encoding(schema, "TOP_LEVEL_BYTE_CHOICE_INDEX", options);
2423
}
2524
};

src/compiler/mapper/enum_arbitrary.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ class EnumArbitrary final : public sourcemeta::core::SchemaTransformRule {
1717
!is_byte(schema.at("enum").size() - 1);
1818
}
1919

20-
auto transform(sourcemeta::core::PointerProxy &transformer) const
21-
-> void override {
20+
auto transform(sourcemeta::core::JSON &schema) const -> void override {
2221
auto options = sourcemeta::core::JSON::make_object();
23-
options.assign("choices", transformer.value().at("enum"));
24-
make_encoding(transformer, "LARGE_CHOICE_INDEX", options);
22+
options.assign("choices", schema.at("enum"));
23+
make_encoding(schema, "LARGE_CHOICE_INDEX", options);
2524
}
2625
};

src/compiler/mapper/enum_singleton.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ class EnumSingleton final : public sourcemeta::core::SchemaTransformRule {
1515
schema.at("enum").size() == 1;
1616
}
1717

18-
auto transform(sourcemeta::core::PointerProxy &transformer) const
19-
-> void override {
18+
auto transform(sourcemeta::core::JSON &schema) const -> void override {
2019
auto options = sourcemeta::core::JSON::make_object();
21-
options.assign("value", transformer.value().at("enum").at(0));
22-
make_encoding(transformer, "CONST_NONE", options);
20+
options.assign("value", schema.at("enum").at(0));
21+
make_encoding(schema, "CONST_NONE", options);
2322
}
2423
};

src/compiler/mapper/integer_bounded_8_bit.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ class IntegerBounded8Bit final : public sourcemeta::core::SchemaTransformRule {
1919
!schema.defines("multipleOf");
2020
}
2121

22-
auto transform(sourcemeta::core::PointerProxy &transformer) const
23-
-> void override {
24-
auto minimum = transformer.value().at("minimum");
25-
auto maximum = transformer.value().at("maximum");
22+
auto transform(sourcemeta::core::JSON &schema) const -> void override {
23+
auto minimum = schema.at("minimum");
24+
auto maximum = schema.at("maximum");
2625
auto options = sourcemeta::core::JSON::make_object();
2726
options.assign("minimum", std::move(minimum));
2827
options.assign("maximum", std::move(maximum));
2928
options.assign("multiplier", sourcemeta::core::JSON{1});
30-
make_encoding(transformer, "BOUNDED_MULTIPLE_8BITS_ENUM_FIXED", options);
29+
make_encoding(schema, "BOUNDED_MULTIPLE_8BITS_ENUM_FIXED", options);
3130
}
3231
};

src/compiler/mapper/integer_bounded_greater_than_8_bit.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ class IntegerBoundedGreaterThan8Bit final
2121
!schema.defines("multipleOf");
2222
}
2323

24-
auto transform(sourcemeta::core::PointerProxy &transformer) const
25-
-> void override {
26-
auto minimum = transformer.value().at("minimum");
24+
auto transform(sourcemeta::core::JSON &schema) const -> void override {
25+
auto minimum = schema.at("minimum");
2726
auto options = sourcemeta::core::JSON::make_object();
2827
options.assign("minimum", std::move(minimum));
2928
options.assign("multiplier", sourcemeta::core::JSON{1});
30-
make_encoding(transformer, "FLOOR_MULTIPLE_ENUM_VARINT", options);
29+
make_encoding(schema, "FLOOR_MULTIPLE_ENUM_VARINT", options);
3130
}
3231
};

src/compiler/mapper/integer_bounded_multiplier_8_bit.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@ class IntegerBoundedMultiplier8Bit final
2626
schema.at("multipleOf").to_integer()));
2727
}
2828

29-
auto transform(sourcemeta::core::PointerProxy &transformer) const
30-
-> void override {
31-
auto minimum = transformer.value().at("minimum");
32-
auto maximum = transformer.value().at("maximum");
33-
auto multiplier = transformer.value().at("multipleOf");
29+
auto transform(sourcemeta::core::JSON &schema) const -> void override {
30+
auto minimum = schema.at("minimum");
31+
auto maximum = schema.at("maximum");
32+
auto multiplier = schema.at("multipleOf");
3433

3534
auto options = sourcemeta::core::JSON::make_object();
3635
options.assign("minimum", std::move(minimum));
3736
options.assign("maximum", std::move(maximum));
3837
options.assign("multiplier", std::move(multiplier));
39-
make_encoding(transformer, "BOUNDED_MULTIPLE_8BITS_ENUM_FIXED", options);
38+
make_encoding(schema, "BOUNDED_MULTIPLE_8BITS_ENUM_FIXED", options);
4039
}
4140
};

0 commit comments

Comments
 (0)