Mercurial > emacs
diff src/syntax.c @ 110533:b799d38f522a
Merge changes from emacs-23 branch
| author | Chong Yidong <cyd@stupidchicken.com> |
|---|---|
| date | Thu, 23 Sep 2010 15:00:31 -0400 |
| parents | 818e325e0469 2d0eee1a24b9 |
| children | f28cc7ff91f9 |
line wrap: on
line diff
--- a/src/syntax.c Thu Sep 23 13:10:21 2010 -0400 +++ b/src/syntax.c Thu Sep 23 15:00:31 2010 -0400 @@ -559,6 +559,7 @@ { int temp_byte, prev_syntax; int com2start, com2end; + int comstart; /* Move back and examine a character. */ DEC_BOTH (from, from_byte); @@ -578,7 +579,8 @@ || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); - + comstart = (com2start || code == Scomment); + /* Nasty cases with overlapping 2-char comment markers: - snmp-mode: -- c -- foo -- c -- --- c -- @@ -589,15 +591,16 @@ /// */ /* If a 2-char comment sequence partly overlaps with another, - we don't try to be clever. */ - if (from > stop && (com2end || com2start)) + we don't try to be clever. E.g. |*| in C, or }% in modes that + have %..\n and %{..}%. */ + if (from > stop && (com2end || comstart)) { int next = from, next_byte = from_byte, next_c, next_syntax; DEC_BOTH (next, next_byte); UPDATE_SYNTAX_TABLE_BACKWARD (next); next_c = FETCH_CHAR_AS_MULTIBYTE (next_byte); next_syntax = SYNTAX_WITH_FLAGS (next_c); - if (((com2start || comnested) + if (((comstart || comnested) && SYNTAX_FLAGS_COMEND_SECOND (syntax) && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) || ((com2end || comnested)
