diff options
| author | Richard M. Stallman | 1994-06-24 21:52:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-06-24 21:52:16 +0000 |
| commit | 4841063fd95b365d2f71055b23ea6b0e79784cbe (patch) | |
| tree | e64124c27ec40d6d4c7ed3c6bed3bb4d7929c7bd /src/syntax.c | |
| parent | b2e609ff8c45986882b75a17df4f1cff760b0065 (diff) | |
| download | emacs-4841063fd95b365d2f71055b23ea6b0e79784cbe.tar.gz emacs-4841063fd95b365d2f71055b23ea6b0e79784cbe.zip | |
(scan_lists, Fforward_comment): When moving backward over
a comment, ignore a comment-starter that overlaps the comment-ender.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/syntax.c b/src/syntax.c index d3a37f9dd4f..9108f727cc4 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -746,6 +746,7 @@ between them, return t; otherwise return nil.") | |||
| 746 | int comment_end = from; | 746 | int comment_end = from; |
| 747 | int comstart_pos = 0; | 747 | int comstart_pos = 0; |
| 748 | int comstart_parity = 0; | 748 | int comstart_parity = 0; |
| 749 | int scanstart = from - 1; | ||
| 749 | 750 | ||
| 750 | /* At beginning of range to scan, we're outside of strings; | 751 | /* At beginning of range to scan, we're outside of strings; |
| 751 | that determines quote parity to the comment-end. */ | 752 | that determines quote parity to the comment-end. */ |
| @@ -764,15 +765,15 @@ between them, return t; otherwise return nil.") | |||
| 764 | { | 765 | { |
| 765 | code = Sendcomment; | 766 | code = Sendcomment; |
| 766 | from--; | 767 | from--; |
| 768 | c = FETCH_CHAR (from); | ||
| 767 | } | 769 | } |
| 768 | 770 | ||
| 769 | else if (from > stop && SYNTAX_COMSTART_SECOND (c) | 771 | /* If this char starts a 2-char comment start sequence, |
| 770 | && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from - 1)) | 772 | treat it like a 1-char comment starter. */ |
| 771 | && comstyle == SYNTAX_COMMENT_STYLE (c)) | 773 | if (from < scanstart && SYNTAX_COMSTART_FIRST (c) |
| 772 | { | 774 | && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from + 1)) |
| 773 | code = Scomment; | 775 | && comstyle == SYNTAX_COMMENT_STYLE (FETCH_CHAR (from + 1))) |
| 774 | from--; | 776 | code = Scomment; |
| 775 | } | ||
| 776 | 777 | ||
| 777 | /* Ignore escaped characters. */ | 778 | /* Ignore escaped characters. */ |
| 778 | if (char_quoted (from)) | 779 | if (char_quoted (from)) |
| @@ -1150,6 +1151,7 @@ scan_lists (from, count, depth, sexpflag) | |||
| 1150 | int comment_end = from; | 1151 | int comment_end = from; |
| 1151 | int comstart_pos = 0; | 1152 | int comstart_pos = 0; |
| 1152 | int comstart_parity = 0; | 1153 | int comstart_parity = 0; |
| 1154 | int scanstart = from - 1; | ||
| 1153 | 1155 | ||
| 1154 | /* At beginning of range to scan, we're outside of strings; | 1156 | /* At beginning of range to scan, we're outside of strings; |
| 1155 | that determines quote parity to the comment-end. */ | 1157 | that determines quote parity to the comment-end. */ |
| @@ -1168,15 +1170,15 @@ scan_lists (from, count, depth, sexpflag) | |||
| 1168 | { | 1170 | { |
| 1169 | code = Sendcomment; | 1171 | code = Sendcomment; |
| 1170 | from--; | 1172 | from--; |
| 1173 | c = FETCH_CHAR (from); | ||
| 1171 | } | 1174 | } |
| 1172 | 1175 | ||
| 1173 | else if (from > stop && SYNTAX_COMSTART_SECOND (c) | 1176 | /* If this char starts a 2-char comment start sequence, |
| 1174 | && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from - 1)) | 1177 | treat it like a 1-char comment starter. */ |
| 1175 | && comstyle == SYNTAX_COMMENT_STYLE (c)) | 1178 | if (from < scanstart && SYNTAX_COMSTART_FIRST (c) |
| 1176 | { | 1179 | && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from + 1)) |
| 1177 | code = Scomment; | 1180 | && comstyle == SYNTAX_COMMENT_STYLE (FETCH_CHAR (from + 1))) |
| 1178 | from--; | 1181 | code = Scomment; |
| 1179 | } | ||
| 1180 | 1182 | ||
| 1181 | /* Ignore escaped characters. */ | 1183 | /* Ignore escaped characters. */ |
| 1182 | if (char_quoted (from)) | 1184 | if (char_quoted (from)) |