cmark

My personal build of CMark ✏️

Commit
f953e0ea24f530650784f73d87cca1a2ea8baff1
Parent
6e8f0bf2d394f7dc444efe003e1b65610a57f30c
Author
John MacFarlane <jgm@berkeley.edu>
Date

DeMorgan simplification of some tests in emphasis parser.

This also brings the code into closer alignment with the wording of the spec.

See jgm/CommonMark#467.

Diffstat

1 file changed, 6 insertions, 6 deletions

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 12 6 6
diff --git a/src/inlines.c b/src/inlines.c
@@ -331,13 +331,13 @@ static int scan_delims(subject *subj, unsigned char c, bool *can_open,
     after_char = 10;
   }
   left_flanking = numdelims > 0 && !cmark_utf8proc_is_space(after_char) &&
-                  !(cmark_utf8proc_is_punctuation(after_char) &&
-                    !cmark_utf8proc_is_space(before_char) &&
-                    !cmark_utf8proc_is_punctuation(before_char));
+                  (!cmark_utf8proc_is_punctuation(after_char) ||
+                   cmark_utf8proc_is_space(before_char) ||
+                   cmark_utf8proc_is_punctuation(before_char));
   right_flanking = numdelims > 0 && !cmark_utf8proc_is_space(before_char) &&
-                   !(cmark_utf8proc_is_punctuation(before_char) &&
-                     !cmark_utf8proc_is_space(after_char) &&
-                     !cmark_utf8proc_is_punctuation(after_char));
+                   (!cmark_utf8proc_is_punctuation(before_char) ||
+                    cmark_utf8proc_is_space(after_char) ||
+                    cmark_utf8proc_is_punctuation(after_char));
   if (c == '_') {
     *can_open = left_flanking &&
                 (!right_flanking || cmark_utf8proc_is_punctuation(before_char));