summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-04-04 02:28:07 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-04-04 02:28:07 -0500
commit322d55823e682766e15adaaf54907a42d5ae4ab2 (patch)
treeddfd95468f9d4d7164eadbfff641bc121efca8e6 /src
parent5a615ec680190222e25047366f166f9daf89c69f (diff)
downloadfork-ledger-322d55823e682766e15adaaf54907a42d5ae4ab2.tar.gz
fork-ledger-322d55823e682766e15adaaf54907a42d5ae4ab2.tar.bz2
fork-ledger-322d55823e682766e15adaaf54907a42d5ae4ab2.zip
post.x = y defines metadata tag x
Diffstat (limited to 'src')
-rw-r--r--src/item.cc7
-rw-r--r--src/item.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/item.cc b/src/item.cc
index 5262d1db..17d46652 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -398,6 +398,13 @@ value_t get_comment(item_t& item)
}
}
+void item_t::define(const symbol_t::kind_t, const string& name,
+ expr_t::ptr_op_t def)
+{
+ bind_scope_t bound_scope(*scope_t::default_scope, *this);
+ set_tag(name, def->calc(bound_scope));
+}
+
expr_t::ptr_op_t item_t::lookup(const symbol_t::kind_t kind,
const string& name)
{
diff --git a/src/item.h b/src/item.h
index c56fba27..8d9a79ee 100644
--- a/src/item.h
+++ b/src/item.h
@@ -216,6 +216,8 @@ public:
return _state;
}
+ virtual void define(const symbol_t::kind_t, const string&,
+ expr_t::ptr_op_t);
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind,
const string& name);