summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-29 14:55:14 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-29 14:55:14 +0200
commitf953e0ea24f530650784f73d87cca1a2ea8baff1 (patch)
tree01084b632dbde1711fd349ee0348ddbbfb73ee21
parent6e8f0bf2d394f7dc444efe003e1b65610a57f30c (diff)
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.
-rw-r--r--src/inlines.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/inlines.c b/src/inlines.c
index eea0631..f5b0621 100644
--- 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));