summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-03-02 05:31:15 +0000
committerKarl Heuer <kwzh@gnu.org>1994-03-02 05:31:15 +0000
commit048822963e17ee237955b42ca4597775dba4374e (patch)
tree602670e852c5d0515f160e3f92c6e853be107168 /src/syntax.c
parent19479ae2d64859f67f84c245b1b98b4b2e1b43ee (diff)
downloademacs-048822963e17ee237955b42ca4597775dba4374e.tar.gz
(Fforward_comment): Do the right thing at eob.
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c70
1 files changed, 35 insertions, 35 deletions
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--;
}