md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
git clone https://noulin.net/git/md4c.git
Log | Files | Refs | README | LICENSE

commit 3c28a8b8dbe7315c46c83c13d2618ba1f3d35a4a
parent 3688e0fc6596a1a107196d7d5d79d70b89fec212
Author: Martin Mitas <mity@morous.org>
Date:   Wed,  4 Jan 2017 14:29:50 +0100

md_rollback: Do not play with the mark flag MD_MARK_LEAF.

And remove the flag altogether.

Diffstat:
Mmd4c/md4c.c | 18++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -2158,7 +2158,6 @@ struct MD_MARK_tag { #define MD_MARK_OPENER 0x04 /* Definitely opener. */ #define MD_MARK_CLOSER 0x08 /* Definitely closer. */ #define MD_MARK_RESOLVED 0x10 /* Resolved in any definite way. */ -#define MD_MARK_LEAF 0x20 /* Pair does not contain any nested spans. */ /* Mark flags specific for various mark types (so they can share bits). */ #define MD_MARK_INTRAWORD 0x40 /* Helper for emphasis '*', '_' ("the rule of 3"). */ @@ -2322,7 +2321,7 @@ md_rollback(MD_CTX* ctx, int opener_index, int closer_index, int how) MD_MARK* mark_opener = &ctx->marks[mark_opener_index]; MD_MARKCHAIN* chain; - mark_opener->flags &= ~(MD_MARK_OPENER | MD_MARK_CLOSER | MD_MARK_RESOLVED | MD_MARK_LEAF); + mark_opener->flags &= ~(MD_MARK_OPENER | MD_MARK_CLOSER | MD_MARK_RESOLVED); switch(mark_opener->ch) { case '*': chain = &ASTERISK_OPENERS; break; @@ -2339,7 +2338,7 @@ md_rollback(MD_CTX* ctx, int opener_index, int closer_index, int how) /* And reset our flags. */ if(discard_flag) - mark->flags &= ~(MD_MARK_OPENER | MD_MARK_CLOSER | MD_MARK_RESOLVED | MD_MARK_LEAF); + mark->flags &= ~(MD_MARK_OPENER | MD_MARK_CLOSER | MD_MARK_RESOLVED); /* Jump as far as we can over unresolved or non-interesting marks. */ switch(how) { @@ -2351,24 +2350,11 @@ md_rollback(MD_CTX* ctx, int opener_index, int closer_index, int how) break; } /* Pass through. */ - case MD_ROLLBACK_ALL: - if((mark_flags & (MD_MARK_CLOSER | MD_MARK_LEAF)) == (MD_MARK_CLOSER | MD_MARK_LEAF)) { - /* If we are closer and now there is no nested resolved mark - * we can also jump right to our opener. */ - mark_index = mark->prev; - break; - } - /* Pass through. */ default: mark_index--; break; } } - - if(how == MD_ROLLBACK_ALL) { - ctx->marks[opener_index].flags |= MD_MARK_LEAF; - ctx->marks[closer_index].flags |= MD_MARK_LEAF; - } } /* Split a longer mark into two. The new mark takes the given count of characters.