-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce API surface of compiler module (#745)
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
36 changed files
with
768 additions
and
1,210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <sourcemeta/jsonbinpack/compiler.h> | ||
|
||
#include "canonicalizer.h" | ||
#include "mapper.h" | ||
|
||
namespace sourcemeta::jsonbinpack { | ||
|
||
auto compile(sourcemeta::jsontoolkit::JSON &schema, | ||
const sourcemeta::jsontoolkit::SchemaWalker &walker, | ||
const sourcemeta::jsontoolkit::SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect) -> void { | ||
canonicalize(schema, walker, resolver, default_dialect); | ||
map(schema, walker, resolver, default_dialect); | ||
} | ||
|
||
auto canonicalize(sourcemeta::jsontoolkit::JSON &schema, | ||
const sourcemeta::jsontoolkit::SchemaWalker &walker, | ||
const sourcemeta::jsontoolkit::SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect) -> void { | ||
static sourcemeta::jsonbinpack::Canonicalizer canonicalizer; | ||
canonicalizer.apply(schema, walker, resolver, default_dialect); | ||
} | ||
|
||
auto map(sourcemeta::jsontoolkit::JSON &schema, | ||
const sourcemeta::jsontoolkit::SchemaWalker &walker, | ||
const sourcemeta::jsontoolkit::SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect) -> void { | ||
static sourcemeta::jsonbinpack::Mapper mapper; | ||
mapper.apply(schema, walker, resolver, default_dialect); | ||
} | ||
|
||
} // namespace sourcemeta::jsonbinpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
#ifndef SOURCEMETA_JSONBINPACK_COMPILER_H_ | ||
#define SOURCEMETA_JSONBINPACK_COMPILER_H_ | ||
|
||
#include <sourcemeta/jsonbinpack/compiler_canonicalizer.h> | ||
#include <sourcemeta/jsonbinpack/compiler_mapper.h> | ||
#include <sourcemeta/jsontoolkit/json.h> | ||
#include <sourcemeta/jsontoolkit/jsonschema.h> | ||
|
||
#include <optional> // std::optional | ||
#include <string> // std::string | ||
|
||
namespace sourcemeta::jsonbinpack { | ||
|
||
auto compile(sourcemeta::jsontoolkit::JSON &schema, | ||
const sourcemeta::jsontoolkit::SchemaWalker &walker, | ||
const sourcemeta::jsontoolkit::SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect = std::nullopt) | ||
-> void; | ||
|
||
auto canonicalize( | ||
sourcemeta::jsontoolkit::JSON &schema, | ||
const sourcemeta::jsontoolkit::SchemaWalker &walker, | ||
const sourcemeta::jsontoolkit::SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect = std::nullopt) -> void; | ||
|
||
// TODO: Rename to plan()? | ||
auto map(sourcemeta::jsontoolkit::JSON &schema, | ||
const sourcemeta::jsontoolkit::SchemaWalker &walker, | ||
const sourcemeta::jsontoolkit::SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect = std::nullopt) | ||
-> void; | ||
|
||
} // namespace sourcemeta::jsonbinpack | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.