comparison src/syntax.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
71 int no_quit_in_re_search; 71 int no_quit_in_re_search;
72 72
73 /* Tell the regex routines which buffer to access for SYNTAX() lookups 73 /* Tell the regex routines which buffer to access for SYNTAX() lookups
74 and the like. */ 74 and the like. */
75 struct buffer *regex_emacs_buffer; 75 struct buffer *regex_emacs_buffer;
76
77 /* Tell the regex routines whether buffer is used or not. */
78 int regex_emacs_buffer_p;
76 79
77 Lisp_Object Vstandard_syntax_table; 80 Lisp_Object Vstandard_syntax_table;
78 81
79 Lisp_Object Vsyntax_designator_chars_string; 82 Lisp_Object Vsyntax_designator_chars_string;
80 83
222 225
223 /* Convert a letter which signifies a syntax code 226 /* Convert a letter which signifies a syntax code
224 into the code it signifies. 227 into the code it signifies.
225 This is used by modify-syntax-entry, and other things. */ 228 This is used by modify-syntax-entry, and other things. */
226 229
227 CONST unsigned char syntax_spec_code[0400] = 230 const unsigned char syntax_spec_code[0400] =
228 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 231 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
229 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 232 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
230 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 233 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
231 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 234 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
232 (char) Swhitespace, 0377, (char) Sstring, 0377, 235 (char) Swhitespace, 0377, (char) Sstring, 0377,
244 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 247 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
245 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, 248 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword,
246 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377 249 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377
247 }; 250 };
248 251
249 CONST unsigned char syntax_code_spec[] = " .w_()'\"$\\/<>@"; 252 const unsigned char syntax_code_spec[] = " .w_()'\"$\\/<>@";
250 253
251 DEFUN ("syntax-designator-chars", Fsyntax_designator_chars, 0, 0, 0, /* 254 DEFUN ("syntax-designator-chars", Fsyntax_designator_chars, 0, 0, 0, /*
252 Return a string of the recognized syntax designator chars. 255 Return a string of the recognized syntax designator chars.
253 The chars are ordered by their internal syntax codes, which are 256 The chars are ordered by their internal syntax codes, which are
254 numbered starting at 0. 257 numbered starting at 0.
293 #endif 296 #endif
294 297
295 Lisp_Object 298 Lisp_Object
296 syntax_match (Lisp_Object table, Emchar ch) 299 syntax_match (Lisp_Object table, Emchar ch)
297 { 300 {
298 Lisp_Object code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (table), ch); 301 Lisp_Object code = XCHAR_TABLE_VALUE_UNSAFE (table, ch);
299 Lisp_Object code2 = code; 302 Lisp_Object code2 = code;
300 303
301 if (CONSP (code)) 304 if (CONSP (code))
302 code2 = XCAR (code); 305 code2 = XCAR (code);
303 if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit) 306 if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit)
304 code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (Vstandard_syntax_table), 307 code = XCHAR_TABLE_VALUE_UNSAFE (Vstandard_syntax_table, ch);
305 ch);
306 308
307 return CONSP (code) ? XCDR (code) : Qnil; 309 return CONSP (code) ? XCDR (code) : Qnil;
308 } 310 }
309 311
310 DEFUN ("matching-paren", Fmatching_paren, 1, 2, 0, /* 312 DEFUN ("matching-paren", Fmatching_paren, 1, 2, 0, /*
363 return 0; 365 return 0;
364 366
365 ch0 = BUF_FETCH_CHAR (buf, from); 367 ch0 = BUF_FETCH_CHAR (buf, from);
366 code = SYNTAX_UNSAFE (mirrortab, ch0); 368 code = SYNTAX_UNSAFE (mirrortab, ch0);
367 369
370 from++;
368 if (words_include_escapes 371 if (words_include_escapes
369 && (code == Sescape || code == Scharquote)) 372 && (code == Sescape || code == Scharquote))
370 break; 373 break;
371 if (code == Sword) 374 if (code == Sword)
372 break; 375 break;
373
374 from++;
375 } 376 }
376 377
377 QUIT; 378 QUIT;
378 379
379 while (from != limit) 380 while (from != limit)
405 if (from == limit) 406 if (from == limit)
406 return 0; 407 return 0;
407 408
408 ch1 = BUF_FETCH_CHAR (buf, from - 1); 409 ch1 = BUF_FETCH_CHAR (buf, from - 1);
409 code = SYNTAX_UNSAFE (mirrortab, ch1); 410 code = SYNTAX_UNSAFE (mirrortab, ch1);
411
412 from--;
410 if (words_include_escapes 413 if (words_include_escapes
411 && (code == Sescape || code == Scharquote)) 414 && (code == Sescape || code == Scharquote))
412 break; 415 break;
413 if (code == Sword) 416 if (code == Sword)
414 break; 417 break;
415
416 from--;
417 } 418 }
418 419
419 QUIT; 420 QUIT;
420 421
421 while (from != limit) 422 while (from != limit)
1690 1691
1691 no_quit_in_re_search = 0; 1692 no_quit_in_re_search = 0;
1692 } 1693 }
1693 1694
1694 static void 1695 static void
1695 define_standard_syntax (CONST char *p, enum syntaxcode syn) 1696 define_standard_syntax (const char *p, enum syntaxcode syn)
1696 { 1697 {
1697 for (; *p; p++) 1698 for (; *p; p++)
1698 Fput_char_table (make_char (*p), make_int (syn), Vstandard_syntax_table); 1699 Fput_char_table (make_char (*p), make_int (syn), Vstandard_syntax_table);
1699 } 1700 }
1700 1701
1701 void 1702 void
1702 complex_vars_of_syntax (void) 1703 complex_vars_of_syntax (void)
1703 { 1704 {
1704 Emchar i; 1705 Emchar i;
1705 CONST char *p; 1706 const char *p;
1706 /* Set this now, so first buffer creation can refer to it. */ 1707 /* Set this now, so first buffer creation can refer to it. */
1707 /* Make it nil before calling copy-syntax-table 1708 /* Make it nil before calling copy-syntax-table
1708 so that copy-syntax-table will know not to try to copy from garbage */ 1709 so that copy-syntax-table will know not to try to copy from garbage */
1709 Vstandard_syntax_table = Qnil; 1710 Vstandard_syntax_table = Qnil;
1710 Vstandard_syntax_table = Fcopy_syntax_table (Qnil); 1711 Vstandard_syntax_table = Fcopy_syntax_table (Qnil);