diff options
| author | Stefan Monnier | 2010-09-21 17:52:13 +0200 |
|---|---|---|
| committer | Stefan Monnier | 2010-09-21 17:52:13 +0200 |
| commit | fbb3da770f233a8e0cf99d5f053b0c31cbbc8db4 (patch) | |
| tree | b7b85d711640aa6569d22b2c572caaccfaeb42ac /src/syntax.c | |
| parent | c9805d2356942878e55e92aae5fd1dee756f366b (diff) | |
| download | emacs-fbb3da770f233a8e0cf99d5f053b0c31cbbc8db4.tar.gz emacs-fbb3da770f233a8e0cf99d5f053b0c31cbbc8db4.zip | |
* src/syntax.c (back_comment): Detect the case where a 1-char comment
starter is also the 2nd char of a 2-char comment ender.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c index 47b4caf5ade..4d7dd2ba7a3 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -512,6 +512,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p | |||
| 512 | { | 512 | { |
| 513 | int temp_byte, prev_syntax; | 513 | int temp_byte, prev_syntax; |
| 514 | int com2start, com2end; | 514 | int com2start, com2end; |
| 515 | int comstart; | ||
| 515 | 516 | ||
| 516 | /* Move back and examine a character. */ | 517 | /* Move back and examine a character. */ |
| 517 | DEC_BOTH (from, from_byte); | 518 | DEC_BOTH (from, from_byte); |
| @@ -530,7 +531,8 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p | |||
| 530 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); | 531 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); |
| 531 | com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) | 532 | com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) |
| 532 | && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); | 533 | && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); |
| 533 | 534 | comstart = (com2start || code == Scomment); | |
| 535 | |||
| 534 | /* Nasty cases with overlapping 2-char comment markers: | 536 | /* Nasty cases with overlapping 2-char comment markers: |
| 535 | - snmp-mode: -- c -- foo -- c -- | 537 | - snmp-mode: -- c -- foo -- c -- |
| 536 | --- c -- | 538 | --- c -- |
| @@ -541,15 +543,16 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p | |||
| 541 | /// */ | 543 | /// */ |
| 542 | 544 | ||
| 543 | /* If a 2-char comment sequence partly overlaps with another, | 545 | /* If a 2-char comment sequence partly overlaps with another, |
| 544 | we don't try to be clever. */ | 546 | we don't try to be clever. E.g. |*| in C, or }% in modes that |
| 545 | if (from > stop && (com2end || com2start)) | 547 | have %..\n and %{..}%. */ |
| 548 | if (from > stop && (com2end || comstart)) | ||
| 546 | { | 549 | { |
| 547 | int next = from, next_byte = from_byte, next_c, next_syntax; | 550 | int next = from, next_byte = from_byte, next_c, next_syntax; |
| 548 | DEC_BOTH (next, next_byte); | 551 | DEC_BOTH (next, next_byte); |
| 549 | UPDATE_SYNTAX_TABLE_BACKWARD (next); | 552 | UPDATE_SYNTAX_TABLE_BACKWARD (next); |
| 550 | next_c = FETCH_CHAR_AS_MULTIBYTE (next_byte); | 553 | next_c = FETCH_CHAR_AS_MULTIBYTE (next_byte); |
| 551 | next_syntax = SYNTAX_WITH_FLAGS (next_c); | 554 | next_syntax = SYNTAX_WITH_FLAGS (next_c); |
| 552 | if (((com2start || comnested) | 555 | if (((comstart || comnested) |
| 553 | && SYNTAX_FLAGS_COMEND_SECOND (syntax) | 556 | && SYNTAX_FLAGS_COMEND_SECOND (syntax) |
| 554 | && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) | 557 | && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) |
| 555 | || ((com2end || comnested) | 558 | || ((com2end || comnested) |