From d5963532328ce5f1c9f266bf7e760b7d18a60c15 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Mon, 23 Jun 2025 16:28:11 +0100 Subject: various updates --- nihil.ucl/error.ccm | 5 +---- nihil.ucl/map.ccm | 3 ++- nihil.ucl/nihil.ucl.ccm | 1 + nihil.ucl/parser.ccm | 8 ++------ nihil.ucl/type.ccm | 6 ++++-- 5 files changed, 10 insertions(+), 13 deletions(-) (limited to 'nihil.ucl') diff --git a/nihil.ucl/error.ccm b/nihil.ucl/error.ccm index 4eda774..c6a0f2d 100644 --- a/nihil.ucl/error.ccm +++ b/nihil.ucl/error.ccm @@ -17,10 +17,7 @@ namespace nihil::ucl { * Exception thrown when an issue occurs with UCL. */ export struct error : generic_error { - template - error(std::format_string fmt, Args &&...args) - : generic_error(fmt, std::forward(args)...) - {} + error(std::string what) : generic_error(std::move(what)) {} }; } // namespace nihil::ucl diff --git a/nihil.ucl/map.ccm b/nihil.ucl/map.ccm index c140885..434659b 100644 --- a/nihil.ucl/map.ccm +++ b/nihil.ucl/map.ccm @@ -7,6 +7,7 @@ module; #include #include #include +#include #include #include #include @@ -22,7 +23,7 @@ namespace nihil::ucl { // Exception thrown when map::operator[] does not find the key. export struct key_not_found : error { key_not_found(std::string_view key) - : error("key '{}' not found in map", key) + : error(std::format("key '{}' not found in map", key)) , _key(key) {} diff --git a/nihil.ucl/nihil.ucl.ccm b/nihil.ucl/nihil.ucl.ccm index 66e2c2b..9c2ea88 100644 --- a/nihil.ucl/nihil.ucl.ccm +++ b/nihil.ucl/nihil.ucl.ccm @@ -7,6 +7,7 @@ module; export module nihil.ucl; export import :emit; +export import :error; export import :object; export import :object_cast; export import :parser; diff --git a/nihil.ucl/parser.ccm b/nihil.ucl/parser.ccm index 8e715d0..9b87773 100644 --- a/nihil.ucl/parser.ccm +++ b/nihil.ucl/parser.ccm @@ -25,10 +25,7 @@ namespace nihil::ucl { * Exception thrown when an issue occurs parsing UCL. */ export struct parse_error : error { - template - parse_error(std::format_string fmt, Args &&...args) - : error(fmt, std::forward(args)...) - {} + parse_error(std::string what) : error(std::move(what)) {} }; // UCL parser flags. @@ -124,8 +121,7 @@ export struct parser { auto ret = ::ucl_parser_add_chunk(self._parser, dptr, std::ranges::size(data)); if (ret == false) - throw parse_error("{}", - ::ucl_parser_get_error(self._parser)); + throw parse_error(::ucl_parser_get_error(self._parser)); } auto add(this parser &self, std::ranges::range auto &&data) diff --git a/nihil.ucl/type.ccm b/nihil.ucl/type.ccm index 5050e7a..bf6c6bc 100644 --- a/nihil.ucl/type.ccm +++ b/nihil.ucl/type.ccm @@ -5,6 +5,7 @@ module; #include +#include #include #include @@ -69,8 +70,9 @@ concept datatype = requires(T o) { // Exception thrown when a type assertion fails. export struct type_mismatch : error { type_mismatch(object_type expected_type, object_type actual_type) - : error("UCL type mismatch: expected type '{}' != actual type '{}'", - str(expected_type), str(actual_type)) + : error(std::format("UCL type mismatch: expected type '{}' " + "!= actual type '{}'", + str(expected_type), str(actual_type))) , _expected_type(expected_type) , _actual_type(actual_type) {} -- cgit v1.2.3