This commit is contained in:
aozhiwei 2023-03-04 10:07:01 +08:00
parent bb2f76674d
commit b075c000c2
2 changed files with 7 additions and 2 deletions

View File

@ -158,6 +158,9 @@ namespace a8
if (token == "(") { if (token == "(") {
List new_list = std::make_shared<std::vector<std::shared_ptr<Value>>>(); List new_list = std::make_shared<std::vector<std::shared_ptr<Value>>>();
stack.push_back(new_list); stack.push_back(new_list);
if (depth >= 0) {
stack.at(depth)->push_back(std::make_shared<Value>(new_list));
}
++depth; ++depth;
} else if (token == ")") { } else if (token == ")") {
--depth; --depth;
@ -178,7 +181,9 @@ namespace a8
} }
stack.at(depth)->push_back(symbol); stack.at(depth)->push_back(symbol);
} else { } else {
abort(); Symbol symbol;
symbol.name = token;
stack.at(depth)->push_back(std::make_shared<Value>(symbol));
} }
} }
} }

View File

@ -47,7 +47,7 @@ namespace a8
a8::XObject ToXObject(); a8::XObject ToXObject();
}; };
class Scope class Scope : public std::enable_shared_from_this<Scope>
{ {
public: public:
std::shared_ptr<Value> Find(const std::string& name); std::shared_ptr<Value> Find(const std::string& name);