Commit 8f9dc2ed authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(scan_lists, Fforward_comment): #if 0 the code

to treat two-character comment enders with a special shortcut.

(scan_sexps_forward): Set state.comstart to before the
comment starter, not after.
parent 2ad18bfd
...@@ -684,6 +684,7 @@ between them, return t; otherwise return nil.") ...@@ -684,6 +684,7 @@ between them, return t; otherwise return nil.")
if (code == Sendcomment && !quoted) if (code == Sendcomment && !quoted)
{ {
#if 0
if (code != SYNTAX (c)) if (code != SYNTAX (c))
/* For a two-char comment ender, we can assume /* For a two-char comment ender, we can assume
it does end a comment. So scan back in a simple way. */ it does end a comment. So scan back in a simple way. */
...@@ -709,6 +710,7 @@ between them, return t; otherwise return nil.") ...@@ -709,6 +710,7 @@ between them, return t; otherwise return nil.")
} }
break; break;
} }
#endif /* 0 */
/* Look back, counting the parity of string-quotes, /* Look back, counting the parity of string-quotes,
and recording the comment-starters seen. and recording the comment-starters seen.
...@@ -1076,6 +1078,7 @@ scan_lists (from, count, depth, sexpflag) ...@@ -1076,6 +1078,7 @@ scan_lists (from, count, depth, sexpflag)
case Sendcomment: case Sendcomment:
if (!parse_sexp_ignore_comments) if (!parse_sexp_ignore_comments)
break; break;
#if 0
if (code != SYNTAX (c)) if (code != SYNTAX (c))
/* For a two-char comment ender, we can assume /* For a two-char comment ender, we can assume
it does end a comment. So scan back in a simple way. */ it does end a comment. So scan back in a simple way. */
...@@ -1096,6 +1099,7 @@ scan_lists (from, count, depth, sexpflag) ...@@ -1096,6 +1099,7 @@ scan_lists (from, count, depth, sexpflag)
} }
break; break;
} }
#endif /* 0 */
/* Look back, counting the parity of string-quotes, /* Look back, counting the parity of string-quotes,
and recording the comment-starters seen. and recording the comment-starters seen.
...@@ -1410,7 +1414,10 @@ scan_sexps_forward (stateptr, from, end, targetdepth, ...@@ -1410,7 +1414,10 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
{ {
code = SYNTAX (FETCH_CHAR (from)); code = SYNTAX (FETCH_CHAR (from));
from++; from++;
if (from < end && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from - 1)) if (code == Scomment)
state.comstart = from-1;
else if (from < end && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from - 1))
&& SYNTAX_COMSTART_SECOND (FETCH_CHAR (from))) && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from)))
{ {
/* Record the comment style we have entered so that only /* Record the comment style we have entered so that only
...@@ -1418,6 +1425,7 @@ scan_sexps_forward (stateptr, from, end, targetdepth, ...@@ -1418,6 +1425,7 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
terminates the comment section. */ terminates the comment section. */
code = Scomment; code = Scomment;
state.comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)); state.comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from));
state.comstart = from-1;
from++; from++;
} }
...@@ -1471,7 +1479,6 @@ scan_sexps_forward (stateptr, from, end, targetdepth, ...@@ -1471,7 +1479,6 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
case Scomment: case Scomment:
state.incomment = 1; state.incomment = 1;
state.comstart = from;
startincomment: startincomment:
if (commentstop) if (commentstop)
goto done; goto done;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment