diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2015-01-08 10:29:09 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2015-01-08 10:29:09 -0800 |
commit | 363c25c0a5584c0f936aaa9481b2130e29afa291 (patch) | |
tree | 02e3c545e657cedf1e3ddcea5e591ec2875c515b /src/cmark.h | |
parent | 8713ff912aaf13926d799d7cbd61e5cf014ddb7e (diff) |
Added `cmark_iter_reset` and a note about handling destructive updates.
Diffstat (limited to 'src/cmark.h')
-rw-r--r-- | src/cmark.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmark.h b/src/cmark.h index 45bc338..84a15c8 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -163,6 +163,11 @@ cmark_node_last_child(cmark_node *node); * * cmark_iter_free(iter); * } + * + * Note that if you delete the current node, its first child, or its + * next sibling, the iterator may point to a nonexistent note. + * Use 'cmark_iter_reset' to set its pointer to the next node that + * should be traversed. */ /** Creates a new iterator starting at 'root'. @@ -177,6 +182,15 @@ CMARK_EXPORT void cmark_iter_free(cmark_iter *iter); +/** Resets the iterator so that the current node is 'current' and + the event type is 'event_type'. Use this to resume after destructively + modifying the tree structure. + */ +CMARK_EXPORT +void +cmark_iter_reset(cmark_iter *iter, cmark_node *current, + cmark_event_type event_type); + /** Returns the event type (`CMARK_EVENT_ENTER`, `CMARK_EVENT_EXIT`, * or `CMARK_EVENT_DONE`) for the next node. */ |