Skip to content

Commit 268b884

Browse files
committed
Document tape_builder
1 parent 74c4799 commit 268b884

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

src/generic/stage2/tape_builder.h

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,47 @@ struct tape_builder {
1212
dom_parser_implementation &dom_parser,
1313
dom::document &doc) noexcept;
1414

15-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_primitive(json_iterator &iter, const uint8_t *value) noexcept;
16-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_primitive(json_iterator &iter, const uint8_t *value) noexcept;
17-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_empty_object(json_iterator &iter) noexcept;
18-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_empty_array(json_iterator &iter) noexcept;
19-
15+
/** Called when a non-empty document starts. */
2016
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_document_start(json_iterator &iter) noexcept;
21-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_object_start(json_iterator &iter) noexcept;
22-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_array_start(json_iterator &iter) noexcept;
17+
/** Called when a non-empty document ends without error. */
18+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_document_end(json_iterator &iter) noexcept;
2319

24-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_object_end(json_iterator &iter) noexcept;
20+
/** Called when a non-empty array starts. */
21+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_array_start(json_iterator &iter) noexcept;
22+
/** Called when a non-empty array ends. */
2523
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_array_end(json_iterator &iter) noexcept;
26-
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_document_end(json_iterator &iter) noexcept;
24+
/** Called when an empty array is found. */
25+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_empty_array(json_iterator &iter) noexcept;
26+
27+
/** Called when a non-empty object starts. */
28+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_object_start(json_iterator &iter) noexcept;
29+
/**
30+
* Called when a key in a field is encountered.
31+
*
32+
* primitive, visit_object_start, visit_empty_object, visit_array_start, or visit_empty_array
33+
* will be called after this with the field value.
34+
*/
2735
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_key(json_iterator &iter, const uint8_t *key) noexcept;
36+
/** Called when a non-empty object ends. */
37+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_object_end(json_iterator &iter) noexcept;
38+
/** Called when an empty object is found. */
39+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_empty_object(json_iterator &iter) noexcept;
40+
41+
/**
42+
* Called when a string, number, boolean or null is found.
43+
*/
44+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_primitive(json_iterator &iter, const uint8_t *value) noexcept;
45+
/**
46+
* Called when a string, number, boolean or null is found at the top level of a document (i.e.
47+
* when there is no array or object and the entire document is a single string, number, boolean or
48+
* null.
49+
*
50+
* This is separate from primitive() because simdjson's normal primitive parsing routines assume
51+
* there is at least one more token after the value, which is only true in an array or object.
52+
*/
53+
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_primitive(json_iterator &iter, const uint8_t *value) noexcept;
2854

29-
// increment_count increments the count of keys in an object or values in an array.
55+
/** Called each time a new field or element in an array or object is found. */
3056
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code increment_count(json_iterator &iter) noexcept;
3157

3258
private:

0 commit comments

Comments
 (0)