aboutsummaryrefslogtreecommitdiffstats
path: root/src/tuplr.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tuplr.hpp')
-rw-r--r--src/tuplr.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tuplr.hpp b/src/tuplr.hpp
index de025b7..5deff71 100644
--- a/src/tuplr.hpp
+++ b/src/tuplr.hpp
@@ -61,11 +61,21 @@ struct Error {
string msg;
};
-/// Expression ::= Atom | (SubExp*)
+/// Expression ::= Atom | (Expression*)
template<typename Atom>
-struct Exp : public std::vector< Exp<Atom> > {
+struct Exp : private std::vector< Exp<Atom> > {
Exp(Cursor c) : type(LIST), loc(c) {}
Exp(Cursor c, const Atom& a) : type(ATOM), loc(c), atom(a) {}
+
+ void push_back(const Exp<Atom>& exp) { vector< Exp<Atom> >::push_back(exp); }
+
+ bool empty() const { return vector< Exp<Atom> >::empty(); }
+ const Exp<Atom>& front() const { return vector< Exp<Atom> >::front(); }
+
+ typedef typename vector< Exp<Atom> >::const_iterator const_iterator;
+ const_iterator begin() const { return vector< Exp<Atom> >::begin(); }
+ const_iterator end() const { return vector< Exp<Atom> >::end(); }
+
enum { ATOM, LIST } type;
Cursor loc;
Atom atom;