emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e483115: Handle escaped comment enders correctly in syntax.c, fi


From: Alan Mackenzie
Subject: master e483115: Handle escaped comment enders correctly in syntax.c, fixing bug #43558
Date: Wed, 23 Sep 2020 04:53:39 -0400 (EDT)

branch: master
commit e4831151c2b746564319018105a17fbde4b553c6
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    Handle escaped comment enders correctly in syntax.c, fixing bug #43558
    
    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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/syntax.c b/src/syntax.c
index e6af8a3..066972e 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -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);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]