void do_null_value(const basic_parsing_context<char_type>&) override { stack_[top_].value_ = null_type(); if (++top_ >= stack_.size()) { stack_.resize(top_*2); } }
VerificationType VerificationType::from_tag(u1 tag) { switch (tag) { case ITEM_Top: return bogus_type(); case ITEM_Integer: return integer_type(); case ITEM_Float: return float_type(); case ITEM_Double: return double_type(); case ITEM_Long: return long_type(); case ITEM_Null: return null_type(); default: ShouldNotReachHere(); return bogus_type(); } }
inline basic_val<T>& basic_val<T>::operator[](string const& s) { if (type() != type_info::object) throw std::invalid_argument("not an object"); auto it = std::find_if(o_.begin(), o_.end(), [&s](pair const& p){ return p.first == s; }); if (it != o_.end()) return it->second; o_.push_back(pair(s, null_type())); return o_.back().second; }
T build(std::size_t& start) { typename base_type::item const& si = this->container()[start++]; switch ((kind)si.type()) { case kind::string : return string_type{si.begin(), si.end()}; case kind::integer : return std::stoi(string_type{si.begin(), si.end()}); case kind::decimal : return std::stod(string_type{si.begin(), si.end()}); case kind::true_ : return true; case kind::false_ : return false; case kind::object : { T o = empty_object; //{}; auto& ro = get<typename T::object>(o); ro.reserve(si.delta()/2); std::size_t const e = start+si.delta(); for ( ; start != e;) { typename base_type::item const& t = this->container()[start++]; ro.emplace_back(string_type{t.begin(), t.end()}, build<T>(start)); } return o; } case kind::array : { T a = empty_array; auto& ra = get<typename T::array>(a); ra.reserve(si.delta()); std::size_t const e = start+si.delta(); for ( ; start != e;) ra.push_back(build<T>(start)); return a; } default : break; } return null_type(); }
bool parser::parse_null(context& ctx, null_type& value, IteratorType& ch, IteratorType end) { if (check_char(ctx, 'n', ch, end)) { if (check_char(ctx, 'u', ch, end)) { if (check_char(ctx, 'l', ch, end)) { if (check_char(ctx, 'l', ch, end)) { value = null_type(); return true; } } } } return false; }
void push(lua_State* interpreter, T& value) { push(interpreter, value, null_type()); }
virtual void do_null_value(const basic_parsing_context<Char>& context) { writer_->value(null_type()); }
virtual void do_null_value(const basic_parsing_context<Char>& context) { parent_->value(null_type(),context); }