/[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.2.2 by fx, Tue Jul 30 11:36:10 2002 UTC revision 1.152.2.3 by handa, Thu Aug 1 12:33:55 2002 UTC
# Line 1162  DEFUN ("internal-describe-syntax-value", Line 1162  DEFUN ("internal-describe-syntax-value",
1162    
1163  int parse_sexp_ignore_comments;  int parse_sexp_ignore_comments;
1164    
1165    Lisp_Object Vnext_word_boundary_function_table;
1166    
1167  /* Return the position across COUNT words from FROM.  /* Return the position across COUNT words from FROM.
1168     If that many words cannot be found before the end of the buffer, return 0.     If that many words cannot be found before the end of the buffer, return 0.
1169     COUNT negative means scan backward and stop at word beginning.  */     COUNT negative means scan backward and stop at word beginning.  */
# Line 1183  scan_words (from, count) Line 1185  scan_words (from, count)
1185    
1186    while (count > 0)    while (count > 0)
1187      {      {
1188          Lisp_Object func;
1189    
1190        while (1)        while (1)
1191          {          {
1192            if (from == end)            if (from == end)
# Line 1202  scan_words (from, count) Line 1206  scan_words (from, count)
1206          }          }
1207        /* Now CH0 is a character which begins a word and FROM is the        /* Now CH0 is a character which begins a word and FROM is the
1208           position of the next character.  */           position of the next character.  */
1209        while (1)        func = CHAR_TABLE_REF (Vnext_word_boundary_function_table, ch0);
1210          if (! NILP (Ffboundp (func)))
1211          {          {
1212            if (from == end) break;            Lisp_Object pos;
1213            UPDATE_SYNTAX_TABLE_FORWARD (from);  
1214            ch1 = FETCH_CHAR (from_byte);            pos = call2 (func, make_number (from - 1), make_number (end));
1215            code = SYNTAX (ch1);            from = XINT (pos);
1216            if (!(words_include_escapes            from_byte = CHAR_TO_BYTE (from);
                 && (code == Sescape || code == Scharquote)))  
             if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))  
               break;  
           INC_BOTH (from, from_byte);  
           ch0 = ch1;  
1217          }          }
1218          else
1219            while (1)
1220              {
1221                if (from == end) break;
1222                UPDATE_SYNTAX_TABLE_FORWARD (from);
1223                ch1 = FETCH_CHAR (from_byte);
1224                code = SYNTAX (ch1);
1225                if (code != Sword
1226                    && (! words_include_escapes
1227                        || (code != Sescape && code != Scharquote)))
1228                    break;
1229                INC_BOTH (from, from_byte);
1230                ch0 = ch1;
1231              }
1232    
1233        count--;        count--;
1234      }      }
1235    while (count < 0)    while (count < 0)
1236      {      {
1237          Lisp_Object func;
1238    
1239        while (1)        while (1)
1240          {          {
1241            if (from == beg)            if (from == beg)
# Line 1238  scan_words (from, count) Line 1255  scan_words (from, count)
1255          }          }
1256        /* Now CH1 is a character which ends a word and FROM is the        /* Now CH1 is a character which ends a word and FROM is the
1257           position of it.  */           position of it.  */
1258        while (1)        func = CHAR_TABLE_REF (Vnext_word_boundary_function_table, ch1);
1259          if (! NILP (Ffboundp (func)))
1260          {          {
1261            int temp_byte;            Lisp_Object pos;
1262    
1263            if (from == beg)            pos = call2 (func, make_number (from), make_number (beg));
1264              break;            from = XINT (pos);
1265            temp_byte = dec_bytepos (from_byte);            from_byte = CHAR_TO_BYTE (from);
           UPDATE_SYNTAX_TABLE_BACKWARD (from);  
           ch0 = FETCH_CHAR (temp_byte);  
           code = SYNTAX (ch0);  
           if (!(words_include_escapes  
                 && (code == Sescape || code == Scharquote)))  
             if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))  
               break;  
           DEC_BOTH (from, from_byte);  
           ch1 = ch0;  
1266          }          }
1267          else
1268            while (1)
1269              {
1270                int temp_byte;
1271    
1272                if (from == beg)
1273                  break;
1274                temp_byte = dec_bytepos (from_byte);
1275                UPDATE_SYNTAX_TABLE_BACKWARD (from);
1276                ch0 = FETCH_CHAR (temp_byte);
1277                code = SYNTAX (ch0);
1278                if (code != Sword
1279                    && (! words_include_escapes
1280                        || (code != Sescape && code != Scharquote)))
1281                  break;
1282                DEC_BOTH (from, from_byte);
1283                ch1 = ch0;
1284              }
1285        count++;        count++;
1286      }      }
1287    
# Line 2984  See the info node `(elisp)Syntax Propert Line 3011  See the info node `(elisp)Syntax Propert
3011                 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.  */);
3012    open_paren_in_column_0_is_defun_start = 1;    open_paren_in_column_0_is_defun_start = 1;
3013    
3014      DEFVAR_LISP ("next-word-boundary-function-table",
3015                   &Vnext_word_boundary_function_table,
3016                   doc: /*
3017    Char table of functions to search for the next word boundary.
3018    Each function is called with two arguments; POS and LIMIT.
3019    POS and LIMIT are character positions in the current buffer.
3020    
3021    If POS is less than LIMIT, POS is at the first character of a word,
3022    and the return value of a function is a position after the last
3023    character of that word.
3024    
3025    If POS is not less than LIMIT, POS is at the last character of a word,
3026    and the return value of a function is a position at the first
3027    character of that word.
3028    
3029    In both cases, LIMIT bounds the search. */);
3030      Vnext_word_boundary_function_table = Fmake_char_table (Qnil, Qnil);
3031    
3032    defsubr (&Ssyntax_table_p);    defsubr (&Ssyntax_table_p);
3033    defsubr (&Ssyntax_table);    defsubr (&Ssyntax_table);
3034    defsubr (&Sstandard_syntax_table);    defsubr (&Sstandard_syntax_table);

Legend:
Removed from v.1.152.2.2  
changed lines
  Added in v.1.152.2.3

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