summaryrefslogtreecommitdiff
path: root/src/iterator.h
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2015-01-10 16:10:35 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2015-01-10 17:40:13 +0100
commit009c3847f004fda437dd5376a9452973b1cb913e (patch)
treef1e51be8affaa4c46231fd10590acc674b21bf16 /src/iterator.h
parentd548d56d604193e4eebb4ab81c347887763b7d69 (diff)
Rework iterators
* Advance to the next node when calling 'cmark_iter_next', not when calling 'cmark_iter_get_node'. * Add 'cmark_iter_get_event_type' accessor. * Allow deletion of nodes after an 'EXIT' event, or an 'ENTER' event for leaf nodes.
Diffstat (limited to 'src/iterator.h')
-rw-r--r--src/iterator.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/iterator.h b/src/iterator.h
index bf53112..027b10b 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -6,12 +6,16 @@ extern "C" {
#endif
#include "cmark.h"
-#include "node.h"
+
+typedef struct {
+ cmark_event_type ev_type;
+ cmark_node *node;
+} cmark_iter_state;
struct cmark_iter {
- cmark_node *current;
cmark_node *root;
- cmark_event_type event_type;
+ cmark_iter_state cur;
+ cmark_iter_state next;
};
#ifdef __cplusplus