mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 03:40:56 -08:00
(Fbackward_prefix_chars): Set point properly while scanning.
(scan_sexps_forward): Make INC_FROM do UPDATE_SYNTAX_TABLE_FORWARD. Delete the explicit calls to UPDATE_SYNTAX_TABLE_FORWARD. Also set prev_from_syntax (new local var). Test that in the loop, instead of fetching syntax of the previous char.
This commit is contained in:
parent
98bcfee8fe
commit
1fd3172dd4
1 changed files with 26 additions and 17 deletions
43
src/syntax.c
43
src/syntax.c
|
|
@ -2174,12 +2174,16 @@ This includes chars with \"quote\" or \"prefix\" syntax (' or p).")
|
||||||
|
|
||||||
DEC_BOTH (pos, pos_byte);
|
DEC_BOTH (pos, pos_byte);
|
||||||
|
|
||||||
while (pos + 1 > beg && !char_quoted (pos, pos_byte)
|
while (!char_quoted (pos, pos_byte)
|
||||||
/* Previous statement updates syntax table. */
|
/* Previous statement updates syntax table. */
|
||||||
&& ((c = FETCH_CHAR (pos_byte), SYNTAX (c) == Squote)
|
&& ((c = FETCH_CHAR (pos_byte), SYNTAX (c) == Squote)
|
||||||
|| SYNTAX_PREFIX (c)))
|
|| SYNTAX_PREFIX (c)))
|
||||||
{
|
{
|
||||||
DEC_BOTH (pos, pos_byte);
|
opoint = pos;
|
||||||
|
opoint_byte = pos_byte;
|
||||||
|
|
||||||
|
if (pos + 1 > beg)
|
||||||
|
DEC_BOTH (pos, pos_byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_PT_BOTH (opoint, opoint_byte);
|
SET_PT_BOTH (opoint, opoint_byte);
|
||||||
|
|
@ -2220,6 +2224,7 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
|
||||||
Lisp_Object tem;
|
Lisp_Object tem;
|
||||||
int prev_from; /* Keep one character before FROM. */
|
int prev_from; /* Keep one character before FROM. */
|
||||||
int prev_from_byte;
|
int prev_from_byte;
|
||||||
|
int prev_from_syntax;
|
||||||
int boundary_stop = commentstop == -1;
|
int boundary_stop = commentstop == -1;
|
||||||
int nofence;
|
int nofence;
|
||||||
|
|
||||||
|
|
@ -2232,14 +2237,15 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
|
||||||
#define INC_FROM \
|
#define INC_FROM \
|
||||||
do { prev_from = from; \
|
do { prev_from = from; \
|
||||||
prev_from_byte = from_byte; \
|
prev_from_byte = from_byte; \
|
||||||
|
prev_from_syntax \
|
||||||
|
= SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \
|
||||||
INC_BOTH (from, from_byte); \
|
INC_BOTH (from, from_byte); \
|
||||||
|
UPDATE_SYNTAX_TABLE_FORWARD (from); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
immediate_quit = 1;
|
immediate_quit = 1;
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
SETUP_SYNTAX_TABLE (from, 1);
|
|
||||||
|
|
||||||
if (NILP (oldstate))
|
if (NILP (oldstate))
|
||||||
{
|
{
|
||||||
depth = 0;
|
depth = 0;
|
||||||
|
|
@ -2302,11 +2308,15 @@ do { prev_from = from; \
|
||||||
}
|
}
|
||||||
if (start_quoted) goto startquoted;
|
if (start_quoted) goto startquoted;
|
||||||
|
|
||||||
|
|
||||||
|
SETUP_SYNTAX_TABLE (prev_from, 1);
|
||||||
|
prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte));
|
||||||
|
UPDATE_SYNTAX_TABLE_FORWARD (from);
|
||||||
|
|
||||||
while (from < end)
|
while (from < end)
|
||||||
{
|
{
|
||||||
UPDATE_SYNTAX_TABLE_FORWARD (from);
|
|
||||||
code = SYNTAX (FETCH_CHAR (from_byte));
|
|
||||||
INC_FROM;
|
INC_FROM;
|
||||||
|
code = prev_from_syntax & 0xff;
|
||||||
|
|
||||||
if (code == Scomment)
|
if (code == Scomment)
|
||||||
state.comstr_start = prev_from;
|
state.comstr_start = prev_from;
|
||||||
|
|
@ -2319,13 +2329,14 @@ do { prev_from = from; \
|
||||||
? ST_COMMENT_STYLE
|
? ST_COMMENT_STYLE
|
||||||
: SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte)));
|
: SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte)));
|
||||||
state.comstr_start = prev_from;
|
state.comstr_start = prev_from;
|
||||||
if (code != Scomment_fence) INC_FROM;
|
if (code != Scomment_fence)
|
||||||
|
INC_FROM;
|
||||||
code = Scomment;
|
code = Scomment;
|
||||||
}
|
}
|
||||||
else if (from < end)
|
else if (from < end)
|
||||||
if (SYNTAX_COMSTART_FIRST (FETCH_CHAR (prev_from_byte)))
|
if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax))
|
||||||
if (SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte)))
|
if (SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte)))
|
||||||
/* Duplicate code to avoid a very complex if-expression
|
/* Duplicate code to avoid a complex if-expression
|
||||||
which causes trouble for the SGI compiler. */
|
which causes trouble for the SGI compiler. */
|
||||||
{
|
{
|
||||||
/* Record the comment style we have entered so that only
|
/* Record the comment style we have entered so that only
|
||||||
|
|
@ -2335,11 +2346,12 @@ do { prev_from = from; \
|
||||||
? ST_COMMENT_STYLE
|
? ST_COMMENT_STYLE
|
||||||
: SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte)));
|
: SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte)));
|
||||||
state.comstr_start = prev_from;
|
state.comstr_start = prev_from;
|
||||||
if (code != Scomment_fence) INC_FROM;
|
if (code != Scomment_fence)
|
||||||
|
INC_FROM;
|
||||||
code = Scomment;
|
code = Scomment;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SYNTAX_PREFIX (FETCH_CHAR (prev_from_byte)))
|
if (SYNTAX_FLAGS_PREFIX (prev_from_syntax))
|
||||||
continue;
|
continue;
|
||||||
switch (SWITCH_ENUM_CAST (code))
|
switch (SWITCH_ENUM_CAST (code))
|
||||||
{
|
{
|
||||||
|
|
@ -2359,7 +2371,6 @@ do { prev_from = from; \
|
||||||
symstarted:
|
symstarted:
|
||||||
while (from < end)
|
while (from < end)
|
||||||
{
|
{
|
||||||
UPDATE_SYNTAX_TABLE_FORWARD (from);
|
|
||||||
switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from_byte))))
|
switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from_byte))))
|
||||||
{
|
{
|
||||||
case Scharquote:
|
case Scharquote:
|
||||||
|
|
@ -2387,7 +2398,6 @@ do { prev_from = from; \
|
||||||
{
|
{
|
||||||
/* Enter the loop in the middle so that we find
|
/* Enter the loop in the middle so that we find
|
||||||
a 2-char comment ender if we start in the middle of it. */
|
a 2-char comment ender if we start in the middle of it. */
|
||||||
prev = FETCH_CHAR (prev_from_byte);
|
|
||||||
goto startincomment_1;
|
goto startincomment_1;
|
||||||
}
|
}
|
||||||
/* At beginning of buffer, enter the loop the ordinary way. */
|
/* At beginning of buffer, enter the loop the ordinary way. */
|
||||||
|
|
@ -2401,7 +2411,6 @@ do { prev_from = from; \
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (from == end) goto done;
|
if (from == end) goto done;
|
||||||
UPDATE_SYNTAX_TABLE_FORWARD (from);
|
|
||||||
prev = FETCH_CHAR (from_byte);
|
prev = FETCH_CHAR (from_byte);
|
||||||
if (SYNTAX (prev) == Sendcomment
|
if (SYNTAX (prev) == Sendcomment
|
||||||
&& SYNTAX_COMMENT_STYLE (prev) == state.comstyle)
|
&& SYNTAX_COMMENT_STYLE (prev) == state.comstyle)
|
||||||
|
|
@ -2414,9 +2423,10 @@ do { prev_from = from; \
|
||||||
break;
|
break;
|
||||||
INC_FROM;
|
INC_FROM;
|
||||||
startincomment_1:
|
startincomment_1:
|
||||||
if (from < end && SYNTAX_COMEND_FIRST (prev)
|
if (from < end && SYNTAX_FLAGS_COMEND_FIRST (prev_from_syntax)
|
||||||
&& SYNTAX_COMEND_SECOND (FETCH_CHAR (from_byte))
|
&& SYNTAX_COMEND_SECOND (FETCH_CHAR (from_byte))
|
||||||
&& SYNTAX_COMMENT_STYLE (prev) == state.comstyle)
|
&& (SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax)
|
||||||
|
== state.comstyle))
|
||||||
/* Only terminate the comment section if the end-comment
|
/* Only terminate the comment section if the end-comment
|
||||||
sequence of the same style as the start sequence has
|
sequence of the same style as the start sequence has
|
||||||
been encountered. */
|
been encountered. */
|
||||||
|
|
@ -2470,7 +2480,6 @@ do { prev_from = from; \
|
||||||
if (from >= end) goto done;
|
if (from >= end) goto done;
|
||||||
c = FETCH_CHAR (from_byte);
|
c = FETCH_CHAR (from_byte);
|
||||||
if (nofence && c == state.instring) break;
|
if (nofence && c == state.instring) break;
|
||||||
UPDATE_SYNTAX_TABLE_FORWARD (from);
|
|
||||||
switch (SWITCH_ENUM_CAST (SYNTAX (c)))
|
switch (SWITCH_ENUM_CAST (SYNTAX (c)))
|
||||||
{
|
{
|
||||||
case Sstring_fence:
|
case Sstring_fence:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue