aboutsummaryrefslogtreecommitdiffstats
path: root/src/resp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resp.hpp')
-rw-r--r--src/resp.hpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/resp.hpp b/src/resp.hpp
index 34106f4..752796b 100644
--- a/src/resp.hpp
+++ b/src/resp.hpp
@@ -87,18 +87,14 @@ struct Env : public list< vector< pair<K,V> > > {
return &b->second;
return NULL;
}
- bool topLevel(const K& key) const {
- for (typename Frame::const_iterator b = this->back().begin(); b != this->back().end(); ++b)
- if (b->first == key)
- return true;
- return false;
- }
- bool innermost(const K& key) const {
- for (typename Frame::const_iterator b = this->front().begin(); b != this->front().end(); ++b)
+ bool contains(const Frame& frame, const K& key) const {
+ for (typename Frame::const_iterator b = frame.begin(); b != frame.end(); ++b)
if (b->first == key)
return true;
return false;
}
+ bool topLevel(const K& key) const { return contains(this->back(), key); }
+ bool innermost(const K& key) const { return contains(this->front(), key); }
};
template<typename K, typename V>
@@ -119,7 +115,7 @@ ostream& operator<<(ostream& out, const Env<K,V>& env) {
* Lexer: Text (istream) -> S-Expressions (SExp) *
***************************************************************************/
-class AST;
+struct AST;
AST* readExpression(Cursor& cur, std::istream& in);