diff options
| author | Alan Mackenzie | 2020-09-23 08:50:11 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2020-09-23 08:52:34 +0000 |
| commit | e4831151c2b746564319018105a17fbde4b553c6 (patch) | |
| tree | e0a2e3d05d444e11890f842a4602528d78dcf144 | |
| parent | 80b0a69b606c9beb738fe797a13d23ca28c4f09d (diff) | |
| download | emacs-e4831151c2b746564319018105a17fbde4b553c6.tar.gz emacs-e4831151c2b746564319018105a17fbde4b553c6.zip | |
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.
| -rw-r--r-- | src/syntax.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/syntax.c b/src/syntax.c index e6af8a377bb..066972e6d88 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, | |||
| 2354 | /* We have encountered a nested comment of the same style | 2354 | /* We have encountered a nested comment of the same style |
| 2355 | as the comment sequence which began this comment section. */ | 2355 | as the comment sequence which began this comment section. */ |
| 2356 | nesting++; | 2356 | nesting++; |
| 2357 | if (comment_end_can_be_escaped | ||
| 2358 | && (code == Sescape || code == Scharquote)) | ||
| 2359 | { | ||
| 2360 | inc_both (&from, &from_byte); | ||
| 2361 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2362 | if (from == stop) continue; /* Failure */ | ||
| 2363 | } | ||
| 2357 | inc_both (&from, &from_byte); | 2364 | inc_both (&from, &from_byte); |
| 2358 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2365 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2359 | 2366 | ||