diff options
| author | Richard M. Stallman | 1998-03-18 00:11:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-03-18 00:11:33 +0000 |
| commit | 1fd3172dd4819524d0b63337e525cd48e062e0f5 (patch) | |
| tree | e0b8e81ed960cbe463a2ebb6bff06ae7e82cf3e9 /src/syntax.c | |
| parent | 98bcfee8fe89ca8b9f9c211733bd17db9516685c (diff) | |
| download | emacs-1fd3172dd4819524d0b63337e525cd48e062e0f5.tar.gz emacs-1fd3172dd4819524d0b63337e525cd48e062e0f5.zip | |
(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.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/syntax.c b/src/syntax.c index 4ac1c8d1b83..02357671608 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -2174,12 +2174,16 @@ This includes chars with \"quote\" or \"prefix\" syntax (' or p).") | |||
| 2174 | 2174 | ||
| 2175 | DEC_BOTH (pos, pos_byte); | 2175 | DEC_BOTH (pos, pos_byte); |
| 2176 | 2176 | ||
| 2177 | while (pos + 1 > beg && !char_quoted (pos, pos_byte) | 2177 | while (!char_quoted (pos, pos_byte) |
| 2178 | /* Previous statement updates syntax table. */ | 2178 | /* Previous statement updates syntax table. */ |
| 2179 | && ((c = FETCH_CHAR (pos_byte), SYNTAX (c) == Squote) | 2179 | && ((c = FETCH_CHAR (pos_byte), SYNTAX (c) == Squote) |
| 2180 | || SYNTAX_PREFIX (c))) | 2180 | || SYNTAX_PREFIX (c))) |
| 2181 | { | 2181 | { |
| 2182 | DEC_BOTH (pos, pos_byte); | 2182 | opoint = pos; |
| 2183 | opoint_byte = pos_byte; | ||
| 2184 | |||
| 2185 | if (pos + 1 > beg) | ||
| 2186 | DEC_BOTH (pos, pos_byte); | ||
| 2183 | } | 2187 | } |
| 2184 | 2188 | ||
| 2185 | SET_PT_BOTH (opoint, opoint_byte); | 2189 | SET_PT_BOTH (opoint, opoint_byte); |
| @@ -2220,6 +2224,7 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth, | |||
| 2220 | Lisp_Object tem; | 2224 | Lisp_Object tem; |
| 2221 | int prev_from; /* Keep one character before FROM. */ | 2225 | int prev_from; /* Keep one character before FROM. */ |
| 2222 | int prev_from_byte; | 2226 | int prev_from_byte; |
| 2227 | int prev_from_syntax; | ||
| 2223 | int boundary_stop = commentstop == -1; | 2228 | int boundary_stop = commentstop == -1; |
| 2224 | int nofence; | 2229 | int nofence; |
| 2225 | 2230 | ||
| @@ -2232,14 +2237,15 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth, | |||
| 2232 | #define INC_FROM \ | 2237 | #define INC_FROM \ |
| 2233 | do { prev_from = from; \ | 2238 | do { prev_from = from; \ |
| 2234 | prev_from_byte = from_byte; \ | 2239 | prev_from_byte = from_byte; \ |
| 2240 | prev_from_syntax \ | ||
| 2241 | = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \ | ||
| 2235 | INC_BOTH (from, from_byte); \ | 2242 | INC_BOTH (from, from_byte); \ |
| 2243 | UPDATE_SYNTAX_TABLE_FORWARD (from); \ | ||
| 2236 | } while (0) | 2244 | } while (0) |
| 2237 | 2245 | ||
| 2238 | immediate_quit = 1; | 2246 | immediate_quit = 1; |
| 2239 | QUIT; | 2247 | QUIT; |
| 2240 | 2248 | ||
| 2241 | SETUP_SYNTAX_TABLE (from, 1); | ||
| 2242 | |||
| 2243 | if (NILP (oldstate)) | 2249 | if (NILP (oldstate)) |
| 2244 | { | 2250 | { |
| 2245 | depth = 0; | 2251 | depth = 0; |
| @@ -2302,11 +2308,15 @@ do { prev_from = from; \ | |||
| 2302 | } | 2308 | } |
| 2303 | if (start_quoted) goto startquoted; | 2309 | if (start_quoted) goto startquoted; |
| 2304 | 2310 | ||
| 2311 | |||
| 2312 | SETUP_SYNTAX_TABLE (prev_from, 1); | ||
| 2313 | prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); | ||
| 2314 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2315 | |||
| 2305 | while (from < end) | 2316 | while (from < end) |
| 2306 | { | 2317 | { |
| 2307 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2308 | code = SYNTAX (FETCH_CHAR (from_byte)); | ||
| 2309 | INC_FROM; | 2318 | INC_FROM; |
| 2319 | code = prev_from_syntax & 0xff; | ||
| 2310 | 2320 | ||
| 2311 | if (code == Scomment) | 2321 | if (code == Scomment) |
| 2312 | state.comstr_start = prev_from; | 2322 | state.comstr_start = prev_from; |
| @@ -2319,13 +2329,14 @@ do { prev_from = from; \ | |||
| 2319 | ? ST_COMMENT_STYLE | 2329 | ? ST_COMMENT_STYLE |
| 2320 | : SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte))); | 2330 | : SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte))); |
| 2321 | state.comstr_start = prev_from; | 2331 | state.comstr_start = prev_from; |
| 2322 | if (code != Scomment_fence) INC_FROM; | 2332 | if (code != Scomment_fence) |
| 2333 | INC_FROM; | ||
| 2323 | code = Scomment; | 2334 | code = Scomment; |
| 2324 | } | 2335 | } |
| 2325 | else if (from < end) | 2336 | else if (from < end) |
| 2326 | if (SYNTAX_COMSTART_FIRST (FETCH_CHAR (prev_from_byte))) | 2337 | if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)) |
| 2327 | if (SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte))) | 2338 | if (SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte))) |
| 2328 | /* Duplicate code to avoid a very complex if-expression | 2339 | /* Duplicate code to avoid a complex if-expression |
| 2329 | which causes trouble for the SGI compiler. */ | 2340 | which causes trouble for the SGI compiler. */ |
| 2330 | { | 2341 | { |
| 2331 | /* Record the comment style we have entered so that only | 2342 | /* Record the comment style we have entered so that only |
| @@ -2335,11 +2346,12 @@ do { prev_from = from; \ | |||
| 2335 | ? ST_COMMENT_STYLE | 2346 | ? ST_COMMENT_STYLE |
| 2336 | : SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte))); | 2347 | : SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte))); |
| 2337 | state.comstr_start = prev_from; | 2348 | state.comstr_start = prev_from; |
| 2338 | if (code != Scomment_fence) INC_FROM; | 2349 | if (code != Scomment_fence) |
| 2350 | INC_FROM; | ||
| 2339 | code = Scomment; | 2351 | code = Scomment; |
| 2340 | } | 2352 | } |
| 2341 | 2353 | ||
| 2342 | if (SYNTAX_PREFIX (FETCH_CHAR (prev_from_byte))) | 2354 | if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) |
| 2343 | continue; | 2355 | continue; |
| 2344 | switch (SWITCH_ENUM_CAST (code)) | 2356 | switch (SWITCH_ENUM_CAST (code)) |
| 2345 | { | 2357 | { |
| @@ -2359,7 +2371,6 @@ do { prev_from = from; \ | |||
| 2359 | symstarted: | 2371 | symstarted: |
| 2360 | while (from < end) | 2372 | while (from < end) |
| 2361 | { | 2373 | { |
| 2362 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2363 | switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from_byte)))) | 2374 | switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from_byte)))) |
| 2364 | { | 2375 | { |
| 2365 | case Scharquote: | 2376 | case Scharquote: |
| @@ -2387,7 +2398,6 @@ do { prev_from = from; \ | |||
| 2387 | { | 2398 | { |
| 2388 | /* Enter the loop in the middle so that we find | 2399 | /* Enter the loop in the middle so that we find |
| 2389 | a 2-char comment ender if we start in the middle of it. */ | 2400 | a 2-char comment ender if we start in the middle of it. */ |
| 2390 | prev = FETCH_CHAR (prev_from_byte); | ||
| 2391 | goto startincomment_1; | 2401 | goto startincomment_1; |
| 2392 | } | 2402 | } |
| 2393 | /* At beginning of buffer, enter the loop the ordinary way. */ | 2403 | /* At beginning of buffer, enter the loop the ordinary way. */ |
| @@ -2401,7 +2411,6 @@ do { prev_from = from; \ | |||
| 2401 | while (1) | 2411 | while (1) |
| 2402 | { | 2412 | { |
| 2403 | if (from == end) goto done; | 2413 | if (from == end) goto done; |
| 2404 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2405 | prev = FETCH_CHAR (from_byte); | 2414 | prev = FETCH_CHAR (from_byte); |
| 2406 | if (SYNTAX (prev) == Sendcomment | 2415 | if (SYNTAX (prev) == Sendcomment |
| 2407 | && SYNTAX_COMMENT_STYLE (prev) == state.comstyle) | 2416 | && SYNTAX_COMMENT_STYLE (prev) == state.comstyle) |
| @@ -2414,9 +2423,10 @@ do { prev_from = from; \ | |||
| 2414 | break; | 2423 | break; |
| 2415 | INC_FROM; | 2424 | INC_FROM; |
| 2416 | startincomment_1: | 2425 | startincomment_1: |
| 2417 | if (from < end && SYNTAX_COMEND_FIRST (prev) | 2426 | if (from < end && SYNTAX_FLAGS_COMEND_FIRST (prev_from_syntax) |
| 2418 | && SYNTAX_COMEND_SECOND (FETCH_CHAR (from_byte)) | 2427 | && SYNTAX_COMEND_SECOND (FETCH_CHAR (from_byte)) |
| 2419 | && SYNTAX_COMMENT_STYLE (prev) == state.comstyle) | 2428 | && (SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax) |
| 2429 | == state.comstyle)) | ||
| 2420 | /* Only terminate the comment section if the end-comment | 2430 | /* Only terminate the comment section if the end-comment |
| 2421 | sequence of the same style as the start sequence has | 2431 | sequence of the same style as the start sequence has |
| 2422 | been encountered. */ | 2432 | been encountered. */ |
| @@ -2470,7 +2480,6 @@ do { prev_from = from; \ | |||
| 2470 | if (from >= end) goto done; | 2480 | if (from >= end) goto done; |
| 2471 | c = FETCH_CHAR (from_byte); | 2481 | c = FETCH_CHAR (from_byte); |
| 2472 | if (nofence && c == state.instring) break; | 2482 | if (nofence && c == state.instring) break; |
| 2473 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2474 | switch (SWITCH_ENUM_CAST (SYNTAX (c))) | 2483 | switch (SWITCH_ENUM_CAST (SYNTAX (c))) |
| 2475 | { | 2484 | { |
| 2476 | case Sstring_fence: | 2485 | case Sstring_fence: |