aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorKarl Heuer1997-11-23 02:18:34 +0000
committerKarl Heuer1997-11-23 02:18:34 +0000
commit527a32d98e078c467a154987e545e78da6a2de4f (patch)
tree3f95290bc44205a1a84a78bf19d781a91e6170fa /src/syntax.c
parent1817145f6df6ec50f97d7c3dba46f943cf9c8e38 (diff)
downloademacs-527a32d98e078c467a154987e545e78da6a2de4f.tar.gz
emacs-527a32d98e078c467a154987e545e78da6a2de4f.zip
(back_comment): Handle 2-char comment starts
when reaching the first of the pair.
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 3c480b41b0d..58932ff24a1 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -333,12 +333,13 @@ find_defun_start (pos)
333 return find_start_value; 333 return find_start_value;
334} 334}
335 335
336/* Checks whether FROM is the end of comment. Does not try to 336/* Checks whether FROM is at the end of a comment;
337 fallback more than to STOP. 337 and if so, returns position of the start of the comment.
338 Returns -1 if cannot find comment ending at from, otherwise start 338 But does not move back before STOP.
339 of comment. Global syntax data remains valid for 339 Returns -1 if there is no comment ending at FROM.
340 backward search starting at the returned value (or at FROM, if 340
341 the search was not successful). */ 341 Global syntax data remains valid for backward search starting at
342 the returned value (or at FROM, if the search was not successful). */
342 343
343static int 344static int
344back_comment (from, stop, comstyle) 345back_comment (from, stop, comstyle)
@@ -374,7 +375,7 @@ back_comment (from, stop, comstyle)
374 c = FETCH_CHAR (from); 375 c = FETCH_CHAR (from);
375 code = SYNTAX (c); 376 code = SYNTAX (c);
376 377
377 /* If this char is the second of a 2-char comment sequence, 378 /* If this char is the second of a 2-char comment end sequence,
378 back up and give the pair the appropriate syntax. */ 379 back up and give the pair the appropriate syntax. */
379 if (from > stop && SYNTAX_COMEND_SECOND (c) 380 if (from > stop && SYNTAX_COMEND_SECOND (c)
380 && SYNTAX_COMEND_FIRST (FETCH_CHAR (from - 1))) 381 && SYNTAX_COMEND_FIRST (FETCH_CHAR (from - 1)))
@@ -388,16 +389,10 @@ back_comment (from, stop, comstyle)
388 389
389 /* If this char starts a 2-char comment start sequence, 390 /* If this char starts a 2-char comment start sequence,
390 treat it like a 1-char comment starter. */ 391 treat it like a 1-char comment starter. */
391 if (from < scanstart && SYNTAX_COMSTART_SECOND (c) 392 if (from < scanstart && SYNTAX_COMSTART_FIRST (c)
392 && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from - 1)) 393 && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from + 1))
393 && comstyle == SYNTAX_COMMENT_STYLE (c)) 394 && comstyle == SYNTAX_COMMENT_STYLE (FETCH_CHAR (from + 1)))
394 { 395 code = Scomment;
395 code = Scomment;
396 DEC_POS (from);
397 /* This is apparently the best we can do: */
398 UPDATE_SYNTAX_TABLE_BACKWARD (from);
399 c = FETCH_CHAR (from);
400 }
401 396
402 /* Ignore escaped characters. */ 397 /* Ignore escaped characters. */
403 if (char_quoted (from)) 398 if (char_quoted (from))