/[emacs]/emacs/src/syntax.c
ViewVC logotype

Diff of /emacs/src/syntax.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.152 by monnier, Mon Nov 26 23:37:01 2001 UTC revision 1.152.4.1 by miles, Fri Apr 4 06:21:03 2003 UTC
# Line 199  update_syntax_table (charpos, count, ini Line 199  update_syntax_table (charpos, count, ini
199    
200    if (invalidate)    if (invalidate)
201      invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */      invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */
202          
203    if (invalidate)               /* Did not get to adjacent interval.  */    if (invalidate)               /* Did not get to adjacent interval.  */
204      {                           /* with the same table => */      {                           /* with the same table => */
205                                  /* invalidate the old range.  */                                  /* invalidate the old range.  */
# Line 222  update_syntax_table (charpos, count, ini Line 222  update_syntax_table (charpos, count, ini
222        if (EQ (Fsyntax_table_p (tmp_table), Qt))        if (EQ (Fsyntax_table_p (tmp_table), Qt))
223          {          {
224            gl_state.use_global = 0;            gl_state.use_global = 0;
225          }          }
226        else if (CONSP (tmp_table))        else if (CONSP (tmp_table))
227          {          {
228            gl_state.use_global = 1;            gl_state.use_global = 1;
229            gl_state.global_code = tmp_table;            gl_state.global_code = tmp_table;
230          }          }
231        else        else
232          {          {
233            gl_state.use_global = 0;            gl_state.use_global = 0;
234            gl_state.current_syntax_table = current_buffer->syntax_table;            gl_state.current_syntax_table = current_buffer->syntax_table;
# Line 251  update_syntax_table (charpos, count, ini Line 251  update_syntax_table (charpos, count, ini
251              }              }
252            return;            return;
253          }          }
254        else if (cnt == INTERVALS_AT_ONCE)        else if (cnt == INTERVALS_AT_ONCE)
255          {          {
256            if (count > 0)            if (count > 0)
257              {              {
# Line 428  prev_char_comend_first (pos, pos_byte) Line 428  prev_char_comend_first (pos, pos_byte)
428   *      int pos, pos_byte;   *      int pos, pos_byte;
429   * {   * {
430   *   int c, val;   *   int c, val;
431   *   *
432   *   DEC_BOTH (pos, pos_byte);   *   DEC_BOTH (pos, pos_byte);
433   *   UPDATE_SYNTAX_TABLE_BACKWARD (pos);   *   UPDATE_SYNTAX_TABLE_BACKWARD (pos);
434   *   c = FETCH_CHAR (pos_byte);   *   c = FETCH_CHAR (pos_byte);
# Line 468  back_comment (from, from_byte, stop, com Line 468  back_comment (from, from_byte, stop, com
468    int string_style = -1;        /* Presumed outside of any string. */    int string_style = -1;        /* Presumed outside of any string. */
469    int string_lossage = 0;    int string_lossage = 0;
470    /* Not a real lossage: indicates that we have passed a matching comment    /* Not a real lossage: indicates that we have passed a matching comment
471       starter plus an non-matching comment-ender, meaning that any matching       starter plus a non-matching comment-ender, meaning that any matching
472       comment-starter we might see later could be a false positive (hidden       comment-starter we might see later could be a false positive (hidden
473       inside another comment).       inside another comment).
474       Test case:  { a (* b } c (* d *) */       Test case:  { a (* b } c (* d *) */
# Line 584  back_comment (from, from_byte, stop, com Line 584  back_comment (from, from_byte, stop, com
584                 There's no way to grok this scanning backwards.  */                 There's no way to grok this scanning backwards.  */
585              string_lossage = 1;              string_lossage = 1;
586            break;            break;
587              
588          case Scomment:          case Scomment:
589            /* We've already checked that it is the relevant comstyle.  */            /* We've already checked that it is the relevant comstyle.  */
590            if (string_style != -1 || comment_lossage || string_lossage)            if (string_style != -1 || comment_lossage || string_lossage)
# Line 609  back_comment (from, from_byte, stop, com Line 609  back_comment (from, from_byte, stop, com
609    
610          case Sendcomment:          case Sendcomment:
611            if (SYNTAX_FLAGS_COMMENT_STYLE (syntax) == comstyle            if (SYNTAX_FLAGS_COMMENT_STYLE (syntax) == comstyle
612                && (SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax)                && ((com2end && SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax))
613                    || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested)                    || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested)
614              /* This is the same style of comment ender as ours. */              /* This is the same style of comment ender as ours. */
615              {              {
# Line 705  back_comment (from, from_byte, stop, com Line 705  back_comment (from, from_byte, stop, com
705        from_byte = CHAR_TO_BYTE (from);        from_byte = CHAR_TO_BYTE (from);
706        UPDATE_SYNTAX_TABLE_FORWARD (from - 1);        UPDATE_SYNTAX_TABLE_FORWARD (from - 1);
707      }      }
708        
709   done:   done:
710    *charpos_ptr = from;    *charpos_ptr = from;
711    *bytepos_ptr = from_byte;    *bytepos_ptr = from_byte;
# Line 732  check_syntax_table (obj) Line 732  check_syntax_table (obj)
732    if (!(CHAR_TABLE_P (obj)    if (!(CHAR_TABLE_P (obj)
733          && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table)))          && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table)))
734      wrong_type_argument (Qsyntax_table_p, obj);      wrong_type_argument (Qsyntax_table_p, obj);
735  }    }
736    
737  DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,  DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
738         doc: /* Return the current syntax table.         doc: /* Return the current syntax table.
# Line 901  text property.  */) Line 901  text property.  */)
901       (string)       (string)
902       Lisp_Object string;       Lisp_Object string;
903  {  {
904    register unsigned char *p;    register const unsigned char *p;
905    register enum syntaxcode code;    register enum syntaxcode code;
906    int val;    int val;
907    Lisp_Object match;    Lisp_Object match;
908    
909    CHECK_STRING (string);    CHECK_STRING (string);
910    
911    p = XSTRING (string)->data;    p = SDATA (string);
912    code = (enum syntaxcode) syntax_spec_code[*p++];    code = (enum syntaxcode) syntax_spec_code[*p++];
913    if (((int) code & 0377) == 0377)    if (((int) code & 0377) == 0377)
914      error ("invalid syntax description letter: %c", p[-1]);      error ("invalid syntax description letter: %c", p[-1]);
# Line 920  text property.  */) Line 920  text property.  */)
920      {      {
921        int len;        int len;
922        int character = (STRING_CHAR_AND_LENGTH        int character = (STRING_CHAR_AND_LENGTH
923                         (p, STRING_BYTES (XSTRING (string)) - 1, len));                         (p, SBYTES (string) - 1, len));
924        XSETINT (match, character);        XSETINT (match, character);
925        if (XFASTINT (match) == ' ')        if (XFASTINT (match) == ' ')
926          match = Qnil;          match = Qnil;
# Line 961  text property.  */) Line 961  text property.  */)
961          val |= 1 << 22;          val |= 1 << 22;
962          break;          break;
963        }        }
964            
965    if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))    if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))
966      return XVECTOR (Vsyntax_code_object)->contents[val];      return XVECTOR (Vsyntax_code_object)->contents[val];
967    else    else
# Line 971  text property.  */) Line 971  text property.  */)
971    
972  /* I really don't know why this is interactive  /* I really don't know why this is interactive
973     help-form should at least be made useful whilst reading the second arg.  */     help-form should at least be made useful whilst reading the second arg.  */
974  DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3,  DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3,
975    "cSet syntax for character: \nsSet syntax for %s to: ",    "cSet syntax for character: \nsSet syntax for %s to: ",
976         doc: /* Set syntax for character CHAR according to string NEWENTRY.         doc: /* Set syntax for character CHAR according to string NEWENTRY.
977  The syntax is changed only for table SYNTAX_TABLE, which defaults to  The syntax is changed only for table SYNTAX_TABLE, which defaults to
# Line 1293  and the function returns nil.  Field bou Line 1293  and the function returns nil.  Field bou
1293    /* Avoid jumping out of an input field.  */    /* Avoid jumping out of an input field.  */
1294    val = XFASTINT (Fconstrain_to_field (make_number (val), make_number (PT),    val = XFASTINT (Fconstrain_to_field (make_number (val), make_number (PT),
1295                                         Qt, Qnil, Qnil));                                         Qt, Qnil, Qnil));
1296      
1297    SET_PT (val);    SET_PT (val);
1298    return val == orig_val ? Qt : Qnil;    return val == orig_val ? Qt : Qnil;
1299  }  }
# Line 1307  except that `]' is never special and `\\ Line 1307  except that `]' is never special and `\\
1307   (but not as the end of a range; quoting is never needed there).   (but not as the end of a range; quoting is never needed there).
1308  Thus, with arg "a-zA-Z", this skips letters stopping before first nonletter.  Thus, with arg "a-zA-Z", this skips letters stopping before first nonletter.
1309  With arg "^a-zA-Z", skips nonletters stopping before first letter.  With arg "^a-zA-Z", skips nonletters stopping before first letter.
1310  Returns the distance traveled, either zero or positive.  */)  Returns the distance traveled, either zero or positive.
1311    Note that char classes, e.g. `[:alpha:]', are not currently supported;
1312    they will be treated as literals.  */)
1313       (string, lim)       (string, lim)
1314       Lisp_Object string, lim;       Lisp_Object string, lim;
1315  {  {
# Line 1365  skip_chars (forwardp, syntaxp, string, l Line 1367  skip_chars (forwardp, syntaxp, string, l
1367    int multibyte = !NILP (current_buffer->enable_multibyte_characters);    int multibyte = !NILP (current_buffer->enable_multibyte_characters);
1368    int string_multibyte;    int string_multibyte;
1369    int size_byte;    int size_byte;
1370    unsigned char *str;    const unsigned char *str;
1371    int len;    int len;
1372    
1373    CHECK_STRING (string);    CHECK_STRING (string);
1374    char_ranges = (int *) alloca (XSTRING (string)->size * (sizeof (int)) * 2);    char_ranges = (int *) alloca (SCHARS (string) * (sizeof (int)) * 2);
1375    string_multibyte = STRING_MULTIBYTE (string);    string_multibyte = STRING_MULTIBYTE (string);
1376    str = XSTRING (string)->data;    str = SDATA (string);
1377    size_byte = STRING_BYTES (XSTRING (string));    size_byte = SBYTES (string);
1378    
1379    /* Adjust the multibyteness of the string to that of the buffer.  */    /* Adjust the multibyteness of the string to that of the buffer.  */
1380    if (multibyte != string_multibyte)    if (multibyte != string_multibyte)
# Line 1380  skip_chars (forwardp, syntaxp, string, l Line 1382  skip_chars (forwardp, syntaxp, string, l
1382        int nbytes;        int nbytes;
1383    
1384        if (multibyte)        if (multibyte)
1385          nbytes = count_size_as_multibyte (XSTRING (string)->data,          nbytes = count_size_as_multibyte (SDATA (string),
1386                                            XSTRING (string)->size);                                            SCHARS (string));
1387        else        else
1388          nbytes = XSTRING (string)->size;          nbytes = SCHARS (string);
1389        if (nbytes != size_byte)        if (nbytes != size_byte)
1390          {          {
1391            str = (unsigned char *) alloca (nbytes);            unsigned char *tmp = (unsigned char *) alloca (nbytes);
1392            copy_text (XSTRING (string)->data, str, size_byte,            copy_text (SDATA (string), tmp, size_byte,
1393                       string_multibyte, multibyte);                       string_multibyte, multibyte);
1394            size_byte = nbytes;            size_byte = nbytes;
1395              str = tmp;
1396          }          }
1397      }      }
1398    
# Line 1409  skip_chars (forwardp, syntaxp, string, l Line 1412  skip_chars (forwardp, syntaxp, string, l
1412    i_byte = 0;    i_byte = 0;
1413    
1414    if (i_byte < size_byte    if (i_byte < size_byte
1415        && XSTRING (string)->data[0] == '^')        && SREF (string, 0) == '^')
1416      {      {
1417        negate = 1; i_byte++;        negate = 1; i_byte++;
1418      }      }
# Line 1728  forw_comment (from, from_byte, stop, nes Line 1731  forw_comment (from, from_byte, stop, nes
1731          nesting++;          nesting++;
1732        INC_BOTH (from, from_byte);        INC_BOTH (from, from_byte);
1733        UPDATE_SYNTAX_TABLE_FORWARD (from);        UPDATE_SYNTAX_TABLE_FORWARD (from);
1734          
1735      forw_incomment:      forw_incomment:
1736        if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax)        if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax)
1737            && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style            && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style
# Line 1771  forw_comment (from, from_byte, stop, nes Line 1774  forw_comment (from, from_byte, stop, nes
1774  }  }
1775    
1776  DEFUN ("forward-comment", Fforward_comment, Sforward_comment, 1, 1, 0,  DEFUN ("forward-comment", Fforward_comment, Sforward_comment, 1, 1, 0,
1777         doc: /* Move forward across up to N comments.  If N is negative, move backward.         doc: /*
1778    Move forward across up to COUNT comments.  If COUNT is negative, move backward.
1779  Stop scanning if we find something other than a comment or whitespace.  Stop scanning if we find something other than a comment or whitespace.
1780  Set point to where scanning stops.  Set point to where scanning stops.
1781  If N comments are found as expected, with nothing except whitespace  If COUNT comments are found as expected, with nothing except whitespace
1782  between them, return t; otherwise return nil.  */)  between them, return t; otherwise return nil.  */)
1783       (count)       (count)
1784       Lisp_Object count;       Lisp_Object count;
# Line 1825  between them, return t; otherwise return Line 1829  between them, return t; otherwise return
1829                && (c1 = FETCH_CHAR (from_byte),                && (c1 = FETCH_CHAR (from_byte),
1830                    SYNTAX_COMSTART_SECOND (c1)))                    SYNTAX_COMSTART_SECOND (c1)))
1831              {              {
1832                /* We have encountered a comment start sequence and we                /* We have encountered a comment start sequence and we
1833                   are ignoring all text inside comments.  We must record                   are ignoring all text inside comments.  We must record
1834                   the comment style this sequence begins so that later,                   the comment style this sequence begins so that later,
1835                   only a comment end of the same style actually ends                   only a comment end of the same style actually ends
# Line 1906  between them, return t; otherwise return Line 1910  between them, return t; otherwise return
1910              {              {
1911                /* Skip until first preceding unquoted comment_fence.  */                /* Skip until first preceding unquoted comment_fence.  */
1912                int found = 0, ini = from, ini_byte = from_byte;                int found = 0, ini = from, ini_byte = from_byte;
1913                  
1914                while (1)                while (1)
1915                  {                  {
1916                    DEC_BOTH (from, from_byte);                    DEC_BOTH (from, from_byte);
# Line 1915  between them, return t; otherwise return Line 1919  between them, return t; otherwise return
1919                    UPDATE_SYNTAX_TABLE_BACKWARD (from);                    UPDATE_SYNTAX_TABLE_BACKWARD (from);
1920                    c = FETCH_CHAR (from_byte);                    c = FETCH_CHAR (from_byte);
1921                    if (SYNTAX (c) == Scomment_fence                    if (SYNTAX (c) == Scomment_fence
1922                        && !char_quoted (from, from_byte))                        && !char_quoted (from, from_byte))
1923                      {                      {
1924                        found = 1;                        found = 1;
1925                        break;                        break;
1926                      }                      }
1927                  }                  }
# Line 2035  scan_lists (from, count, depth, sexpflag Line 2039  scan_lists (from, count, depth, sexpflag
2039                && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte))                && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte))
2040                && parse_sexp_ignore_comments)                && parse_sexp_ignore_comments)
2041              {              {
2042                /* we have encountered a comment start sequence and we                /* we have encountered a comment start sequence and we
2043                   are ignoring all text inside comments.  We must record                   are ignoring all text inside comments.  We must record
2044                   the comment style this sequence begins so that later,                   the comment style this sequence begins so that later,
2045                   only a comment end of the same style actually ends                   only a comment end of the same style actually ends
# Line 2047  scan_lists (from, count, depth, sexpflag Line 2051  scan_lists (from, count, depth, sexpflag
2051                INC_BOTH (from, from_byte);                INC_BOTH (from, from_byte);
2052                UPDATE_SYNTAX_TABLE_FORWARD (from);                UPDATE_SYNTAX_TABLE_FORWARD (from);
2053              }              }
2054              
2055            if (prefix)            if (prefix)
2056              continue;              continue;
2057    
# Line 2163  scan_lists (from, count, depth, sexpflag Line 2167  scan_lists (from, count, depth, sexpflag
2167                INC_BOTH (from, from_byte);                INC_BOTH (from, from_byte);
2168                if (!depth && sexpflag) goto done;                if (!depth && sexpflag) goto done;
2169                break;                break;
2170                default:
2171                  /* Ignore whitespace, punctuation, quote, endcomment.  */
2172                  break;
2173              }              }
2174          }          }
2175    
# Line 2205  scan_lists (from, count, depth, sexpflag Line 2212  scan_lists (from, count, depth, sexpflag
2212                comstyle = SYNTAX_COMMENT_STYLE (c1);                comstyle = SYNTAX_COMMENT_STYLE (c1);
2213                comnested = comnested || SYNTAX_COMMENT_NESTED (c1);                comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
2214              }              }
2215              
2216            /* Quoting turns anything except a comment-ender            /* Quoting turns anything except a comment-ender
2217               into a word character.  Note that this cannot be true               into a word character.  Note that this cannot be true
2218               if we decremented FROM in the if-statement above.  */               if we decremented FROM in the if-statement above.  */
2219            if (code != Sendcomment && char_quoted (from, from_byte))            if (code != Sendcomment && char_quoted (from, from_byte))
2220              code = Sword;              {
2221                  DEC_BOTH (from, from_byte);
2222                  code = Sword;
2223                }
2224            else if (SYNTAX_PREFIX (c))            else if (SYNTAX_PREFIX (c))
2225              continue;              continue;
2226    
# Line 2303  scan_lists (from, count, depth, sexpflag Line 2313  scan_lists (from, count, depth, sexpflag
2313                    DEC_BOTH (from, from_byte);                    DEC_BOTH (from, from_byte);
2314                    if (from == stop) goto lose;                    if (from == stop) goto lose;
2315                    UPDATE_SYNTAX_TABLE_BACKWARD (from);                    UPDATE_SYNTAX_TABLE_BACKWARD (from);
2316                    if (!char_quoted (from, from_byte)                    if (!char_quoted (from, from_byte)
2317                        && (c = FETCH_CHAR (from_byte),                        && (c = FETCH_CHAR (from_byte),
2318                            SYNTAX_WITH_MULTIBYTE_CHECK (c) == code))                            SYNTAX_WITH_MULTIBYTE_CHECK (c) == code))
2319                      break;                      break;
2320                  }                  }
2321                if (code == Sstring_fence && !depth && sexpflag) goto done2;                if (code == Sstring_fence && !depth && sexpflag) goto done2;
2322                break;                break;
2323                  
2324              case Sstring:              case Sstring:
2325                stringterm = FETCH_CHAR (from_byte);                stringterm = FETCH_CHAR (from_byte);
2326                while (1)                while (1)
# Line 2331  scan_lists (from, count, depth, sexpflag Line 2341  scan_lists (from, count, depth, sexpflag
2341                DEC_BOTH (from, from_byte);                DEC_BOTH (from, from_byte);
2342                if (!depth && sexpflag) goto done2;                if (!depth && sexpflag) goto done2;
2343                break;                break;
2344                default:
2345                  /* Ignore whitespace, punctuation, quote, endcomment.  */
2346                  break;
2347              }              }
2348          }          }
2349    
# Line 2415  This includes chars with "quote" or "pre Line 2428  This includes chars with "quote" or "pre
2428    int pos_byte = PT_BYTE;    int pos_byte = PT_BYTE;
2429    int c;    int c;
2430    
2431    if (pos <= beg)    if (pos <= beg)
2432      {      {
2433        SET_PT_BOTH (opoint, opoint_byte);        SET_PT_BOTH (opoint, opoint_byte);
2434    
# Line 2456  scan_sexps_forward (stateptr, from, from Line 2469  scan_sexps_forward (stateptr, from, from
2469                      stopbefore, oldstate, commentstop)                      stopbefore, oldstate, commentstop)
2470       struct lisp_parse_state *stateptr;       struct lisp_parse_state *stateptr;
2471       register int from;       register int from;
2472       int end, targetdepth, stopbefore;       int end, targetdepth, stopbefore, from_byte;
2473       Lisp_Object oldstate;       Lisp_Object oldstate;
2474       int commentstop;       int commentstop;
2475  {  {
# Line 2496  do { prev_from = from;                         \ Line 2509  do { prev_from = from;                         \
2509       prev_from_syntax                           \       prev_from_syntax                           \
2510         = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \         = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \
2511       INC_BOTH (from, from_byte);                \       INC_BOTH (from, from_byte);                \
2512       UPDATE_SYNTAX_TABLE_FORWARD (from);        \       if (from < end)                            \
2513           UPDATE_SYNTAX_TABLE_FORWARD (from);      \
2514    } while (0)    } while (0)
2515    
2516    immediate_quit = 1;    immediate_quit = 1;
# Line 2523  do { prev_from = from;                         \ Line 2537  do { prev_from = from;                         \
2537        oldstate = Fcdr (oldstate);        oldstate = Fcdr (oldstate);
2538        tem = Fcar (oldstate);        tem = Fcar (oldstate);
2539        /* Check whether we are inside string_fence-style string: */        /* Check whether we are inside string_fence-style string: */
2540        state.instring = (!NILP (tem)        state.instring = (!NILP (tem)
2541                          ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE)                          ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE)
2542                          : -1);                          : -1);
2543    
2544        oldstate = Fcdr (oldstate);        oldstate = Fcdr (oldstate);
# Line 2542  do { prev_from = from;                         \ Line 2556  do { prev_from = from;                         \
2556        oldstate = Fcdr (oldstate);        oldstate = Fcdr (oldstate);
2557        oldstate = Fcdr (oldstate);        oldstate = Fcdr (oldstate);
2558        tem = Fcar (oldstate);        tem = Fcar (oldstate);
2559        state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table)        state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table)
2560                                           ? ST_COMMENT_STYLE : 1);                                           ? ST_COMMENT_STYLE : 1);
2561    
2562        oldstate = Fcdr (oldstate);        oldstate = Fcdr (oldstate);
# Line 2585  do { prev_from = from;                         \ Line 2599  do { prev_from = from;                         \
2599    else if (start_quoted)    else if (start_quoted)
2600      goto startquoted;      goto startquoted;
2601    
 #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  
   
2602    while (from < end)    while (from < end)
2603      {      {
2604        INC_FROM;        INC_FROM;
# Line 2623  do { prev_from = from;                         \ Line 2631  do { prev_from = from;                         \
2631                /* Record the comment style we have entered so that only                /* Record the comment style we have entered so that only
2632                   the comment-end sequence of the same style actually                   the comment-end sequence of the same style actually
2633                   terminates the comment section.  */                   terminates the comment section.  */
2634                state.comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from_byte));                state.comstyle = SYNTAX_COMMENT_STYLE (c1);
2635                comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);                comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
2636                comnested = comnested || SYNTAX_COMMENT_NESTED (c1);                comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
2637                state.incomment = comnested ? 1 : -1;                state.incomment = comnested ? 1 : -1;
# Line 2674  do { prev_from = from;                         \ Line 2682  do { prev_from = from;                         \
2682            curlevel->prev = curlevel->last;            curlevel->prev = curlevel->last;
2683            break;            break;
2684    
2685            case Scomment_fence: /* Can't happen because it's handled above.  */
2686          case Scomment:          case Scomment:
2687            if (commentstop || boundary_stop) goto done;            if (commentstop || boundary_stop) goto done;
2688          startincomment:          startincomment:
# Line 2724  do { prev_from = from;                         \ Line 2733  do { prev_from = from;                         \
2733            state.comstr_start = from - 1;            state.comstr_start = from - 1;
2734            if (stopbefore) goto stop;  /* this arg means stop at sexp start */            if (stopbefore) goto stop;  /* this arg means stop at sexp start */
2735            curlevel->last = prev_from;            curlevel->last = prev_from;
2736            state.instring = (code == Sstring            state.instring = (code == Sstring
2737                              ? (FETCH_CHAR (prev_from_byte))                              ? (FETCH_CHAR (prev_from_byte))
2738                              : ST_STRING_STYLE);                              : ST_STRING_STYLE);
2739            if (boundary_stop) goto done;            if (boundary_stop) goto done;
2740          startinstring:          startinstring:
2741            {            {
2742              nofence = state.instring != ST_STRING_STYLE;              nofence = state.instring != ST_STRING_STYLE;
2743                
2744              while (1)              while (1)
2745                {                {
2746                  int c;                  int c;
# Line 2769  do { prev_from = from;                         \ Line 2778  do { prev_from = from;                         \
2778            break;            break;
2779    
2780          case Smath:          case Smath:
2781              /* FIXME: We should do something with it.  */
2782              break;
2783            default:
2784              /* Ignore whitespace, punctuation, quote, endcomment.  */
2785            break;            break;
2786          }          }
2787      }      }
# Line 2809  Value is a list of ten elements describi Line 2822  Value is a list of ten elements describi
2822   3. non-nil if inside a string.   3. non-nil if inside a string.
2823      (it is the character that will terminate the string,      (it is the character that will terminate the string,
2824       or t if the string should be terminated by a generic string delimiter.)       or t if the string should be terminated by a generic string delimiter.)
2825   4. nil if outside a comment, t if inside a non-nestable comment,   4. nil if outside a comment, t if inside a non-nestable comment,
2826      else an integer (the current comment nesting).      else an integer (the current comment nesting).
2827   5. t if following a quote character.   5. t if following a quote character.
2828   6. the minimum paren-depth encountered during this scan.   6. the minimum paren-depth encountered during this scan.
# Line 2845  Sixth arg COMMENTSTOP non-nil means stop Line 2858  Sixth arg COMMENTSTOP non-nil means stop
2858    scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)),    scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)),
2859                        XINT (to),                        XINT (to),
2860                        target, !NILP (stopbefore), oldstate,                        target, !NILP (stopbefore), oldstate,
2861                        (NILP (commentstop)                        (NILP (commentstop)
2862                         ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));                         ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));
2863    
2864    SET_PT (state.location);    SET_PT (state.location);
2865      
2866    return Fcons (make_number (state.depth),    return Fcons (make_number (state.depth),
2867             Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart),             Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart),
2868               Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart),               Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart),
2869                 Fcons (state.instring >= 0                 Fcons (state.instring >= 0
2870                        ? (state.instring == ST_STRING_STYLE                        ? (state.instring == ST_STRING_STYLE
2871                           ? Qt : make_number (state.instring)) : Qnil,                           ? Qt : make_number (state.instring)) : Qnil,
2872                   Fcons (state.incomment < 0 ? Qt :                   Fcons (state.incomment < 0 ? Qt :
2873                          (state.incomment == 0 ? Qnil :                          (state.incomment == 0 ? Qnil :
2874                           make_number (state.incomment)),                           make_number (state.incomment)),
2875                     Fcons (state.quoted ? Qt : Qnil,                     Fcons (state.quoted ? Qt : Qnil,
2876                       Fcons (make_number (state.mindepth),                       Fcons (make_number (state.mindepth),
2877                         Fcons ((state.comstyle                         Fcons ((state.comstyle
2878                                 ? (state.comstyle == ST_COMMENT_STYLE                                 ? (state.comstyle == ST_COMMENT_STYLE
2879                                    ? Qsyntax_table : Qt) :                                    ? Qsyntax_table : Qt) :
2880                                 Qnil),                                 Qnil),
# Line 2983  See the info node `(elisp)Syntax Propert Line 2996  See the info node `(elisp)Syntax Propert
2996    
2997    DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start",    DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start",
2998                 &open_paren_in_column_0_is_defun_start,                 &open_paren_in_column_0_is_defun_start,
2999                 doc: /* Non-nil means an open paren in column 0 denotes the start of a defun.  */);                 doc: /* *Non-nil means an open paren in column 0 denotes the start of a defun.  */);
3000    open_paren_in_column_0_is_defun_start = 1;    open_paren_in_column_0_is_defun_start = 1;
3001    
3002    defsubr (&Ssyntax_table_p);    defsubr (&Ssyntax_table_p);

Legend:
Removed from v.1.152  
changed lines
  Added in v.1.152.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26