|
1 | | -/* auto-generated on Wed 6 Mar 11:05:32 AEDT 2019. Do not edit! */ |
| 1 | +/* auto-generated on Fri Mar 8 19:04:53 PST 2019. Do not edit! */ |
2 | 2 | #include "simdjson.h" |
3 | 3 |
|
4 | 4 | /* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */ |
@@ -1626,31 +1626,30 @@ uint8_t ParsedJson::iterator::get_scope_type() const { |
1626 | 1626 | } |
1627 | 1627 |
|
1628 | 1628 | bool ParsedJson::iterator::move_forward() { |
1629 | | - if(location + 1 >= tape_length) { |
1630 | | - return false; // we are at the end! |
1631 | | - } |
1632 | | - // we are entering a new scope |
1633 | | - if ((current_type == '[') || (current_type == '{')){ |
1634 | | - depth++; |
1635 | | - depthindex[depth].start_of_scope = location; |
1636 | | - depthindex[depth].scope_type = current_type; |
1637 | | - } |
1638 | | - location = location + 1; |
1639 | | - current_val = pj.tape[location]; |
1640 | | - current_type = (current_val >> 56); |
1641 | | - // if we encounter a scope closure, we need to move up |
1642 | | - while ((current_type == ']') || (current_type == '}')) { |
1643 | 1629 | if(location + 1 >= tape_length) { |
1644 | 1630 | return false; // we are at the end! |
1645 | 1631 | } |
1646 | | - depth--; |
1647 | | - if(depth == 0) { |
1648 | | - return false; // should not be necessary |
| 1632 | + |
| 1633 | + if ((current_type == '[') || (current_type == '{')){ |
| 1634 | + // We are entering a new scope |
| 1635 | + depth++; |
| 1636 | + depthindex[depth].start_of_scope = location; |
| 1637 | + depthindex[depth].scope_type = current_type; |
| 1638 | + } else if ((current_type == ']') || (current_type == '}')) { |
| 1639 | + // Leaving a scope. |
| 1640 | + depth--; |
| 1641 | + if(depth == 0) { |
| 1642 | + // Should not be necessary |
| 1643 | + return false; |
| 1644 | + } |
| 1645 | + } else if ((current_type == 'd') || (current_type == 'l')) { |
| 1646 | + // d and l types use 2 locations on the tape, not just one. |
| 1647 | + location += 1; |
1649 | 1648 | } |
1650 | | - location = location + 1; |
| 1649 | + |
| 1650 | + location += 1; |
1651 | 1651 | current_val = pj.tape[location]; |
1652 | 1652 | current_type = (current_val >> 56); |
1653 | | - } |
1654 | 1653 | return true; |
1655 | 1654 | } |
1656 | 1655 |
|
|
0 commit comments