diff --git a/a8/lisp.cc b/a8/lisp.cc index a807dd7..e306d41 100644 --- a/a8/lisp.cc +++ b/a8/lisp.cc @@ -200,6 +200,11 @@ namespace a8 return std::make_shared(stack[0]); } + bool Expr::MaybeExpr(const std::string& script) + { + return script.find('(') != std::string::npos; + } + /* 1: token -1: end diff --git a/a8/lisp.h b/a8/lisp.h index 82cc5f9..1c63858 100644 --- a/a8/lisp.h +++ b/a8/lisp.h @@ -77,6 +77,7 @@ namespace a8 static std::shared_ptr Compile(const std::string& script, std::shared_ptr env); static std::shared_ptr Eval(std::shared_ptr x, std::shared_ptr env); + static bool MaybeExpr(const std::string& script); private: static int GetToken(const std::string& script, int& pos, std::string& token);