From 048822963e17ee237955b42ca4597775dba4374e Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Wed, 2 Mar 1994 05:31:15 +0000 Subject: (Fforward_comment): Do the right thing at eob. --- src/syntax.c | 70 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'src/syntax.c') diff --git a/src/syntax.c b/src/syntax.c index e4912bab65d..c06cb4bd6e5 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -599,8 +599,13 @@ between them, return t; otherwise return nil.") while (count1 > 0) { stop = ZV; - while (from < stop) + do { + if (from == stop) + { + SET_PT (from); + return Qnil; + } c = FETCH_CHAR (from); code = SYNTAX (c); from++; @@ -617,45 +622,40 @@ between them, return t; otherwise return nil.") comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)); from++; } - - if (code == Scomment) - { - while (1) - { - if (from == stop) - { - immediate_quit = 0; - SET_PT (from); - return Qnil; - } - c = FETCH_CHAR (from); - if (SYNTAX (c) == Sendcomment - && SYNTAX_COMMENT_STYLE (c) == comstyle) - /* we have encountered a comment end of the same style - as the comment sequence which began this comment - section */ - break; - from++; - if (from < stop && SYNTAX_COMEND_FIRST (c) - && SYNTAX_COMEND_SECOND (FETCH_CHAR (from)) - && SYNTAX_COMMENT_STYLE (c) == comstyle) - /* we have encountered a comment end of the same style - as the comment sequence which began this comment - section */ - { from++; break; } - } - /* We have skipped one comment. */ - break; - } - else if (code != Swhitespace && code != Sendcomment) + } + while (code == Swhitespace || code == Sendcomment); + if (code != Scomment) + { + immediate_quit = 0; + SET_PT (from - 1); + return Qnil; + } + /* We're at the start of a comment. */ + while (1) + { + if (from == stop) { immediate_quit = 0; - SET_PT (from - 1); + SET_PT (from); return Qnil; } + c = FETCH_CHAR (from); + if (SYNTAX (c) == Sendcomment + && SYNTAX_COMMENT_STYLE (c) == comstyle) + /* we have encountered a comment end of the same style + as the comment sequence which began this comment + section */ + break; + from++; + if (from < stop && SYNTAX_COMEND_FIRST (c) + && SYNTAX_COMEND_SECOND (FETCH_CHAR (from)) + && SYNTAX_COMMENT_STYLE (c) == comstyle) + /* we have encountered a comment end of the same style + as the comment sequence which began this comment + section */ + { from++; break; } } - - /* End of comment reached */ + /* We have skipped one comment. */ count1--; } -- cgit v1.2.1