This commit is contained in:
aozhiwei 2023-03-05 11:43:46 +08:00
parent c4610bed76
commit abee0bed17
2 changed files with 6 additions and 0 deletions

View File

@ -200,6 +200,11 @@ namespace a8
return std::make_shared<Value>(stack[0]);
}
bool Expr::MaybeExpr(const std::string& script)
{
return script.find('(') != std::string::npos;
}
/*
1: token
-1: end

View File

@ -77,6 +77,7 @@ namespace a8
static std::shared_ptr<Value> Compile(const std::string& script, std::shared_ptr<Scope> env);
static std::shared_ptr<Value> Eval(std::shared_ptr<Value> x, std::shared_ptr<Scope> env);
static bool MaybeExpr(const std::string& script);
private:
static int GetToken(const std::string& script, int& pos, std::string& token);