| 85 | } |
| 86 | |
| 87 | void state::push(node&& data) |
| 88 | { |
| 89 | node& top = *m_stack.top().item; |
| 90 | if (top.is<array>()) |
| 91 | { |
| 92 | top.push(data); |
| 93 | if (data.is_container()) |
| 94 | { |
| 95 | m_last_container = &top.back(); |
| 96 | } |
| 97 | } |
| 98 | else if (top.is<object>()) |
| 99 | { |
| 100 | if (m_identifier.empty()) |
| 101 | { |
| 102 | // Template specialization |
| 103 | top.back().merge(data); |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | if (top.contains(m_identifier)) |
| 108 | { |
| 109 | // Object redefinition |
| 110 | top.at(m_identifier).merge(data); |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | top.insert(m_identifier, data); |
| 115 | } |
| 116 | if (data.is_container()) |
| 117 | { |
| 118 | m_last_container = &top.at(m_identifier); |
| 119 | } |
| 120 | } |
| 121 | m_identifier.clear(); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | throw std::runtime_error("Should not happen"); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | void state::push_template() |
| 130 | { |