From abee0bed17773019250dc4ed042fa8fd8763cf23 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 5 Mar 2023 11:43:46 +0800 Subject: [PATCH] 1 --- a8/lisp.cc | 5 +++++ a8/lisp.h | 1 + 2 files changed, 6 insertions(+) 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);