Updated OnDemand logic (markdown)

Daniel Lemire 2021-04-05 10:33:25 -04:00
parent 2ef3a37f21
commit c97de3e107
1 changed files with 12 additions and 5 deletions

@ -12,15 +12,22 @@ The depth is set in the following functions:
1. reenter_child
2. abandon (sets the depth to 0)
The child() method in value_iterator will return a value_iterator which is set at depth() + 1. In turn, the child() method is called by
1. operator*() in the array iterator (thus ensuring that values accessed from the array are at depth() + 1 compared to the array).
2. by find_field_unordered and find_field in the object class. Note that the operator[] in object calls find_field_unordered.
3. by field.start
The depth is incremented in these instances:
1. when encountering a colon in field_value()
1. when encountering a colon in field_value().
2. in started_array() when it is not an empty array. Note that started_object does not similarly increment the depth.
3. in has_next_element() when encountering a comma. Note that a comma in an object does not change the depth (see has_next_field())
3. in has_next_element() when encountering a comma. Note that a comma in an object does not change the depth (see has_next_field()).
The depth is decremented in these instances:
1. When an object is closed by } (in started_object(), in has_next_field())
2. When an array is closed by ] (in started_array(), in has_next_element())
3. In advance_start(), in advance_root_scalar(), in advance_non_root_scalar()
1. When an object is closed by } (in started_object(), in has_next_field()).
2. When an array is closed by ] (in started_array(), in has_next_element()).
3. In advance_start(), in advance_root_scalar(), in advance_non_root_scalar().
Skip child will, as a first step, decrement the depth when encountering },] or an atom (anything that does not start with [,{,:, or the comma), and then scan the structural elements, incrementing on [,{ and decrementing on },].