diff options
-rw-r--r-- | src/option.h | 1 | ||||
-rw-r--r-- | src/scope.h | 3 | ||||
-rw-r--r-- | src/value.h | 10 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/option.h b/src/option.h index 0600779c..7e2e0629 100644 --- a/src/option.h +++ b/src/option.h @@ -190,6 +190,7 @@ public: virtual value_t operator()(call_scope_t& args) { if (! args.empty()) { + args.push_front(string_value("?expr")); return handler_wrapper(args); } else if (wants_arg) { diff --git a/src/scope.h b/src/scope.h index f7c2f46b..36eb54f1 100644 --- a/src/scope.h +++ b/src/scope.h @@ -196,6 +196,9 @@ public: return args[index]; } + void push_front(const value_t& val) { + args.push_front(val); + } void push_back(const value_t& val) { args.push_back(val); } diff --git a/src/value.h b/src/value.h index a0bb533d..0993305e 100644 --- a/src/value.h +++ b/src/value.h @@ -87,7 +87,7 @@ public: * The sequence_t member type abstracts the type used to represent a * resizable "array" of value_t objects. */ - typedef std::vector<value_t> sequence_t; + typedef std::deque<value_t> sequence_t; typedef sequence_t::iterator iterator; typedef sequence_t::const_iterator const_iterator; typedef sequence_t::difference_type difference_type; @@ -800,6 +800,14 @@ public: return null; } + void push_front(const value_t& val) { + if (is_null()) + *this = sequence_t(); + if (! is_sequence()) + in_place_cast(SEQUENCE); + as_sequence_lval().push_front(val); + } + void push_back(const value_t& val) { if (is_null()) *this = sequence_t(); |