commit 7d52889d7a0fa8e25c72fd229dddf561c4ec6942
parent ce6549282939619bd96dec5ab223225331d4f56f
Author: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
Date: Tue, 27 Sep 2022 19:58:09 +0330
ast,cgen: s/ast::As/ast::Ass/
Diffstat:
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/ast.cpp b/ast.cpp
@@ -36,9 +36,9 @@ operator<<(std::ostream& os, const Str& s)
}
std::ostream&
-operator<<(std::ostream& os, const As& a)
+operator<<(std::ostream& os, const Ass& a)
{
- os << "As{ " << a.id << " }";
+ os << "Ass{ " << a.id << " }";
return os;
}
@@ -60,8 +60,8 @@ operator<<(std::ostream& os, const Node& n)
os << std::get<Id>(n);
else if (std::holds_alternative<Str>(n))
os << std::get<Str>(n);
- else if (std::holds_alternative<As>(n))
- os << std::get<As>(n);
+ else if (std::holds_alternative<Ass>(n))
+ os << std::get<Ass>(n);
else if (std::holds_alternative<Call>(n))
os << std::get<Call>(n);
return os;
@@ -109,7 +109,7 @@ Nodes
mkass(Id id, Nodes expr)
{
Nodes f;
- auto it{ stlab::trailing_of(f.insert(f.end(), ast::As{ std::move(id) })) };
+ auto it{ stlab::trailing_of(f.insert(f.end(), ast::Ass{ std::move(id) })) };
f.splice(it, expr);
return f;
diff --git a/ast.hpp b/ast.hpp
@@ -34,7 +34,7 @@ struct Str
std::string str;
};
-struct As
+struct Ass
{
Id id;
};
@@ -44,7 +44,7 @@ struct Call
Id id;
};
-using Node = std::variant<Num, Op, Id, Str, As, Call>;
+using Node = std::variant<Num, Op, Id, Str, Ass, Call>;
std::ostream&
operator<<(std::ostream& os, const Num& n);
@@ -59,7 +59,7 @@ std::ostream&
operator<<(std::ostream& os, const Str& s);
std::ostream&
-operator<<(std::ostream& os, const As& a);
+operator<<(std::ostream& os, const Ass& a);
std::ostream&
operator<<(std::ostream& os, const Call& c);
diff --git a/ast.test.cpp b/ast.test.cpp
@@ -73,7 +73,7 @@ ast_1()
p(s);
assert(s ==
- "Num{ 1 } Num{ 2 } Op{ / } Num{ 3 } Num{ 4 } Op{ * } Op{ + } As{ "
+ "Num{ 1 } Num{ 2 } Op{ / } Num{ 3 } Num{ 4 } Op{ * } Op{ + } Ass{ "
"Id{ x } } ");
}
@@ -86,7 +86,7 @@ ast_1()
p(s);
assert(s ==
"Num{ 1 } Num{ 2 } Op{ + } Num{ 1 } Num{ 2 } Op{ / } Num{ 3 } Num{ "
- "4 } Op{ * } Op{ + } Op{ + } As{ Id{ y } } ");
+ "4 } Op{ * } Op{ + } Op{ + } Ass{ Id{ y } } ");
}
ast::Nodes eval1{ ast::mkcall(ast::Id{ "eval" },
diff --git a/cgen.cpp b/cgen.cpp
@@ -80,7 +80,7 @@ sexpr(ast::NodesIter first, ast::NodesIter last)
},
[&](const ast::Id& id) { oss << id.id; },
[&](const ast::Str& str) { oss << '"' << str.str << '"'; },
- [&](const ast::As& as) {
+ [&](const ast::Ass& as) {
auto f{ ++stlab::leading_of(first) };
auto l{ stlab::trailing_of(first) };
@@ -394,7 +394,7 @@ jitter_(JRoutine& r,
},
[&](const ast::Id& id) { r.pushvar(id.id.c_str()); },
[&](const ast::Str&) { assert(0 && "invalid entity"); },
- [&](const ast::As& as) {
+ [&](const ast::Ass& as) {
auto f{ ++stlab::leading_of(first) };
auto l{ stlab::trailing_of(first) };