Skip to content

Commit

Permalink
Update extern/utils subproject commit
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardodebenedictis committed Apr 9, 2024
1 parent c506af5 commit 1375b77
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion extern/utils
Submodule utils updated 1 files
+13 −0 include/pair.hpp
4 changes: 2 additions & 2 deletions include/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ namespace riddle
* @brief Get the bounds of the arithmetic expression.
*
* @param expr The expression.
* @return std::pair<utils::inf_rational, utils::inf_rational> The bounds.
* @return utils::pair<utils::inf_rational, utils::inf_rational> The bounds.
*/
[[nodiscard]] virtual std::pair<utils::inf_rational, utils::inf_rational> bounds(const arith_item &expr) const noexcept = 0;
[[nodiscard]] virtual utils::pair<utils::inf_rational, utils::inf_rational> bounds(const arith_item &expr) const noexcept = 0;

/**
* @brief Get the domain of the expression.
Expand Down
29 changes: 15 additions & 14 deletions include/declaration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <vector>
#include "statement.hpp"
#include "pair.hpp"

namespace riddle
{
Expand Down Expand Up @@ -144,17 +145,17 @@ namespace riddle
friend class class_declaration;

public:
constructor_declaration(std::vector<std::pair<std::vector<id_token>, id_token>> &&params, std::vector<init_element> &&inits, std::vector<std::unique_ptr<statement>> &&stmts) : parameters(std::move(params)), inits(std::move(inits)), body(std::move(stmts)) {}
constructor_declaration(std::vector<utils::pair<std::vector<id_token>, id_token>> &&params, std::vector<init_element> &&inits, std::vector<std::unique_ptr<statement>> &&stmts) : parameters(std::move(params)), inits(std::move(inits)), body(std::move(stmts)) {}

std::string to_string() const { return ""; }

private:
void refine(scope &scp) const;

private:
std::vector<std::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the constructor..
std::vector<init_element> inits; // the initializations of the fields..
std::vector<std::unique_ptr<statement>> body; // the body of the constructor..
std::vector<utils::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the constructor..
std::vector<init_element> inits; // the initializations of the fields..
std::vector<std::unique_ptr<statement>> body; // the body of the constructor..
};

class method_declaration
Expand All @@ -163,7 +164,7 @@ namespace riddle
friend class compilation_unit;

public:
method_declaration(std::vector<id_token> &&rt, const id_token &&name, std::vector<std::pair<std::vector<id_token>, id_token>> &&params, std::vector<std::unique_ptr<statement>> &&stmts) : return_type(std::move(rt)), name(std::move(name)), parameters(std::move(params)), body(std::move(stmts)) {}
method_declaration(std::vector<id_token> &&rt, const id_token &&name, std::vector<utils::pair<std::vector<id_token>, id_token>> &&params, std::vector<std::unique_ptr<statement>> &&stmts) : return_type(std::move(rt)), name(std::move(name)), parameters(std::move(params)), body(std::move(stmts)) {}

std::string to_string() const
{
Expand Down Expand Up @@ -191,10 +192,10 @@ namespace riddle
void refine(scope &scp) const;

private:
std::vector<id_token> return_type; // the return type of the method..
id_token name; // the name of the method..
std::vector<std::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the method..
std::vector<std::unique_ptr<statement>> body; // the body of the method..
std::vector<id_token> return_type; // the return type of the method..
id_token name; // the name of the method..
std::vector<utils::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the method..
std::vector<std::unique_ptr<statement>> body; // the body of the method..
};

class predicate_declaration
Expand All @@ -203,7 +204,7 @@ namespace riddle
friend class compilation_unit;

public:
predicate_declaration(const id_token &&name, std::vector<std::pair<std::vector<id_token>, id_token>> &&params, std::vector<std::vector<id_token>> &&base_predicates, std::vector<std::unique_ptr<statement>> &&stmts) : name(std::move(name)), parameters(std::move(params)), base_predicates(std::move(base_predicates)), body(std::move(stmts)) {}
predicate_declaration(const id_token &&name, std::vector<utils::pair<std::vector<id_token>, id_token>> &&params, std::vector<std::vector<id_token>> &&base_predicates, std::vector<std::unique_ptr<statement>> &&stmts) : name(std::move(name)), parameters(std::move(params)), base_predicates(std::move(base_predicates)), body(std::move(stmts)) {}

std::string to_string() const
{
Expand Down Expand Up @@ -238,10 +239,10 @@ namespace riddle
void refine(scope &scp) const;

private:
id_token name; // the name of the class..
std::vector<std::pair<std::vector<id_token>, id_token>> parameters; // the type parameters of the class..
std::vector<std::vector<id_token>> base_predicates; // the base predicates of the class..
std::vector<std::unique_ptr<statement>> body; // the body of the rule..
id_token name; // the name of the class..
std::vector<utils::pair<std::vector<id_token>, id_token>> parameters; // the type parameters of the class..
std::vector<std::vector<id_token>> base_predicates; // the base predicates of the class..
std::vector<std::unique_ptr<statement>> body; // the body of the rule..
};

class class_declaration final : public type_declaration
Expand Down
8 changes: 4 additions & 4 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ namespace riddle

if (constructors.empty())
{
std::vector<std::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the constructor..
std::vector<utils::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the constructor..
std::vector<init_element> inits; // the initializations of the fields..
std::vector<std::unique_ptr<statement>> body; // the body of the constructor..
constructors.emplace_back(std::make_unique<constructor_declaration>(std::move(parameters), std::move(inits), std::move(body)));
Expand Down Expand Up @@ -373,7 +373,7 @@ namespace riddle
std::unique_ptr<method_declaration> parser::parse_method_declaration()
{
std::vector<id_token> rt;
std::vector<std::pair<std::vector<id_token>, id_token>> params;
std::vector<utils::pair<std::vector<id_token>, id_token>> params;
std::vector<std::unique_ptr<statement>> stmts;

switch (tk->sym)
Expand Down Expand Up @@ -458,7 +458,7 @@ namespace riddle
}
std::unique_ptr<constructor_declaration> parser::parse_constructor_declaration()
{
std::vector<std::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the constructor..
std::vector<utils::pair<std::vector<id_token>, id_token>> parameters; // the parameters of the constructor..
std::vector<init_element> inits; // the initializations of the fields..
std::vector<std::unique_ptr<statement>> body; // the body of the constructor..

Expand Down Expand Up @@ -543,7 +543,7 @@ namespace riddle
}
std::unique_ptr<predicate_declaration> parser::parse_predicate_declaration()
{
std::vector<std::pair<std::vector<id_token>, id_token>> params;
std::vector<utils::pair<std::vector<id_token>, id_token>> params;
std::vector<std::vector<id_token>> base_predicates;
std::vector<std::unique_ptr<statement>> stmts;

Expand Down

0 comments on commit 1375b77

Please sign in to comment.