summaryrefslogtreecommitdiff
path: root/src/expr.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-08 21:15:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-08 21:15:22 -0400
commitd4d7090f3c673f092fdc2bba54e41582c85cff8b (patch)
treede89e646001580cd1a3b1b6e9f87ca1b9654683e /src/expr.h
parent431c950c75c2046864abfde0175219d13ce1fb84 (diff)
downloadfork-ledger-d4d7090f3c673f092fdc2bba54e41582c85cff8b.tar.gz
fork-ledger-d4d7090f3c673f092fdc2bba54e41582c85cff8b.tar.bz2
fork-ledger-d4d7090f3c673f092fdc2bba54e41582c85cff8b.zip
Perhaps expr_t objects to remember their scope "context".
Diffstat (limited to 'src/expr.h')
-rw-r--r--src/expr.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/expr.h b/src/expr.h
index 6805e6d5..508e521a 100644
--- a/src/expr.h
+++ b/src/expr.h
@@ -87,14 +87,16 @@ public:
};
private:
- ptr_op_t ptr;
- string str;
- bool compiled;
+ ptr_op_t ptr;
+ scope_t * context;
+ string str;
+ bool compiled;
public:
expr_t();
expr_t(const expr_t& other);
- expr_t(const ptr_op_t& _ptr, const string& _str = "");
+ expr_t(const ptr_op_t& _ptr, scope_t * context = NULL,
+ const string& _str = "");
expr_t(const string& _str, const uint_least8_t flags = 0);
expr_t(std::istream& in, const uint_least8_t flags = 0);
@@ -110,6 +112,9 @@ public:
operator bool() const throw() {
return ptr.get() != NULL;
}
+
+ ptr_op_t get_op() throw();
+
string text() const throw() {
return str;
}
@@ -127,6 +132,15 @@ public:
value_t calc(scope_t& scope);
value_t calc(scope_t& scope) const;
+ value_t calc() {
+ assert(context);
+ return calc(*context);
+ }
+ value_t calc() const {
+ assert(context);
+ return calc(*context);
+ }
+
bool is_constant() const;
bool is_function() const;