]> git.eshelyaron.com Git - emacs.git/commitdiff
(scan_sexps_forward): Update syntax table before reading
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 9 Nov 2002 22:20:02 +0000 (22:20 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 9 Nov 2002 22:20:02 +0000 (22:20 +0000)
a char rather than after so we don't update the table past eob.

src/syntax.c

index 942e2da3c1b574c794a1bf25813c4675e7dae503..eb0b96b9b01a0ef8e4302c147136e466b854ee7d 100644 (file)
@@ -2504,10 +2504,10 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
 #define INC_FROM                               \
 do { prev_from = from;                         \
      prev_from_byte = from_byte;               \
+     UPDATE_SYNTAX_TABLE_FORWARD (prev_from);  \
      prev_from_syntax                          \
        = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \
      INC_BOTH (from, from_byte);               \
-     UPDATE_SYNTAX_TABLE_FORWARD (from);       \
   } while (0)
 
   immediate_quit = 1;
@@ -2580,7 +2580,6 @@ do { prev_from = from;                            \
 
   SETUP_SYNTAX_TABLE (prev_from, 1);
   prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte));
-  UPDATE_SYNTAX_TABLE_FORWARD (from);
 
   /* Enter the loop at a place appropriate for initial state.  */
 
@@ -2596,12 +2595,6 @@ do { prev_from = from;                           \
   else if (start_quoted)
     goto startquoted;
 
-#if 0 /* This seems to be redundant with the identical code above.  */
-  SETUP_SYNTAX_TABLE (prev_from, 1);
-  prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte));
-  UPDATE_SYNTAX_TABLE_FORWARD (from);
-#endif
-
   while (from < end)
     {
       INC_FROM;
@@ -2627,6 +2620,7 @@ do { prev_from = from;                            \
      else if (from < end)
        if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax))
          if (c1 = FETCH_CHAR (from_byte),
+             UPDATE_SYNTAX_TABLE_FORWARD (from_byte),
              SYNTAX_COMSTART_SECOND (c1))
            /* Duplicate code to avoid a complex if-expression
               which causes trouble for the SGI compiler.  */
@@ -2634,7 +2628,7 @@ do { prev_from = from;                            \
              /* Record the comment style we have entered so that only
                 the comment-end sequence of the same style actually
                 terminates the comment section.  */
-             state.comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte));
+             state.comstyle = SYNTAX_COMMENT_STYLE (c1);
              comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
              comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
              state.incomment = comnested ? 1 : -1;