]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle escaped comment enders correctly in syntax.c, fixing bug #43558
authorAlan Mackenzie <acm@muc.de>
Wed, 23 Sep 2020 08:50:11 +0000 (08:50 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 23 Sep 2020 08:52:34 +0000 (08:52 +0000)
This fixes forward-comment, scan-lists, and parse-partial-sexp.

* src/syntax.c (forw_comment): Detect and skip an escaped comment ender
(e.g. \*/ in C) when comment-end-can-be-escaped is non-nil.

src/syntax.c

index e6af8a377bb5d656623efb37d7cb7706fad7b6e8..066972e6d88a48c337d8490bf698500d70b8d496 100644 (file)
@@ -2354,6 +2354,13 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
        /* We have encountered a nested comment of the same style
           as the comment sequence which began this comment section.  */
        nesting++;
+      if (comment_end_can_be_escaped
+          && (code == Sescape || code == Scharquote))
+        {
+          inc_both (&from, &from_byte);
+          UPDATE_SYNTAX_TABLE_FORWARD (from);
+          if (from == stop) continue; /* Failure */
+        }
       inc_both (&from, &from_byte);
       UPDATE_SYNTAX_TABLE_FORWARD (from);