From d355bd8ae6a26c50277d2fb24aba38a0b657dcbb Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 20 Jun 2000 22:49:34 +0000 Subject: [PATCH] (scan_sexps_forward): Check the comstyle of single-char comment-starters. Clarify control-flow around the Scomment case. --- src/ChangeLog | 9 +++++---- src/syntax.c | 18 +++++------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d2fb087ce16..0947598060b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,11 +5,13 @@ 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 (*) ... (*)). + Check the comstyle of single-char comment-starters. + Clarify control-flow around the Scomment case. 2000-06-20 Dave Love - * fns.c (make_hash_table, maybe_resize_hash_table): Cast arg of - next_almost_prime. + * fns.c (make_hash_table, maybe_resize_hash_table): + Cast arg of next_almost_prime. * tparam.c [emacs]: Include lisp.h. @@ -60,8 +62,7 @@ * m/ibmrt-aix.h: Don't declare HAVE_GETTIMEOFDAY, HAVE_VFORK. - * m/ibmrs6000.h, m/ibmps2-aix.h, m/dpx2.h: Don't declare - HAVE_GETWD. + * m/ibmrs6000.h, m/ibmps2-aix.h, m/dpx2.h: Don't declare HAVE_GETWD. * m/alpha.h: Don't declare xmalloc, xrealloc. diff --git a/src/syntax.c b/src/syntax.c index eedec27d549..656d567b1a5 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -2567,6 +2567,7 @@ do { prev_from = from; \ if (code == Scomment) { + state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax); state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ? 1 : -1); state.comstr_start = prev_from; @@ -2642,22 +2643,13 @@ do { prev_from = from; \ curlevel->prev = curlevel->last; break; - startincomment: - if (commentstop == 1) - goto done; - goto commentloop; - case Scomment: - if (! state.incomment) - abort (); if (commentstop || boundary_stop) goto done; - commentloop: - /* The (from == BEGV) test is to enter the loop in the middle so + startincomment: + /* The (from == BEGV) test was 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. 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. */ + beginning of the comment (think of (*) ... (*)). */ found = forw_comment (from, from_byte, end, state.incomment, state.comstyle, (from == BEGV || from < state.comstr_start + 3) @@ -2668,7 +2660,7 @@ do { prev_from = from; \ Luckily, the `done' doesn't use them and the INC_FROM sets them to a sane value without looking at them. */ if (!found) goto done; - INC_FROM; + INC_FROM; state.incomment = 0; state.comstyle = 0; /* reset the comment style */ if (boundary_stop) goto done; -- 2.39.2