diff options
| author | Stefan Monnier | 2002-11-09 22:20:02 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-11-09 22:20:02 +0000 |
| commit | 79bd6490a2f32a620bf159abea25cc2a785547fa (patch) | |
| tree | f71e5d8c7ebc047919b25a9f9d36edf6c9667849 /src/syntax.c | |
| parent | 2671e4de9afc4e97a250e34ce91e74597a9c89ea (diff) | |
| download | emacs-79bd6490a2f32a620bf159abea25cc2a785547fa.tar.gz emacs-79bd6490a2f32a620bf159abea25cc2a785547fa.zip | |
(scan_sexps_forward): Update syntax table before reading
a char rather than after so we don't update the table past eob.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/syntax.c b/src/syntax.c index 942e2da3c1b..eb0b96b9b01 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -2504,10 +2504,10 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth, | |||
| 2504 | #define INC_FROM \ | 2504 | #define INC_FROM \ |
| 2505 | do { prev_from = from; \ | 2505 | do { prev_from = from; \ |
| 2506 | prev_from_byte = from_byte; \ | 2506 | prev_from_byte = from_byte; \ |
| 2507 | UPDATE_SYNTAX_TABLE_FORWARD (prev_from); \ | ||
| 2507 | prev_from_syntax \ | 2508 | prev_from_syntax \ |
| 2508 | = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \ | 2509 | = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \ |
| 2509 | INC_BOTH (from, from_byte); \ | 2510 | INC_BOTH (from, from_byte); \ |
| 2510 | UPDATE_SYNTAX_TABLE_FORWARD (from); \ | ||
| 2511 | } while (0) | 2511 | } while (0) |
| 2512 | 2512 | ||
| 2513 | immediate_quit = 1; | 2513 | immediate_quit = 1; |
| @@ -2580,7 +2580,6 @@ do { prev_from = from; \ | |||
| 2580 | 2580 | ||
| 2581 | SETUP_SYNTAX_TABLE (prev_from, 1); | 2581 | SETUP_SYNTAX_TABLE (prev_from, 1); |
| 2582 | prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); | 2582 | prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); |
| 2583 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2584 | 2583 | ||
| 2585 | /* Enter the loop at a place appropriate for initial state. */ | 2584 | /* Enter the loop at a place appropriate for initial state. */ |
| 2586 | 2585 | ||
| @@ -2596,12 +2595,6 @@ do { prev_from = from; \ | |||
| 2596 | else if (start_quoted) | 2595 | else if (start_quoted) |
| 2597 | goto startquoted; | 2596 | goto startquoted; |
| 2598 | 2597 | ||
| 2599 | #if 0 /* This seems to be redundant with the identical code above. */ | ||
| 2600 | SETUP_SYNTAX_TABLE (prev_from, 1); | ||
| 2601 | prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); | ||
| 2602 | UPDATE_SYNTAX_TABLE_FORWARD (from); | ||
| 2603 | #endif | ||
| 2604 | |||
| 2605 | while (from < end) | 2598 | while (from < end) |
| 2606 | { | 2599 | { |
| 2607 | INC_FROM; | 2600 | INC_FROM; |
| @@ -2627,6 +2620,7 @@ do { prev_from = from; \ | |||
| 2627 | else if (from < end) | 2620 | else if (from < end) |
| 2628 | if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)) | 2621 | if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)) |
| 2629 | if (c1 = FETCH_CHAR (from_byte), | 2622 | if (c1 = FETCH_CHAR (from_byte), |
| 2623 | UPDATE_SYNTAX_TABLE_FORWARD (from_byte), | ||
| 2630 | SYNTAX_COMSTART_SECOND (c1)) | 2624 | SYNTAX_COMSTART_SECOND (c1)) |
| 2631 | /* Duplicate code to avoid a complex if-expression | 2625 | /* Duplicate code to avoid a complex if-expression |
| 2632 | which causes trouble for the SGI compiler. */ | 2626 | which causes trouble for the SGI compiler. */ |
| @@ -2634,7 +2628,7 @@ do { prev_from = from; \ | |||
| 2634 | /* Record the comment style we have entered so that only | 2628 | /* Record the comment style we have entered so that only |
| 2635 | the comment-end sequence of the same style actually | 2629 | the comment-end sequence of the same style actually |
| 2636 | terminates the comment section. */ | 2630 | terminates the comment section. */ |
| 2637 | state.comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte)); | 2631 | state.comstyle = SYNTAX_COMMENT_STYLE (c1); |
| 2638 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); | 2632 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); |
| 2639 | comnested = comnested || SYNTAX_COMMENT_NESTED (c1); | 2633 | comnested = comnested || SYNTAX_COMMENT_NESTED (c1); |
| 2640 | state.incomment = comnested ? 1 : -1; | 2634 | state.incomment = comnested ? 1 : -1; |