Everywhere: Make the project compile again
std::format seems to finally have been implemented in the STL, which is ambiguous with ruc::format even without ever including <format>.
This commit is contained in:
+1
-1
@@ -182,7 +182,7 @@ ValuePtr HashMap::get(ValuePtr key)
|
||||
std::string HashMap::getKeyString(ValuePtr key)
|
||||
{
|
||||
if (!is<String>(key.get()) && !is<Keyword>(key.get())) {
|
||||
Error::the().add(format("wrong argument type: string or keyword, {}", key));
|
||||
Error::the().add(::format("wrong argument type: string or keyword, {}", key));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -39,7 +39,7 @@ EnvironmentPtr Environment::create(const ValuePtr lambda, const ValueVector& arg
|
||||
for (size_t i = 0; i < bindings.size(); ++i, ++it) {
|
||||
if (bindings[i] == "&") {
|
||||
if (i + 2 != bindings.size()) {
|
||||
Error::the().add(format("invalid function: {}", lambda));
|
||||
Error::the().add(::format("invalid function: {}", lambda));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ EnvironmentPtr Environment::create(const ValuePtr lambda, const ValueVector& arg
|
||||
}
|
||||
|
||||
if (it == arguments.end()) {
|
||||
Error::the().add(format("wrong number of arguments: {}, {}", lambda, arguments.size()));
|
||||
Error::the().add(::format("wrong number of arguments: {}, {}", lambda, arguments.size()));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ EnvironmentPtr Environment::create(const ValuePtr lambda, const ValueVector& arg
|
||||
}
|
||||
|
||||
if (it != arguments.end()) {
|
||||
Error::the().add(format("wrong number of arguments: {}, {}", lambda, arguments.size()));
|
||||
Error::the().add(::format("wrong number of arguments: {}, {}", lambda, arguments.size()));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ ValuePtr Eval::evalAst(ValuePtr ast, EnvironmentPtr env)
|
||||
if (is<Symbol>(ast_raw_ptr)) {
|
||||
auto result = env->get(std::static_pointer_cast<Symbol>(ast)->symbol());
|
||||
if (!result) {
|
||||
Error::the().add(format("'{}' not found", ast));
|
||||
Error::the().add(::format("'{}' not found", ast));
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
@@ -245,7 +245,7 @@ ValuePtr Eval::apply(std::shared_ptr<List> evaluated_list)
|
||||
auto nodes = evaluated_list->nodes();
|
||||
|
||||
if (!is<Function>(nodes.front().get())) {
|
||||
Error::the().add(format("invalid function: {}", nodes.front()));
|
||||
Error::the().add(::format("invalid function: {}", nodes.front()));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
+18
-18
@@ -181,7 +181,7 @@ ADD_FUNCTION(
|
||||
result = std::static_pointer_cast<Collection>(*begin)->size();
|
||||
}
|
||||
else {
|
||||
Error::the().add(format("wrong argument type: Collection, '{}'", *begin));
|
||||
Error::the().add(::format("wrong argument type: Collection, '{}'", *begin));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -191,20 +191,20 @@ ADD_FUNCTION(
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
#define PRINTER_STRING(print_readably, concatenation) \
|
||||
{ \
|
||||
std::string result; \
|
||||
\
|
||||
Printer printer; \
|
||||
for (auto it = begin; it != end; ++it) { \
|
||||
result += format("{}", printer.printNoErrorCheck(*it, print_readably)); \
|
||||
\
|
||||
if (it != end && std::next(it) != end) { \
|
||||
result += concatenation; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return makePtr<String>(result); \
|
||||
#define PRINTER_STRING(print_readably, concatenation) \
|
||||
{ \
|
||||
std::string result; \
|
||||
\
|
||||
Printer printer; \
|
||||
for (auto it = begin; it != end; ++it) { \
|
||||
result += ::format("{}", printer.printNoErrorCheck(*it, print_readably)); \
|
||||
\
|
||||
if (it != end && std::next(it) != end) { \
|
||||
result += concatenation; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return makePtr<String>(result); \
|
||||
}
|
||||
|
||||
ADD_FUNCTION("str", PRINTER_STRING(false, ""));
|
||||
@@ -869,7 +869,7 @@ ADD_FUNCTION(
|
||||
if (!is<Collection>(front_raw_ptr) && // List / Vector
|
||||
!is<HashMap>(front_raw_ptr) && // HashMap
|
||||
!is<Callable>(front_raw_ptr)) { // Function / Lambda
|
||||
Error::the().add(format("wrong argument type: Collection, HashMap or Callable, {}", front));
|
||||
Error::the().add(::format("wrong argument type: Collection, HashMap or Callable, {}", front));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ ADD_FUNCTION(
|
||||
if (!is<Collection>(front_raw_ptr) && // List / Vector
|
||||
!is<HashMap>(front_raw_ptr) && // HashMap
|
||||
!is<Callable>(front_raw_ptr)) { // Function / Lambda
|
||||
Error::the().add(format("wrong argument type: Collection, HashMap or Callable, {}", front));
|
||||
Error::the().add(::format("wrong argument type: Collection, HashMap or Callable, {}", front));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -968,7 +968,7 @@ ADD_FUNCTION(
|
||||
return result;
|
||||
}
|
||||
|
||||
Error::the().add(format("wrong argument type: Collection or String, {}", front));
|
||||
Error::the().add(::format("wrong argument type: Collection or String, {}", front));
|
||||
|
||||
return nullptr;
|
||||
});
|
||||
|
||||
+12
-12
@@ -90,7 +90,7 @@ void Printer::printImpl(ValuePtr node, bool print_readably)
|
||||
m_previous_node_is_list = true;
|
||||
auto elements = std::static_pointer_cast<HashMap>(node)->elements();
|
||||
for (auto it = elements.begin(); it != elements.end(); ++it) {
|
||||
m_print += format("{} ", (it->first.front() == 0x7f) ? ":" + it->first.substr(1) : '"' + it->first + '"'); // 127
|
||||
m_print += ::format("{} ", (it->first.front() == 0x7f) ? ":" + it->first.substr(1) : '"' + it->first + '"'); // 127
|
||||
printImpl(it->second, print_readably);
|
||||
|
||||
if (!isLast(it, elements)) {
|
||||
@@ -109,15 +109,15 @@ void Printer::printImpl(ValuePtr node, bool print_readably)
|
||||
text = "\"" + text + "\"";
|
||||
}
|
||||
printSpacing();
|
||||
m_print += format("{}", text);
|
||||
m_print += ::format("{}", text);
|
||||
}
|
||||
else if (is<Keyword>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
m_print += format(":{}", std::static_pointer_cast<Keyword>(node)->keyword().substr(1));
|
||||
m_print += ::format(":{}", std::static_pointer_cast<Keyword>(node)->keyword().substr(1));
|
||||
}
|
||||
else if (is<Number>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
m_print += format("{}", std::static_pointer_cast<Number>(node)->number());
|
||||
m_print += ::format("{}", std::static_pointer_cast<Number>(node)->number());
|
||||
}
|
||||
else if (is<Constant>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
@@ -127,23 +127,23 @@ void Printer::printImpl(ValuePtr node, bool print_readably)
|
||||
case Constant::True: value = "true"; break;
|
||||
case Constant::False: value = "false"; break;
|
||||
}
|
||||
m_print += format("{}", value);
|
||||
m_print += ::format("{}", value);
|
||||
}
|
||||
else if (is<Symbol>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
m_print += format("{}", std::static_pointer_cast<Symbol>(node)->symbol());
|
||||
m_print += ::format("{}", std::static_pointer_cast<Symbol>(node)->symbol());
|
||||
}
|
||||
else if (is<Function>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
m_print += format("#<builtin-function>({})", std::static_pointer_cast<Function>(node)->name());
|
||||
m_print += ::format("#<builtin-function>({})", std::static_pointer_cast<Function>(node)->name());
|
||||
}
|
||||
else if (is<Lambda>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
m_print += format("#<user-function>({:p})", node_raw_ptr);
|
||||
m_print += ::format("#<user-function>({:p})", node_raw_ptr);
|
||||
}
|
||||
else if (is<Macro>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
m_print += format("#<user-macro>({:p})", node_raw_ptr);
|
||||
m_print += ::format("#<user-macro>({:p})", node_raw_ptr);
|
||||
}
|
||||
else if (is<Atom>(node_raw_ptr)) {
|
||||
printSpacing();
|
||||
@@ -158,15 +158,15 @@ void Printer::printError()
|
||||
m_print = "Error: ";
|
||||
if (Error::the().hasTokenError()) {
|
||||
Token error = Error::the().tokenError();
|
||||
m_print += format("{}", error.symbol);
|
||||
m_print += ::format("{}", error.symbol);
|
||||
}
|
||||
else if (Error::the().hasOtherError()) {
|
||||
std::string error = Error::the().otherError();
|
||||
m_print += format("{}", error);
|
||||
m_print += ::format("{}", error);
|
||||
}
|
||||
else if (Error::the().hasException()) {
|
||||
ValuePtr error = Error::the().exception();
|
||||
m_print += format("{}", error);
|
||||
m_print += ::format("{}", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ ValuePtr Reader::readHashMap()
|
||||
}
|
||||
|
||||
if (!is<String>(key.get()) && !is<Keyword>(key.get())) {
|
||||
Error::the().add(format("wrong argument type: string or keyword, {}", key));
|
||||
Error::the().add(::format("wrong argument type: string or keyword, {}", key));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
+20
-20
@@ -34,10 +34,10 @@
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
#define CHECK_ARG_COUNT_IS_IMPL(name, size, expected, result) \
|
||||
if (size != expected) { \
|
||||
Error::the().add(format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
#define CHECK_ARG_COUNT_IS_IMPL(name, size, expected, result) \
|
||||
if (size != expected) { \
|
||||
Error::the().add(::format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define CHECK_ARG_COUNT_IS_3(name, size, expected) \
|
||||
@@ -52,10 +52,10 @@
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
#define CHECK_ARG_COUNT_AT_LEAST_IMPL(name, size, min, result) \
|
||||
if (size < min) { \
|
||||
Error::the().add(format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
#define CHECK_ARG_COUNT_AT_LEAST_IMPL(name, size, min, result) \
|
||||
if (size < min) { \
|
||||
Error::the().add(::format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define CHECK_ARG_COUNT_AT_LEAST_3(name, size, min) \
|
||||
@@ -70,10 +70,10 @@
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
#define CHECK_ARG_COUNT_BETWEEN_IMPL(name, size, min, max, result) \
|
||||
if (size < min || size > max) { \
|
||||
Error::the().add(format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
#define CHECK_ARG_COUNT_BETWEEN_IMPL(name, size, min, max, result) \
|
||||
if (size < min || size > max) { \
|
||||
Error::the().add(::format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define CHECK_ARG_COUNT_BETWEEN_4(name, size, min, max) \
|
||||
@@ -88,10 +88,10 @@
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
#define CHECK_ARG_COUNT_EVEN_IMPL(name, size, result) \
|
||||
if (size % 2 != 0) { \
|
||||
Error::the().add(format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
#define CHECK_ARG_COUNT_EVEN_IMPL(name, size, result) \
|
||||
if (size % 2 != 0) { \
|
||||
Error::the().add(::format("wrong number of arguments: {}, {}", name, size)); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define CHECK_ARG_COUNT_EVEN_2(name, size) \
|
||||
@@ -106,10 +106,10 @@
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
#define IS_VALUE_IMPL(type, value, result) \
|
||||
if (!is<type>(value.get())) { \
|
||||
Error::the().add(format("wrong argument type: {}, {}", #type, value)); \
|
||||
return result; \
|
||||
#define IS_VALUE_IMPL(type, value, result) \
|
||||
if (!is<type>(value.get())) { \
|
||||
Error::the().add(::format("wrong argument type: {}, {}", #type, value)); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define IS_VALUE_2(type, value) \
|
||||
|
||||
Reference in New Issue
Block a user