Skip to content

Commit f953e0e

Browse files
committed
DeMorgan simplification of some tests in emphasis parser.
This also brings the code into closer alignment with the wording of the spec. See commonmark/commonmark-spec#467.
1 parent 6e8f0bf commit f953e0e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/inlines.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,13 @@ static int scan_delims(subject *subj, unsigned char c, bool *can_open,
331331
after_char = 10;
332332
}
333333
left_flanking = numdelims > 0 && !cmark_utf8proc_is_space(after_char) &&
334-
!(cmark_utf8proc_is_punctuation(after_char) &&
335-
!cmark_utf8proc_is_space(before_char) &&
336-
!cmark_utf8proc_is_punctuation(before_char));
334+
(!cmark_utf8proc_is_punctuation(after_char) ||
335+
cmark_utf8proc_is_space(before_char) ||
336+
cmark_utf8proc_is_punctuation(before_char));
337337
right_flanking = numdelims > 0 && !cmark_utf8proc_is_space(before_char) &&
338-
!(cmark_utf8proc_is_punctuation(before_char) &&
339-
!cmark_utf8proc_is_space(after_char) &&
340-
!cmark_utf8proc_is_punctuation(after_char));
338+
(!cmark_utf8proc_is_punctuation(before_char) ||
339+
cmark_utf8proc_is_space(after_char) ||
340+
cmark_utf8proc_is_punctuation(after_char));
341341
if (c == '_') {
342342
*can_open = left_flanking &&
343343
(!right_flanking || cmark_utf8proc_is_punctuation(before_char));

0 commit comments

Comments
 (0)