diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-19 16:22:31 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-19 16:22:31 -0400 |
commit | d67c9fee0f0f576481065c7d50182a04bf5df37e (patch) | |
tree | 4c2f22fccbfd2542f54e892f5c2332647f1d86b5 /src/item.cc | |
parent | 1c616f8626ceedf84a55749e44c8ef9e7bcbc402 (diff) | |
download | fork-ledger-d67c9fee0f0f576481065c7d50182a04bf5df37e.tar.gz fork-ledger-d67c9fee0f0f576481065c7d50182a04bf5df37e.tar.bz2 fork-ledger-d67c9fee0f0f576481065c7d50182a04bf5df37e.zip |
Added valexpr vars for accessing item position
- filename
- beg_line
- beg_pos
- end_line
- end_pos
Diffstat (limited to 'src/item.cc')
-rw-r--r-- | src/item.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/item.cc b/src/item.cc index a3375e9b..7621290a 100644 --- a/src/item.cc +++ b/src/item.cc @@ -209,6 +209,10 @@ namespace { return false; } + value_t get_pathname(item_t& item) { + return string_value(item.pathname.string()); + } + value_t get_beg_pos(item_t& item) { return long(item.beg_pos); } @@ -261,6 +265,13 @@ value_t get_comment(item_t& item) expr_t::ptr_op_t item_t::lookup(const string& name) { switch (name[0]) { + case 'b': + if (name == "beg_line") + return WRAP_FUNCTOR(get_wrapper<&get_beg_line>); + else if (name == "beg_pos") + return WRAP_FUNCTOR(get_wrapper<&get_beg_pos>); + break; + case 'c': if (name == "cleared") return WRAP_FUNCTOR(get_wrapper<&get_cleared>); @@ -275,6 +286,18 @@ expr_t::ptr_op_t item_t::lookup(const string& name) return WRAP_FUNCTOR(get_wrapper<&get_depth>); break; + case 'e': + if (name == "end_line") + return WRAP_FUNCTOR(get_wrapper<&get_end_line>); + else if (name == "end_pos") + return WRAP_FUNCTOR(get_wrapper<&get_end_pos>); + break; + + case 'f': + if (name == "filename") + return WRAP_FUNCTOR(get_wrapper<&get_pathname>); + break; + case 'h': if (name == "has_tag") return WRAP_FUNCTOR(ledger::has_tag); |