Mercurial > emacs
changeset 29821:819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
(Fforward_comment, scan_lists):
Check the comstyle of single-char comment-starters.
(scan_sexps_forward): Don't try to recognize `half comment-enders' if
we're just at the beginning of the comment (f.ex with (*) ... (*)).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 20 Jun 2000 22:30:44 +0000 |
parents | f5dc3b2e86d4 |
children | d24cc3dc6bbc |
files | src/syntax.c |
diffstat | 1 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/syntax.c Tue Jun 20 19:54:50 2000 +0000 +++ b/src/syntax.c Tue Jun 20 22:30:44 2000 +0000 @@ -970,7 +970,7 @@ Lisp_Object value; { register enum syntaxcode code; - char desc, start1, start2, end1, end2, prefix, comstyle; + char desc, start1, start2, end1, end2, prefix, comstyle, comnested; char str[2]; Lisp_Object first, match_lisp; @@ -1010,6 +1010,7 @@ end2 = (XINT (first) >> 19) & 1; prefix = (XINT (first) >> 20) & 1; comstyle = (XINT (first) >> 21) & 1; + comnested = (XINT (first) >> 22) & 1; if ((int) code < 0 || (int) code >= (int) Smax) { @@ -1040,6 +1041,8 @@ insert ("p", 1); if (comstyle) insert ("b", 1); + if (comnested) + insert ("n", 1); insert_string ("\twhich means: "); @@ -1093,6 +1096,8 @@ insert_string (",\n\t is the second character of a comment-end sequence"); if (comstyle) insert_string (" (comment style b)"); + if (comnested) + insert_string (" (nestable)"); if (prefix) insert_string (",\n\t is a prefix character for `backward-prefix-chars'"); @@ -1777,9 +1782,9 @@ code = SYNTAX (c); comstart_first = SYNTAX_COMSTART_FIRST (c); comnested = SYNTAX_COMMENT_NESTED (c); + comstyle = SYNTAX_COMMENT_STYLE (c); INC_BOTH (from, from_byte); UPDATE_SYNTAX_TABLE_FORWARD (from); - comstyle = 0; if (from < stop && comstart_first && (c1 = FETCH_CHAR (from_byte), SYNTAX_COMSTART_SECOND (c1))) @@ -1991,6 +1996,7 @@ code = SYNTAX_WITH_MULTIBYTE_CHECK (c); comstart_first = SYNTAX_COMSTART_FIRST (c); comnested = SYNTAX_COMMENT_NESTED (c); + comstyle = SYNTAX_COMMENT_STYLE (c); prefix = SYNTAX_PREFIX (c); if (depth == min_depth) last_good = from; @@ -2171,7 +2177,7 @@ } /* Quoting turns anything except a comment-ender - into a word character. Note that this if cannot be true + into a word character. Note that this cannot be true if we decremented FROM in the if-statement above. */ if (code != Sendcomment && char_quoted (from, from_byte)) code = Sword; @@ -2648,10 +2654,14 @@ commentloop: /* The (from == BEGV) test is to enter the loop in the middle so that we find a 2-char comment ender even if we start in the - middle of it. */ + middle of it. We don't want to do that if we're just at the + beginning of the comment (think of (*) ... (*)). + Actually, the current code still doesn't handle such cases right + when the comment style allows nesting. */ found = forw_comment (from, from_byte, end, state.incomment, state.comstyle, - (from == BEGV) ? 0 : prev_from_syntax, + (from == BEGV || from < state.comstr_start + 3) + ? 0 : prev_from_syntax, &out_charpos, &out_bytepos, &state.incomment); from = out_charpos; from_byte = out_bytepos; /* Beware! prev_from and friends are invalid now.