Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Nodal_diffusion
  • develop
  • feature/Navier-Stokes
  • feature/Nodal_diffusion
  • feature/composite-scheme
  • feature/composite-scheme-other-fluxes
  • feature/composite-scheme-sources
  • feature/coupling_module
  • feature/discontinuous-galerkin
  • feature/escobar-smoother
  • feature/explicit-gp-cfl
  • feature/gks
  • feature/gmsh-reader
  • feature/hypoelasticity
  • feature/hypoelasticity-clean
  • feature/implicit-solver
  • feature/implicit-solver-o2
  • feature/kinetic-schemes
  • feature/local-dt-fsi
  • feature/merge-local-dt-fsi
  • feature/polynomials
  • feature/reconstruction
  • feature/serraille
  • feature/variational-hydro
  • hyperplastic
  • master
  • navier-stokes
  • origin/stage/bouguettaia
  • save_clemence
  • test/voronoi1d
  • Kidder
  • v0
  • v0.0.1
  • v0.0.2
  • v0.0.3
  • v0.0.4
  • v0.1.0
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.4.1
  • v0.5.0
42 results

Target

Select target project
  • code/pugs
1 result
Select Git revision
Loading items
Show changes

Commits on Source 2

Showing
with 235 additions and 645 deletions
......@@ -4,7 +4,6 @@
#include <language/ast/ASTNodeDataTypeFlattener.hpp>
#include <language/node_processor/BuiltinFunctionProcessor.hpp>
#include <language/utils/ASTNodeNaturalConversionChecker.hpp>
#include <language/utils/BuiltinFunctionEmbedderUtils.hpp>
#include <language/utils/ParseError.hpp>
#include <language/utils/SymbolTable.hpp>
......@@ -495,8 +494,7 @@ ASTNodeBuiltinFunctionExpressionBuilder::_buildArgumentProcessors(
if (arguments_number != parameters_number) {
std::ostringstream error_message;
error_message << "bad number of arguments: expecting " << rang::fgB::yellow << parameters_number
<< rang::style::reset << rang::style::bold << ", provided " << rang::fgB::yellow << arguments_number
<< rang::style::reset;
<< rang::style::reset << ", provided " << rang::fgB::yellow << arguments_number << rang::style::reset;
throw ParseError(error_message.str(), argument_nodes.begin());
}
......@@ -507,9 +505,14 @@ ASTNodeBuiltinFunctionExpressionBuilder::_buildArgumentProcessors(
ASTNodeBuiltinFunctionExpressionBuilder::ASTNodeBuiltinFunctionExpressionBuilder(ASTNode& node)
{
Assert(node.children[0]->m_data_type == ASTNodeDataType::builtin_function_t);
auto [i_function_symbol, found] = node.m_symbol_table->find(node.children[0]->string(), node.begin());
Assert(found);
Assert(i_function_symbol->attributes().dataType() == ASTNodeDataType::builtin_function_t);
std::shared_ptr builtin_function_embedder = getBuiltinFunctionEmbedder(node);
uint64_t builtin_function_id = std::get<uint64_t>(i_function_symbol->attributes().value());
auto& builtin_function_embedder_table = node.m_symbol_table->builtinFunctionEmbedderTable();
std::shared_ptr builtin_function_embedder = builtin_function_embedder_table[builtin_function_id];
std::vector<ASTNodeDataType> builtin_function_parameter_type_list =
builtin_function_embedder->getParameterDataTypes();
......
......@@ -3,7 +3,6 @@
#include <language/PEGGrammar.hpp>
#include <language/utils/ASTNodeNaturalConversionChecker.hpp>
#include <language/utils/BuiltinFunctionEmbedder.hpp>
#include <language/utils/BuiltinFunctionEmbedderUtils.hpp>
#include <language/utils/OperatorRepository.hpp>
#include <language/utils/ParseError.hpp>
#include <language/utils/SymbolTable.hpp>
......@@ -285,13 +284,8 @@ ASTNodeDataTypeBuilder::_buildNodeDataTypes(ASTNode& n) const
std::shared_ptr<SymbolTable>& symbol_table = n.m_symbol_table;
auto [i_symbol, found] = symbol_table->find(n.string(), n.begin());
if (found) {
Assert(found);
n.m_data_type = i_symbol->attributes().dataType();
} else if (symbol_table->has(n.string(), n.begin())) {
n.m_data_type = ASTNodeDataType::build<ASTNodeDataType::builtin_function_t>();
} else {
throw UnexpectedError("could not find symbol " + n.string());
}
}
}
for (auto& child : n.children) {
......@@ -528,7 +522,15 @@ ASTNodeDataTypeBuilder::_buildNodeDataTypes(ASTNode& n) const
n.m_data_type = image_domain_node.m_data_type.contentType();
} else if (n.children[0]->m_data_type == ASTNodeDataType::builtin_function_t) {
auto builtin_function_embedder = getBuiltinFunctionEmbedder(n);
const std::string builtin_function_name = n.children[0]->string();
auto& symbol_table = *n.m_symbol_table;
auto [i_symbol, success] = symbol_table.find(builtin_function_name, n.begin());
Assert(success);
uint64_t builtin_function_id = std::get<uint64_t>(i_symbol->attributes().value());
auto builtin_function_embedder = symbol_table.builtinFunctionEmbedderTable()[builtin_function_id];
Assert(builtin_function_embedder);
n.m_data_type = builtin_function_embedder->getReturnDataType();
} else {
......
......@@ -68,18 +68,13 @@ ASTNodeExpressionBuilder::_buildExpression(ASTNode& n)
n.m_node_processor = std::make_unique<FakeProcessor>();
} else if (n.is_type<language::name>()) {
if (n.m_data_type == ASTNodeDataType::builtin_function_t) {
n.m_node_processor = std::make_unique<FakeProcessor>();
} else {
// Dealing with contexts
auto [i_symbol, success] = n.m_symbol_table->find(n.string(), n.begin());
Assert(success, "could not find symbol");
if (i_symbol->attributes().hasLocalContext()) {
n.m_node_processor = std::make_unique<LocalNameProcessor>(n);
} else {
n.m_node_processor = std::make_unique<NameProcessor>(n);
}
}
} else if (n.is_type<language::unary_minus>() or n.is_type<language::unary_not>()) {
ASTNodeUnaryOperatorExpressionBuilder{n};
......
......@@ -7,7 +7,10 @@
ASTNodeFunctionEvaluationExpressionBuilder::ASTNodeFunctionEvaluationExpressionBuilder(ASTNode& node)
{
switch (node.children[0]->m_data_type) {
auto [i_function_symbol, found] = node.m_symbol_table->find(node.children[0]->string(), node.begin());
Assert(found);
switch (i_function_symbol->attributes().dataType()) {
case ASTNodeDataType::function_t: {
ASTNodeFunctionExpressionBuilder{node};
break;
......
......@@ -233,8 +233,7 @@ ASTNodeFunctionExpressionBuilder::_buildArgumentConverter(FunctionDescriptor& fu
if (arguments_number != parameters_number) {
std::ostringstream error_message;
error_message << "bad number of arguments: expecting " << rang::fgB::yellow << parameters_number
<< rang::style::reset << rang::style::bold << ", provided " << rang::fgB::yellow << arguments_number
<< rang::style::reset;
<< rang::style::reset << ", provided " << rang::fgB::yellow << arguments_number << rang::style::reset;
throw ParseError(error_message.str(), argument_nodes.begin());
}
......
......@@ -107,9 +107,8 @@ ASTSymbolInitializationChecker::_checkSymbolInitialization(ASTNode& node)
}
} else if (node.is_type<language::name>()) {
auto [i_symbol, found] = node.m_symbol_table->find(node.string(), node.begin());
Assert(node.m_symbol_table->has(node.string(), node.begin()),
"unexpected error, should have been detected through declaration checking");
if (found and not i_symbol->attributes().isInitialized()) {
Assert(found, "unexpected error, should have been detected through declaration checking");
if (not i_symbol->attributes().isInitialized()) {
std::ostringstream error_message;
error_message << "uninitialized symbol '" << rang::fg::red << node.string() << rang::fg::reset << '\'';
throw ParseError(error_message.str(), std::vector{node.begin()});
......
......@@ -22,19 +22,11 @@ ASTSymbolTableBuilder::buildSymbolTable(ASTNode& n, std::shared_ptr<SymbolTable>
n.m_symbol_table = local_symbol_table;
const std::string& symbol = n.children[0]->string();
if (symbol_table->getBuiltinFunctionSymbolList(symbol, n.children[0]->begin()).size() > 0) {
std::ostringstream error_message;
error_message << "symbol '" << rang::fg::red << symbol << rang::fg::reset
<< "' already denotes a builtin function!";
throw ParseError(error_message.str(), std::vector{n.children[0]->begin()});
}
auto [i_symbol, success] = symbol_table->add(symbol, n.children[0]->begin());
if (not success) {
std::ostringstream error_message;
error_message << "symbol '" << rang::fg::red << symbol << rang::fg::reset << "' was already defined!";
throw ParseError(error_message.str(), std::vector{n.children[0]->begin()});
throw ParseError(error_message.str(), std::vector{n.begin()});
}
for (auto& child : n.children) {
......@@ -50,13 +42,6 @@ ASTSymbolTableBuilder::buildSymbolTable(ASTNode& n, std::shared_ptr<SymbolTable>
if (n.has_content()) {
if (n.is_type<language::var_declaration>()) {
auto register_symbol = [&](const ASTNode& argument_node) {
if (symbol_table->getBuiltinFunctionSymbolList(argument_node.string(), argument_node.begin()).size() > 0) {
std::ostringstream error_message;
error_message << "symbol '" << rang::fg::red << argument_node.string() << rang::fg::reset
<< "' already denotes a builtin function!";
throw ParseError(error_message.str(), std::vector{argument_node.begin()});
}
auto [i_symbol, success] = symbol_table->add(argument_node.string(), argument_node.begin());
if (not success) {
std::ostringstream error_message;
......@@ -76,13 +61,6 @@ ASTSymbolTableBuilder::buildSymbolTable(ASTNode& n, std::shared_ptr<SymbolTable>
}
} else if (n.is_type<language::function_definition>()) {
auto register_and_initialize_symbol = [&](const ASTNode& argument_node) {
if (symbol_table->getBuiltinFunctionSymbolList(argument_node.string(), argument_node.begin()).size() > 0) {
std::ostringstream error_message;
error_message << "symbol '" << rang::fg::red << argument_node.string() << rang::fg::reset
<< "' already denotes a builtin function!";
throw ParseError(error_message.str(), std::vector{argument_node.begin()});
}
auto [i_symbol, success] = symbol_table->add(argument_node.string(), argument_node.begin());
if (not success) {
std::ostringstream error_message;
......@@ -103,7 +81,8 @@ ASTSymbolTableBuilder::buildSymbolTable(ASTNode& n, std::shared_ptr<SymbolTable>
}
}
} else if (n.is_type<language::name>()) {
if (not symbol_table->has(n.string(), n.begin())) {
auto [i_symbol, found] = symbol_table->find(n.string(), n.begin());
if (not found) {
std::ostringstream error_message;
error_message << "undefined symbol '" << rang::fg::red << n.string() << rang::fg::reset << '\'';
throw ParseError(error_message.str(), std::vector{n.begin()});
......
......@@ -12,54 +12,8 @@ void
BuiltinModule::_addBuiltinFunction(const std::string& name,
std::shared_ptr<IBuiltinFunctionEmbedder> builtin_function_embedder)
{
auto is_keyword = [](const std::string& s) -> bool {
if (s.size() == 0) {
return false;
} else {
if (not(std::isalpha(s[0]) or s[0] == '_')) {
return false;
}
for (size_t i = 1; i < s.size(); ++i) {
if (not(std::isalnum(s[0]) or s[0] == '_')) {
return false;
}
}
}
return true;
};
if (not is_keyword(name)) {
std::ostringstream os;
os << "while defining module " << this->name() << " invalid builtin function name: '" << name << "'\n";
throw UnexpectedError(os.str());
}
auto parameter_data_type_list = builtin_function_embedder->getParameterDataTypes();
std::string mangled_name = [&] {
std::ostringstream os;
os << name << '(';
switch (parameter_data_type_list.size()) {
case 0: {
break;
}
case 1: {
os << dataTypeName(parameter_data_type_list[0]);
break;
}
default:
os << dataTypeName(parameter_data_type_list[0]);
for (size_t i = 1; i < parameter_data_type_list.size(); ++i) {
os << ',' << dataTypeName(parameter_data_type_list[i]);
}
}
os << ')';
return os.str();
}();
auto [i_builtin_function, success] =
m_name_builtin_function_map.insert(std::make_pair(mangled_name, builtin_function_embedder));
m_name_builtin_function_map.insert(std::make_pair(name, builtin_function_embedder));
if (not success) {
throw NormalError("builtin-function '" + name + "' cannot be added!\n");
}
......
......@@ -20,29 +20,6 @@
void
ModuleRepository::_subscribe(std::unique_ptr<IModule> m)
{
auto is_keyword = [](const std::string& s) -> bool {
if (s.size() == 0) {
return false;
} else {
if (not(std::isalpha(s[0]) or s[0] == '_')) {
return false;
}
for (size_t i = 1; i < s.size(); ++i) {
if (not(std::isalnum(s[0]) or s[0] == '_')) {
return false;
}
}
}
return true;
};
if (not is_keyword(std::string{m->name()})) {
std::ostringstream os;
os << "cannot subscribe module with invalid name: '" << m->name() << "'\n";
throw UnexpectedError(os.str());
}
auto [i_module, success] = m_module_set.emplace(m->name(), std::move(m));
Assert(success, "module has already been subscribed");
}
......@@ -170,15 +147,6 @@ ModuleRepository::registerOperators(const std::string& module_name)
std::string
ModuleRepository::getModuleInfo(const std::string& module_name) const
{
auto demangleBuiltinFunction = [](const std::string& mangled_name) -> std::string {
size_t i = 0;
for (; i < mangled_name.size(); ++i) {
if (mangled_name[i] == '(')
break;
}
return mangled_name.substr(0, i);
};
std::stringstream os;
auto i_module = m_module_set.find(module_name);
if (i_module != m_module_set.end()) {
......@@ -187,8 +155,8 @@ ModuleRepository::getModuleInfo(const std::string& module_name) const
const auto& builtin_function_map = i_module->second->getNameBuiltinFunctionMap();
if (builtin_function_map.size() > 0) {
os << " functions\n";
for (auto& [mangled_name, function] : builtin_function_map) {
os << " " << rang::fgB::green << demangleBuiltinFunction(mangled_name) << rang::style::reset << ": ";
for (auto& [name, function] : builtin_function_map) {
os << " " << rang::fgB::green << name << rang::style::reset << ": ";
os << dataTypeName(function->getParameterDataTypes());
os << rang::fgB::yellow << " -> " << rang::style::reset;
os << dataTypeName(function->getReturnDataType()) << '\n';
......
#include <language/utils/BuiltinFunctionEmbedderUtils.hpp>
#include <language/PEGGrammar.hpp>
#include <language/ast/ASTNode.hpp>
#include <language/utils/BuiltinFunctionEmbedder.hpp>
#include <language/utils/ParseError.hpp>
#include <language/utils/SymbolTable.hpp>
void
flattenDataTypes(const ASTNodeDataType& data_type, std::vector<ASTNodeDataType>& arg_type_list)
{
if ((data_type == ASTNodeDataType::list_t) and (*data_type.contentTypeList()[0] == ASTNodeDataType::typename_t)) {
for (auto data_type : data_type.contentTypeList()) {
arg_type_list.push_back(data_type->contentType());
}
} else {
arg_type_list.push_back(data_type);
}
}
std::shared_ptr<IBuiltinFunctionEmbedder>
getBuiltinFunctionEmbedder(ASTNode& n)
{
const std::string builtin_function_name = n.children[0]->string();
auto& symbol_table = *n.m_symbol_table;
auto& args_node = *n.children[1];
std::vector<ASTNodeDataType> arg_type_list;
if (args_node.is_type<language::function_argument_list>()) {
for (auto& arg : args_node.children) {
flattenDataTypes(arg->m_data_type, arg_type_list);
}
} else {
flattenDataTypes(args_node.m_data_type, arg_type_list);
}
std::ostringstream mangled_name;
mangled_name << builtin_function_name;
if (size(arg_type_list) == 0) {
mangled_name << "()";
} else if (size(arg_type_list) == 1) {
mangled_name << '(' << dataTypeName(arg_type_list[0]) << ')';
} else {
mangled_name << dataTypeName(arg_type_list);
}
std::vector builtin_function_candidate_list =
symbol_table.getBuiltinFunctionSymbolList(builtin_function_name, n.begin());
auto is_castable_to_vector = [](const ASTNodeDataType& arg_type, const ASTNodeDataType& target_type) {
bool is_castable = true;
if (target_type.dimension() > 1) {
switch (arg_type) {
case ASTNodeDataType::int_t: {
break;
}
case ASTNodeDataType::list_t: {
if (arg_type.contentTypeList().size() != target_type.dimension()) {
is_castable = false;
break;
}
for (auto list_arg : arg_type.contentTypeList()) {
is_castable &= isNaturalConversion(*list_arg, ASTNodeDataType::build<ASTNodeDataType::double_t>());
}
break;
}
default: {
is_castable &= false;
}
}
} else {
is_castable &= isNaturalConversion(arg_type, ASTNodeDataType::build<ASTNodeDataType::double_t>());
}
return is_castable;
};
auto is_castable_to_matrix = [](const ASTNodeDataType& arg_type, const ASTNodeDataType& target_type) {
bool is_castable = true;
if (target_type.nbRows() > 1) {
switch (arg_type) {
case ASTNodeDataType::int_t: {
break;
}
case ASTNodeDataType::list_t: {
if (arg_type.contentTypeList().size() != target_type.nbRows() * target_type.nbColumns()) {
is_castable = false;
break;
}
for (auto list_arg : arg_type.contentTypeList()) {
is_castable &= isNaturalConversion(*list_arg, ASTNodeDataType::build<ASTNodeDataType::double_t>());
}
break;
}
default: {
is_castable &= false;
}
}
} else {
is_castable &= isNaturalConversion(arg_type, ASTNodeDataType::build<ASTNodeDataType::double_t>());
}
return is_castable;
};
std::vector<uint64_t> callable_id_list;
for (auto candidate : builtin_function_candidate_list) {
uint64_t builtin_function_id = std::get<uint64_t>(candidate.attributes().value());
auto& builtin_function_embedder_table = n.m_symbol_table->builtinFunctionEmbedderTable();
std::shared_ptr builtin_function_embedder = builtin_function_embedder_table[builtin_function_id];
if (builtin_function_embedder->numberOfParameters() == arg_type_list.size()) {
std::vector<ASTNodeDataType> builtin_function_parameter_type_list =
builtin_function_embedder->getParameterDataTypes();
bool is_castable = true;
for (size_t i_arg = 0; i_arg < arg_type_list.size(); ++i_arg) {
const ASTNodeDataType& target_type = builtin_function_parameter_type_list[i_arg];
std::vector<ASTNodeDataType> sub_arg_type_list;
if (arg_type_list[i_arg] == ASTNodeDataType::list_t) {
for (auto& arg_type : arg_type_list[i_arg].contentTypeList()) {
sub_arg_type_list.push_back(*arg_type);
}
} else {
sub_arg_type_list.push_back(arg_type_list[i_arg]);
}
for (auto arg_type : sub_arg_type_list) {
if (not isNaturalConversion(arg_type, target_type)) {
switch (target_type) {
case ASTNodeDataType::vector_t: {
is_castable &= is_castable_to_vector(arg_type, target_type);
break;
}
case ASTNodeDataType::matrix_t: {
is_castable &= is_castable_to_matrix(arg_type, target_type);
break;
}
case ASTNodeDataType::tuple_t: {
ASTNodeDataType tuple_content_type = target_type.contentType();
if (not isNaturalConversion(arg_type, tuple_content_type)) {
switch (tuple_content_type) {
case ASTNodeDataType::vector_t: {
is_castable &= is_castable_to_vector(arg_type, tuple_content_type);
break;
}
case ASTNodeDataType::matrix_t: {
is_castable &= is_castable_to_matrix(arg_type, tuple_content_type);
break;
}
default:
is_castable &= false;
}
}
break;
}
default:
is_castable &= false;
}
}
}
}
if (is_castable) {
callable_id_list.push_back(builtin_function_id);
}
}
}
uint64_t builtin_function_id = [&] {
switch (size(callable_id_list)) {
case 0: {
std::ostringstream error_msg;
error_msg << "no matching function to call " << rang::fgB::red << builtin_function_name << rang::style::reset
<< rang::style::bold << ": " << rang::fgB::yellow << dataTypeName(arg_type_list) << rang::style::reset
<< rang::style::bold << "\nnote: candidates are";
for (auto candidate : builtin_function_candidate_list) {
uint64_t builtin_function_id = std::get<uint64_t>(candidate.attributes().value());
auto& builtin_function_embedder_table = n.m_symbol_table->builtinFunctionEmbedderTable();
std::shared_ptr builtin_function_embedder = builtin_function_embedder_table[builtin_function_id];
error_msg << "\n " << builtin_function_name << ": "
<< dataTypeName(builtin_function_embedder->getParameterDataTypes()) << " -> "
<< dataTypeName(builtin_function_embedder->getReturnDataType());
}
throw ParseError(error_msg.str(), n.begin());
}
case 1: {
return callable_id_list[0];
}
default: {
std::ostringstream error_msg;
error_msg << "ambiguous function to call " << mangled_name.str() << "\nnote: candidates are";
auto& builtin_function_embedder_table = n.m_symbol_table->builtinFunctionEmbedderTable();
for (auto callable_id : callable_id_list) {
std::shared_ptr builtin_function_embedder = builtin_function_embedder_table[callable_id];
error_msg << "\n " << builtin_function_name << ": "
<< dataTypeName(builtin_function_embedder->getParameterDataTypes()) << " -> "
<< dataTypeName(builtin_function_embedder->getReturnDataType());
}
throw ParseError(error_msg.str(), n.begin());
}
}
}();
return n.m_symbol_table->builtinFunctionEmbedderTable()[builtin_function_id];
}
#ifndef BUILTIN_FUNCTION_EMBEDDER_UTILS_HPP
#define BUILTIN_FUNCTION_EMBEDDER_UTILS_HPP
class IBuiltinFunctionEmbedder;
class ASTNode;
#include <memory>
std::shared_ptr<IBuiltinFunctionEmbedder> getBuiltinFunctionEmbedder(ASTNode& n);
#endif // BUILTIN_FUNCTION_EMBEDDER_UTILS_HPP
......@@ -20,7 +20,6 @@ add_library(PugsLanguageUtils
BinaryOperatorRegisterForRnxn.cpp
BinaryOperatorRegisterForString.cpp
BinaryOperatorRegisterForZ.cpp
BuiltinFunctionEmbedderUtils.cpp
DataVariant.cpp
EmbeddedData.cpp
EmbeddedIDiscreteFunctionOperators.cpp
......
......@@ -279,55 +279,6 @@ class SymbolTable
}
}
std::vector<Symbol>
getBuiltinFunctionSymbolList(const std::string& symbol, const TAO_PEGTL_NAMESPACE::position& use_position)
{
std::vector<Symbol> builtin_function_symbol_list;
for (auto i_stored_symbol : m_symbol_list) {
if (use_position.byte < i_stored_symbol.attributes().position().byte)
continue;
// Symbol must be defined before the call
std::string_view stored_symbol_name = i_stored_symbol.name();
if ((stored_symbol_name.size() > symbol.size()) and (stored_symbol_name[symbol.size()] == '(')) {
if (stored_symbol_name.substr(0, symbol.size()) == symbol) {
builtin_function_symbol_list.push_back(i_stored_symbol);
}
}
}
if (m_parent_table) {
return m_parent_table->getBuiltinFunctionSymbolList(symbol, use_position);
} else {
return builtin_function_symbol_list;
}
}
bool
has(const std::string& symbol, const TAO_PEGTL_NAMESPACE::position& use_position)
{
for (auto i_stored_symbol : m_symbol_list) {
if (use_position.byte < i_stored_symbol.attributes().position().byte)
continue;
// Symbol must be defined before the call
std::string_view stored_symbol_name = i_stored_symbol.name();
if ((stored_symbol_name.size() == symbol.size()) or
(stored_symbol_name.size() > symbol.size() and (stored_symbol_name[symbol.size()] == '('))) {
if (stored_symbol_name.substr(0, symbol.size()) == symbol) {
return true;
}
}
}
if (m_parent_table) {
return m_parent_table->has(symbol, use_position);
} else {
return false;
}
}
auto
find(const std::string& symbol, const TAO_PEGTL_NAMESPACE::position& use_position)
{
......@@ -355,15 +306,8 @@ class SymbolTable
add(const std::string& symbol_name, const TAO_PEGTL_NAMESPACE::position& symbol_position)
{
for (auto i_stored_symbol = m_symbol_list.begin(); i_stored_symbol != m_symbol_list.end(); ++i_stored_symbol) {
std::string_view stored_symbol_name = i_stored_symbol->name();
if (stored_symbol_name.size() == symbol_name.size()) {
if (stored_symbol_name == symbol_name) {
if (i_stored_symbol->name() == symbol_name) {
return std::make_pair(i_stored_symbol, false);
} else if (stored_symbol_name.size() > symbol_name.size() and (stored_symbol_name[symbol_name.size()] == '(')) {
if (stored_symbol_name.substr(0, symbol_name.size()) == symbol_name) {
return std::make_pair(i_stored_symbol, false);
}
}
}
}
......
......@@ -102,7 +102,7 @@ import unknown_module;
REQUIRE_THROWS_AS(ASTModulesImporter{*ast}, ParseError);
}
SECTION("symbol already defined (same builtin function)")
SECTION("symbol already defined")
{
std::string_view data = R"(
import math;
......@@ -111,7 +111,7 @@ import math;
TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"};
auto ast = ASTBuilder::build(input);
ast->m_symbol_table->add("sin(R)", ast->begin());
ast->m_symbol_table->add("sin", ast->begin());
REQUIRE_THROWS_AS(ASTModulesImporter{*ast}, ParseError);
}
......
......@@ -51,7 +51,7 @@ sin(3);
std::string_view result = R"(
(root:ASTNodeListProcessor)
`-(language::function_evaluation:BuiltinFunctionProcessor)
+-(language::name:sin:FakeProcessor)
+-(language::name:sin:NameProcessor)
`-(language::integer:3:ValueProcessor)
)";
......
......@@ -81,7 +81,7 @@ TEST_CASE("BuiltinFunctionProcessor", "[language]")
std::set<std::string> tested_function_set;
{ // sqrt
tested_function_set.insert("sqrt(R)");
tested_function_set.insert("sqrt");
std::string_view data = R"(
import math;
let x:R, x = sqrt(4);
......@@ -90,7 +90,7 @@ let x:R, x = sqrt(4);
}
{ // abs
tested_function_set.insert("abs(R)");
tested_function_set.insert("abs");
std::string_view data = R"(
import math;
let x:R, x = abs(-3.4);
......@@ -99,7 +99,7 @@ let x:R, x = abs(-3.4);
}
{ // sin
tested_function_set.insert("sin(R)");
tested_function_set.insert("sin");
std::string_view data = R"(
import math;
let x:R, x = sin(1.3);
......@@ -108,7 +108,7 @@ let x:R, x = sin(1.3);
}
{ // cos
tested_function_set.insert("cos(R)");
tested_function_set.insert("cos");
std::string_view data = R"(
import math;
let x:R, x = cos(1.3);
......@@ -117,7 +117,7 @@ let x:R, x = cos(1.3);
}
{ // tan
tested_function_set.insert("tan(R)");
tested_function_set.insert("tan");
std::string_view data = R"(
import math;
let x:R, x = tan(1.3);
......@@ -126,7 +126,7 @@ let x:R, x = tan(1.3);
}
{ // asin
tested_function_set.insert("asin(R)");
tested_function_set.insert("asin");
std::string_view data = R"(
import math;
let x:R, x = asin(0.7);
......@@ -135,7 +135,7 @@ let x:R, x = asin(0.7);
}
{ // acos
tested_function_set.insert("acos(R)");
tested_function_set.insert("acos");
std::string_view data = R"(
import math;
let x:R, x = acos(0.7);
......@@ -144,7 +144,7 @@ let x:R, x = acos(0.7);
}
{ // atan
tested_function_set.insert("atan(R)");
tested_function_set.insert("atan");
std::string_view data = R"(
import math;
let x:R, x = atan(0.7);
......@@ -153,7 +153,7 @@ let x:R, x = atan(0.7);
}
{ // atan2
tested_function_set.insert("atan2(R,R)");
tested_function_set.insert("atan2");
std::string_view data = R"(
import math;
let x:R, x = atan2(0.7, 0.4);
......@@ -162,7 +162,7 @@ let x:R, x = atan2(0.7, 0.4);
}
{ // sinh
tested_function_set.insert("sinh(R)");
tested_function_set.insert("sinh");
std::string_view data = R"(
import math;
let x:R, x = sinh(0.6);
......@@ -171,7 +171,7 @@ let x:R, x = sinh(0.6);
}
{ // cosh
tested_function_set.insert("cosh(R)");
tested_function_set.insert("cosh");
std::string_view data = R"(
import math;
let x:R, x = cosh(1.7);
......@@ -180,7 +180,7 @@ let x:R, x = cosh(1.7);
}
{ // tanh
tested_function_set.insert("tanh(R)");
tested_function_set.insert("tanh");
std::string_view data = R"(
import math;
let x:R, x = tanh(0.6);
......@@ -189,7 +189,7 @@ let x:R, x = tanh(0.6);
}
{ // asinh
tested_function_set.insert("asinh(R)");
tested_function_set.insert("asinh");
std::string_view data = R"(
import math;
let x:R, x = asinh(0.6);
......@@ -198,7 +198,7 @@ let x:R, x = asinh(0.6);
}
{ // acosh
tested_function_set.insert("acosh(R)");
tested_function_set.insert("acosh");
std::string_view data = R"(
import math;
let x:R, x = acosh(1.7);
......@@ -207,7 +207,7 @@ let x:R, x = acosh(1.7);
}
{ // tanh
tested_function_set.insert("atanh(R)");
tested_function_set.insert("atanh");
std::string_view data = R"(
import math;
let x:R, x = atanh(0.6);
......@@ -216,7 +216,7 @@ let x:R, x = atanh(0.6);
}
{ // exp
tested_function_set.insert("exp(R)");
tested_function_set.insert("exp");
std::string_view data = R"(
import math;
let x:R, x = exp(1.7);
......@@ -225,7 +225,7 @@ let x:R, x = exp(1.7);
}
{ // log
tested_function_set.insert("log(R)");
tested_function_set.insert("log");
std::string_view data = R"(
import math;
let x:R, x = log(1.6);
......@@ -234,7 +234,7 @@ let x:R, x = log(1.6);
}
{ // pow
tested_function_set.insert("pow(R,R)");
tested_function_set.insert("pow");
std::string_view data = R"(
import math;
let x:R, x = pow(1.6, 2.3);
......@@ -243,7 +243,7 @@ let x:R, x = pow(1.6, 2.3);
}
{ // ceil
tested_function_set.insert("ceil(R)");
tested_function_set.insert("ceil");
std::string_view data = R"(
import math;
let z:Z, z = ceil(-1.2);
......@@ -252,7 +252,7 @@ let z:Z, z = ceil(-1.2);
}
{ // floor
tested_function_set.insert("floor(R)");
tested_function_set.insert("floor");
std::string_view data = R"(
import math;
let z:Z, z = floor(-1.2);
......@@ -261,7 +261,7 @@ let z:Z, z = floor(-1.2);
}
{ // trunc
tested_function_set.insert("trunc(R)");
tested_function_set.insert("trunc");
std::string_view data = R"(
import math;
let z:Z, z = trunc(-0.2) + trunc(0.7);
......@@ -270,7 +270,7 @@ let z:Z, z = trunc(-0.2) + trunc(0.7);
}
{ // round
tested_function_set.insert("round(R)");
tested_function_set.insert("round");
std::string_view data = R"(
import math;
let z:Z, z = round(-1.2);
......
......@@ -22,141 +22,135 @@ class test_BuiltinFunctionRegister
_populateNameBuiltinFunctionMap()
{
m_name_builtin_function_map.insert(
std::make_pair("runtimeError()", std::make_shared<BuiltinFunctionEmbedder<void(void)>>(
std::make_pair("runtimeError", std::make_shared<BuiltinFunctionEmbedder<void(void)>>(
[](void) -> void { throw NormalError("runtime error"); })));
m_name_builtin_function_map.insert(
std::make_pair("RtoR(R)", std::make_shared<BuiltinFunctionEmbedder<double(double)>>(
m_name_builtin_function_map.insert(std::make_pair("RtoR", std::make_shared<BuiltinFunctionEmbedder<double(double)>>(
[](double x) -> double { return x + 1; })));
m_name_builtin_function_map.insert(
std::make_pair("ZtoR(Z)", std::make_shared<BuiltinFunctionEmbedder<double(int64_t)>>(
std::make_pair("ZtoR", std::make_shared<BuiltinFunctionEmbedder<double(int64_t)>>(
[](int64_t z) -> double { return 0.5 * z; })));
m_name_builtin_function_map.insert(
std::make_pair("NtoR(N)", std::make_shared<BuiltinFunctionEmbedder<double(uint64_t)>>(
std::make_pair("NtoR", std::make_shared<BuiltinFunctionEmbedder<double(uint64_t)>>(
[](uint64_t n) -> double { return 0.5 * n; })));
m_name_builtin_function_map.insert(
std::make_pair("BtoR(B)",
std::make_shared<BuiltinFunctionEmbedder<double(bool)>>([](bool b) -> double { return b; })));
m_name_builtin_function_map.insert(std::make_pair("BtoR", std::make_shared<BuiltinFunctionEmbedder<double(bool)>>(
[](bool b) -> double { return b; })));
m_name_builtin_function_map.insert(
std::make_pair("RRtoB(R,R)", std::make_shared<BuiltinFunctionEmbedder<bool(double, double)>>(
std::make_pair("RRtoB", std::make_shared<BuiltinFunctionEmbedder<bool(double, double)>>(
[](double x, double y) -> bool { return x > y; })));
m_name_builtin_function_map.insert(
std::make_pair("StoB(string)", std::make_shared<BuiltinFunctionEmbedder<bool(std::string)>>(
std::make_pair("StoB", std::make_shared<BuiltinFunctionEmbedder<bool(std::string)>>(
[](const std::string& s) -> bool { return s.size() > 0; })));
m_name_builtin_function_map.insert(
std::make_pair("RtoR1(R)", std::make_shared<BuiltinFunctionEmbedder<TinyVector<1>(double)>>(
std::make_pair("RtoR1", std::make_shared<BuiltinFunctionEmbedder<TinyVector<1>(double)>>(
[](double r) -> TinyVector<1> { return {r}; })));
m_name_builtin_function_map.insert(
std::make_pair("R1toR(R^1)", std::make_shared<BuiltinFunctionEmbedder<double(TinyVector<1>)>>(
std::make_pair("R1toR", std::make_shared<BuiltinFunctionEmbedder<double(TinyVector<1>)>>(
[](TinyVector<1> x) -> double { return x[0]; })));
m_name_builtin_function_map.insert(
std::make_pair("R2toR(R^2)", std::make_shared<BuiltinFunctionEmbedder<double(TinyVector<2>)>>(
std::make_pair("R2toR", std::make_shared<BuiltinFunctionEmbedder<double(TinyVector<2>)>>(
[](TinyVector<2> x) -> double { return x[0] + x[1]; })));
m_name_builtin_function_map.insert(
std::make_pair("R3toR(R^3)", std::make_shared<BuiltinFunctionEmbedder<double(const TinyVector<3>&)>>(
std::make_pair("R3toR", std::make_shared<BuiltinFunctionEmbedder<double(const TinyVector<3>&)>>(
[](const TinyVector<3>& x) -> double { return x[0] + x[1] + x[2]; })));
m_name_builtin_function_map.insert(
std::make_pair("R3R2toR(R^3,R^2)",
std::make_pair("R3R2toR",
std::make_shared<BuiltinFunctionEmbedder<double(TinyVector<3>, TinyVector<2>)>>(
[](TinyVector<3> x, TinyVector<2> y) -> double { return x[0] * y[1] + (y[0] - x[2]) * x[1]; })));
m_name_builtin_function_map.insert(
std::make_pair("RtoR11(R)", std::make_shared<BuiltinFunctionEmbedder<TinyMatrix<1>(double)>>(
std::make_pair("RtoR11", std::make_shared<BuiltinFunctionEmbedder<TinyMatrix<1>(double)>>(
[](double r) -> TinyMatrix<1> { return {r}; })));
m_name_builtin_function_map.insert(
std::make_pair("R11toR(R^1x1)", std::make_shared<BuiltinFunctionEmbedder<double(TinyMatrix<1>)>>(
std::make_pair("R11toR", std::make_shared<BuiltinFunctionEmbedder<double(TinyMatrix<1>)>>(
[](TinyMatrix<1> x) -> double { return x(0, 0); })));
m_name_builtin_function_map.insert(
std::make_pair("R22toR(R^2x2)",
std::make_shared<BuiltinFunctionEmbedder<double(TinyMatrix<2>)>>(
std::make_pair("R22toR", std::make_shared<BuiltinFunctionEmbedder<double(TinyMatrix<2>)>>(
[](TinyMatrix<2> x) -> double { return x(0, 0) + x(0, 1) + x(1, 0) + x(1, 1); })));
m_name_builtin_function_map.insert(
std::make_pair("R33toR(R^3x3)", std::make_shared<BuiltinFunctionEmbedder<double(const TinyMatrix<3>&)>>(
std::make_pair("R33toR", std::make_shared<BuiltinFunctionEmbedder<double(const TinyMatrix<3>&)>>(
[](const TinyMatrix<3>& x) -> double { return x(0, 0) + x(1, 1) + x(2, 2); })));
m_name_builtin_function_map.insert(
std::make_pair("R33R22toR(R^3x3,R^2x2)",
std::make_shared<BuiltinFunctionEmbedder<double(TinyMatrix<3>, TinyMatrix<2>)>>(
std::make_pair("R33R22toR", std::make_shared<BuiltinFunctionEmbedder<double(TinyMatrix<3>, TinyMatrix<2>)>>(
[](TinyMatrix<3> x, TinyMatrix<2> y) -> double {
return (x(0, 0) + x(1, 1) + x(2, 2)) * (y(0, 0) + y(0, 1) + y(1, 0) + y(1, 1));
})));
m_name_builtin_function_map.insert(
std::make_pair("fidToR(function)", std::make_shared<BuiltinFunctionEmbedder<double(const FunctionSymbolId&)>>(
std::make_pair("fidToR", std::make_shared<BuiltinFunctionEmbedder<double(const FunctionSymbolId&)>>(
[](const FunctionSymbolId&) -> double { return 0; })));
m_name_builtin_function_map.insert(
std::make_pair("builtinToBuiltin(builtin_t)",
std::make_pair("builtinToBuiltin",
std::make_shared<
BuiltinFunctionEmbedder<std::shared_ptr<const double>(std::shared_ptr<const double>)>>(
[](std::shared_ptr<const double> x) -> std::shared_ptr<const double> { return x; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_BtoR(tuple(B))", std::make_shared<BuiltinFunctionEmbedder<double(std::vector<bool>)>>(
std::make_pair("tuple_BtoR", std::make_shared<BuiltinFunctionEmbedder<double(std::vector<bool>)>>(
[](const std::vector<bool>&) -> double { return 0.5; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_NtoR(tuple(N))", std::make_shared<BuiltinFunctionEmbedder<double(std::vector<uint64_t>)>>(
std::make_pair("tuple_NtoR", std::make_shared<BuiltinFunctionEmbedder<double(std::vector<uint64_t>)>>(
[](const std::vector<uint64_t>&) -> double { return 0.5; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_ZtoR(tuple(Z))", std::make_shared<BuiltinFunctionEmbedder<double(std::vector<int64_t>)>>(
std::make_pair("tuple_ZtoR", std::make_shared<BuiltinFunctionEmbedder<double(std::vector<int64_t>)>>(
[](const std::vector<int64_t>&) -> double { return 0.5; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_RtoB(tuple(R))", std::make_shared<BuiltinFunctionEmbedder<bool(std::vector<double>)>>(
std::make_pair("tuple_RtoB", std::make_shared<BuiltinFunctionEmbedder<bool(std::vector<double>)>>(
[](const std::vector<double>&) -> bool { return false; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_stringtoB(tuple(string))",
std::make_shared<BuiltinFunctionEmbedder<bool(std::vector<std::string>)>>(
std::make_pair("tuple_stringtoB", std::make_shared<BuiltinFunctionEmbedder<bool(std::vector<std::string>)>>(
[](const std::vector<std::string>&) -> bool { return true; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_builtinToB(tuple(builtin_t))",
std::make_pair("tuple_builtinToB",
std::make_shared<BuiltinFunctionEmbedder<bool(std::vector<std::shared_ptr<const double>>)>>(
[](const std::vector<std::shared_ptr<const double>>&) -> bool { return true; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_R1ToR(tuple(R^1))",
std::make_pair("tuple_R1ToR",
std::make_shared<BuiltinFunctionEmbedder<double(const std::vector<TinyVector<1>>&)>>(
[](const std::vector<TinyVector<1>>&) -> double { return 1; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_R2ToR(tuple(R^2))",
std::make_pair("tuple_R2ToR",
std::make_shared<BuiltinFunctionEmbedder<double(const std::vector<TinyVector<2>>&)>>(
[](const std::vector<TinyVector<2>>&) -> double { return 1; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_R3ToR(tuple(R^3))",
std::make_shared<BuiltinFunctionEmbedder<double(const std::vector<TinyVector<3>>)>>(
std::make_pair("tuple_R3ToR", std::make_shared<BuiltinFunctionEmbedder<double(const std::vector<TinyVector<3>>)>>(
[](const std::vector<TinyVector<3>>&) -> double { return 0; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_R11ToR(tuple(R^1x1))",
std::make_pair("tuple_R11ToR",
std::make_shared<BuiltinFunctionEmbedder<double(const std::vector<TinyMatrix<1>>&)>>(
[](const std::vector<TinyMatrix<1>>&) -> double { return 1; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_R22ToR(tuple(R^2x2))",
std::make_pair("tuple_R22ToR",
std::make_shared<BuiltinFunctionEmbedder<double(const std::vector<TinyMatrix<2>>&)>>(
[](const std::vector<TinyMatrix<2>>&) -> double { return 1; })));
m_name_builtin_function_map.insert(
std::make_pair("tuple_R33ToR(tuple(R^3x3))",
std::make_pair("tuple_R33ToR",
std::make_shared<BuiltinFunctionEmbedder<double(const std::vector<TinyMatrix<3>>)>>(
[](const std::vector<TinyMatrix<3>>&) -> double { return 0; })));
}
......
......@@ -23,7 +23,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("sqrt")
{
auto i_function = name_builtin_function.find("sqrt(R)");
auto i_function = name_builtin_function.find("sqrt");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -35,7 +35,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("abs")
{
auto i_function = name_builtin_function.find("abs(R)");
auto i_function = name_builtin_function.find("abs");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -62,7 +62,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("sin")
{
auto i_function = name_builtin_function.find("sin(R)");
auto i_function = name_builtin_function.find("sin");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -74,7 +74,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("cos")
{
auto i_function = name_builtin_function.find("cos(R)");
auto i_function = name_builtin_function.find("cos");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -86,7 +86,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("tan")
{
auto i_function = name_builtin_function.find("tan(R)");
auto i_function = name_builtin_function.find("tan");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -98,7 +98,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("asin")
{
auto i_function = name_builtin_function.find("asin(R)");
auto i_function = name_builtin_function.find("asin");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -110,7 +110,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("acos")
{
auto i_function = name_builtin_function.find("acos(R)");
auto i_function = name_builtin_function.find("acos");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -122,7 +122,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("atan")
{
auto i_function = name_builtin_function.find("atan(R)");
auto i_function = name_builtin_function.find("atan");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -137,7 +137,7 @@ TEST_CASE("MathModule", "[language]")
arg = 1.3;
arg_variant = arg;
auto i_function = name_builtin_function.find("sinh(R)");
auto i_function = name_builtin_function.find("sinh");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -149,7 +149,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("cosh")
{
auto i_function = name_builtin_function.find("cosh(R)");
auto i_function = name_builtin_function.find("cosh");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -161,7 +161,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("tanh")
{
auto i_function = name_builtin_function.find("tanh(R)");
auto i_function = name_builtin_function.find("tanh");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -173,7 +173,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("asinh")
{
auto i_function = name_builtin_function.find("asinh(R)");
auto i_function = name_builtin_function.find("asinh");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -188,7 +188,7 @@ TEST_CASE("MathModule", "[language]")
arg = 10;
arg_variant = arg;
auto i_function = name_builtin_function.find("acosh(R)");
auto i_function = name_builtin_function.find("acosh");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -200,7 +200,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("atanh")
{
auto i_function = name_builtin_function.find("atanh(R)");
auto i_function = name_builtin_function.find("atanh");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -212,7 +212,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("exp")
{
auto i_function = name_builtin_function.find("exp(R)");
auto i_function = name_builtin_function.find("exp");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -224,7 +224,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("log")
{
auto i_function = name_builtin_function.find("log(R)");
auto i_function = name_builtin_function.find("log");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -243,7 +243,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("ceil")
{
auto i_function = name_builtin_function.find("ceil(R)");
auto i_function = name_builtin_function.find("ceil");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -255,7 +255,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("floor")
{
auto i_function = name_builtin_function.find("floor(R)");
auto i_function = name_builtin_function.find("floor");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -267,7 +267,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("trunc")
{
auto i_function = name_builtin_function.find("trunc(R)");
auto i_function = name_builtin_function.find("trunc");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -279,7 +279,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("round")
{
auto i_function = name_builtin_function.find("round(R)");
auto i_function = name_builtin_function.find("round");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -300,7 +300,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("atan2")
{
auto i_function = name_builtin_function.find("atan2(R,R)");
auto i_function = name_builtin_function.find("atan2");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......@@ -312,7 +312,7 @@ TEST_CASE("MathModule", "[language]")
SECTION("pow")
{
auto i_function = name_builtin_function.find("pow(R,R)");
auto i_function = name_builtin_function.find("pow");
REQUIRE(i_function != name_builtin_function.end());
IBuiltinFunctionEmbedder& function_embedder = *i_function->second;
......