Mercurial > hg > xemacs-beta
comparison src/syntax.c @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 2f8bb876ab1d |
children | 41dbb7a9d5f2 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
51 So, we introduced Sextword for Japanese letters. A character of | 51 So, we introduced Sextword for Japanese letters. A character of |
52 Sextword is a word-constituent but a word boundary may exist between | 52 Sextword is a word-constituent but a word boundary may exist between |
53 two such characters. */ | 53 two such characters. */ |
54 | 54 |
55 /* Mule 2.4 doesn't seem to have Sextword - I'm removing it -- mrb */ | 55 /* Mule 2.4 doesn't seem to have Sextword - I'm removing it -- mrb */ |
56 /* Recovered by tomo */ | |
57 | 56 |
58 Lisp_Object Qsyntax_table_p; | 57 Lisp_Object Qsyntax_table_p; |
59 | 58 |
60 int words_include_escapes; | 59 int words_include_escapes; |
61 | 60 |
115 | 114 |
116 static Bufpos | 115 static Bufpos |
117 find_defun_start (struct buffer *buf, Bufpos pos) | 116 find_defun_start (struct buffer *buf, Bufpos pos) |
118 { | 117 { |
119 Bufpos tem; | 118 Bufpos tem; |
120 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 119 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
121 | 120 |
122 /* Use previous finding, if it's valid and applies to this inquiry. */ | 121 /* Use previous finding, if it's valid and applies to this inquiry. */ |
123 if (buf == find_start_buffer | 122 if (buf == find_start_buffer |
124 /* Reuse the defun-start even if POS is a little farther on. | 123 /* Reuse the defun-start even if POS is a little farther on. |
125 POS might be in the next defun, but that's ok. | 124 POS might be in the next defun, but that's ok. |
222 | 221 |
223 /* Convert a letter which signifies a syntax code | 222 /* Convert a letter which signifies a syntax code |
224 into the code it signifies. | 223 into the code it signifies. |
225 This is used by modify-syntax-entry, and other things. */ | 224 This is used by modify-syntax-entry, and other things. */ |
226 | 225 |
227 const unsigned char syntax_spec_code[0400] = | 226 CONST unsigned char syntax_spec_code[0400] = |
228 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 227 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
229 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 228 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
230 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 229 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
231 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 230 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
232 (char) Swhitespace, 0377, (char) Sstring, 0377, | 231 (char) Swhitespace, 0377, (char) Sstring, 0377, |
244 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 243 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
245 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, | 244 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, |
246 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377 | 245 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377 |
247 }; | 246 }; |
248 | 247 |
249 const unsigned char syntax_code_spec[] = " .w_()'\"$\\/<>@"; | 248 CONST unsigned char syntax_code_spec[] = " .w_()'\"$\\/<>@"; |
250 | 249 |
251 DEFUN ("syntax-designator-chars", Fsyntax_designator_chars, 0, 0, 0, /* | 250 DEFUN ("syntax-designator-chars", Fsyntax_designator_chars, 0, 0, 0, /* |
252 Return a string of the recognized syntax designator chars. | 251 Return a string of the recognized syntax designator chars. |
253 The chars are ordered by their internal syntax codes, which are | 252 The chars are ordered by their internal syntax codes, which are |
254 numbered starting at 0. | 253 numbered starting at 0. |
266 Optional second argument TABLE defaults to the current buffer's | 265 Optional second argument TABLE defaults to the current buffer's |
267 syntax table. | 266 syntax table. |
268 */ | 267 */ |
269 (ch, table)) | 268 (ch, table)) |
270 { | 269 { |
271 Lisp_Char_Table *mirrortab; | 270 struct Lisp_Char_Table *mirrortab; |
272 | 271 |
273 if (NILP(ch)) | 272 if (NILP(ch)) |
274 { | 273 { |
275 ch = make_char('\000'); | 274 ch = make_char('\000'); |
276 } | 275 } |
293 #endif | 292 #endif |
294 | 293 |
295 Lisp_Object | 294 Lisp_Object |
296 syntax_match (Lisp_Object table, Emchar ch) | 295 syntax_match (Lisp_Object table, Emchar ch) |
297 { | 296 { |
298 Lisp_Object code = XCHAR_TABLE_VALUE_UNSAFE (table, ch); | 297 Lisp_Object code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (table), ch); |
299 Lisp_Object code2 = code; | 298 Lisp_Object code2 = code; |
300 | 299 |
301 if (CONSP (code)) | 300 if (CONSP (code)) |
302 code2 = XCAR (code); | 301 code2 = XCAR (code); |
303 if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit) | 302 if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit) |
304 code = XCHAR_TABLE_VALUE_UNSAFE (Vstandard_syntax_table, ch); | 303 code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (Vstandard_syntax_table), |
304 ch); | |
305 | 305 |
306 return CONSP (code) ? XCDR (code) : Qnil; | 306 return CONSP (code) ? XCDR (code) : Qnil; |
307 } | 307 } |
308 | 308 |
309 DEFUN ("matching-paren", Fmatching_paren, 1, 2, 0, /* | 309 DEFUN ("matching-paren", Fmatching_paren, 1, 2, 0, /* |
311 Optional second argument TABLE defaults to the current buffer's | 311 Optional second argument TABLE defaults to the current buffer's |
312 syntax table. | 312 syntax table. |
313 */ | 313 */ |
314 (ch, table)) | 314 (ch, table)) |
315 { | 315 { |
316 Lisp_Char_Table *mirrortab; | 316 struct Lisp_Char_Table *mirrortab; |
317 int code; | 317 int code; |
318 | 318 |
319 CHECK_CHAR_COERCE_INT (ch); | 319 CHECK_CHAR_COERCE_INT (ch); |
320 table = check_syntax_table (table, current_buffer->syntax_table); | 320 table = check_syntax_table (table, current_buffer->syntax_table); |
321 mirrortab = XCHAR_TABLE (XCHAR_TABLE (table)->mirror_table); | 321 mirrortab = XCHAR_TABLE (XCHAR_TABLE (table)->mirror_table); |
325 return Qnil; | 325 return Qnil; |
326 } | 326 } |
327 | 327 |
328 | 328 |
329 | 329 |
330 #ifdef MULE | 330 static int |
331 /* Return 1 if there is a word boundary between two word-constituent | 331 word_constituent_p (struct buffer *buf, Bufpos pos, |
332 characters C1 and C2 if they appear in this order, else return 0. | 332 struct Lisp_Char_Table *tab) |
333 There is no word boundary between two word-constituent ASCII | 333 { |
334 characters. */ | 334 enum syntaxcode code = SYNTAX_UNSAFE (tab, BUF_FETCH_CHAR (buf, pos)); |
335 #define WORD_BOUNDARY_P(c1, c2) \ | 335 return ((words_include_escapes && |
336 (!(CHAR_ASCII_P (c1) && CHAR_ASCII_P (c2)) \ | 336 (code == Sescape || code == Scharquote)) |
337 && word_boundary_p (c1, c2)) | 337 || (code == Sword)); |
338 | 338 } |
339 extern int word_boundary_p (Emchar c1, Emchar c2); | |
340 #endif | |
341 | 339 |
342 /* Return the position across COUNT words from FROM. | 340 /* Return the position across COUNT words from FROM. |
343 If that many words cannot be found before the end of the buffer, return 0. | 341 If that many words cannot be found before the end of the buffer, return 0. |
344 COUNT negative means scan backward and stop at word beginning. */ | 342 COUNT negative means scan backward and stop at word beginning. */ |
345 | 343 |
346 Bufpos | 344 Bufpos |
347 scan_words (struct buffer *buf, Bufpos from, int count) | 345 scan_words (struct buffer *buf, Bufpos from, int count) |
348 { | 346 { |
349 Bufpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf); | 347 Bufpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf); |
350 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 348 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
351 Emchar ch0, ch1; | |
352 enum syntaxcode code; | |
353 | |
354 /* #### is it really worth it to hand expand both cases? JV */ | |
355 while (count > 0) | 349 while (count > 0) |
356 { | 350 { |
357 QUIT; | 351 QUIT; |
358 | 352 |
359 while (1) | 353 while (1) |
360 { | 354 { |
361 if (from == limit) | 355 if (from == limit) |
362 return 0; | 356 return 0; |
363 | 357 if (word_constituent_p (buf, from, mirrortab)) |
364 ch0 = BUF_FETCH_CHAR (buf, from); | 358 break; |
365 code = SYNTAX_UNSAFE (mirrortab, ch0); | |
366 | |
367 from++; | 359 from++; |
368 if (words_include_escapes | |
369 && (code == Sescape || code == Scharquote)) | |
370 break; | |
371 if (code == Sword) | |
372 break; | |
373 } | 360 } |
374 | 361 |
375 QUIT; | 362 QUIT; |
376 | 363 |
377 while (from != limit) | 364 while ((from != limit) && word_constituent_p (buf, from, mirrortab)) |
378 { | 365 { |
379 ch1 = BUF_FETCH_CHAR (buf, from); | |
380 code = SYNTAX_UNSAFE (mirrortab, ch1); | |
381 if (!(words_include_escapes | |
382 && (code == Sescape || code == Scharquote))) | |
383 if (code != Sword | |
384 #ifdef MULE | |
385 || WORD_BOUNDARY_P (ch0, ch1) | |
386 #endif | |
387 ) | |
388 break; | |
389 #ifdef MULE | |
390 ch0 = ch1; | |
391 #endif | |
392 from++; | 366 from++; |
393 } | 367 } |
394 count--; | 368 count--; |
395 } | 369 } |
396 | 370 |
400 | 374 |
401 while (1) | 375 while (1) |
402 { | 376 { |
403 if (from == limit) | 377 if (from == limit) |
404 return 0; | 378 return 0; |
405 | 379 if (word_constituent_p (buf, from - 1, mirrortab)) |
406 ch1 = BUF_FETCH_CHAR (buf, from - 1); | 380 break; |
407 code = SYNTAX_UNSAFE (mirrortab, ch1); | |
408 | |
409 from--; | 381 from--; |
410 if (words_include_escapes | |
411 && (code == Sescape || code == Scharquote)) | |
412 break; | |
413 if (code == Sword) | |
414 break; | |
415 } | 382 } |
416 | 383 |
417 QUIT; | 384 QUIT; |
418 | 385 |
419 while (from != limit) | 386 while ((from != limit) && word_constituent_p (buf, from - 1, mirrortab)) |
420 { | 387 { |
421 ch0 = BUF_FETCH_CHAR (buf, from - 1); | |
422 code = SYNTAX_UNSAFE (mirrortab, ch0); | |
423 if (!(words_include_escapes | |
424 && (code == Sescape || code == Scharquote))) | |
425 if (code != Sword | |
426 #ifdef MULE | |
427 || WORD_BOUNDARY_P (ch0, ch1) | |
428 #endif | |
429 ) | |
430 break; | |
431 #ifdef MULE | |
432 ch1 = ch0; | |
433 #endif | |
434 from--; | 388 from--; |
435 } | 389 } |
436 count++; | 390 count++; |
437 } | 391 } |
438 | 392 |
472 static int | 426 static int |
473 find_start_of_comment (struct buffer *buf, Bufpos from, Bufpos stop, int mask) | 427 find_start_of_comment (struct buffer *buf, Bufpos from, Bufpos stop, int mask) |
474 { | 428 { |
475 Emchar c; | 429 Emchar c; |
476 enum syntaxcode code; | 430 enum syntaxcode code; |
477 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 431 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
478 | 432 |
479 /* Look back, counting the parity of string-quotes, | 433 /* Look back, counting the parity of string-quotes, |
480 and recording the comment-starters seen. | 434 and recording the comment-starters seen. |
481 When we reach a safe place, assume that's not in a string; | 435 When we reach a safe place, assume that's not in a string; |
482 then step the main scan to the earliest comment-starter seen | 436 then step the main scan to the earliest comment-starter seen |
606 | 560 |
607 static Bufpos | 561 static Bufpos |
608 find_end_of_comment (struct buffer *buf, Bufpos from, Bufpos stop, int mask) | 562 find_end_of_comment (struct buffer *buf, Bufpos from, Bufpos stop, int mask) |
609 { | 563 { |
610 int c; | 564 int c; |
611 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 565 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
612 | 566 |
613 while (1) | 567 while (1) |
614 { | 568 { |
615 if (from == stop) | 569 if (from == stop) |
616 { | 570 { |
657 { | 611 { |
658 Bufpos from; | 612 Bufpos from; |
659 Bufpos stop; | 613 Bufpos stop; |
660 Emchar c; | 614 Emchar c; |
661 enum syntaxcode code; | 615 enum syntaxcode code; |
662 EMACS_INT count; | 616 int count; |
663 struct buffer *buf = decode_buffer (buffer, 0); | 617 struct buffer *buf = decode_buffer (buffer, 0); |
664 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 618 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
665 | 619 |
666 CHECK_INT (n); | 620 CHECK_INT (n); |
667 count = XINT (n); | 621 count = XINT (n); |
668 | 622 |
669 from = BUF_PT (buf); | 623 from = BUF_PT (buf); |
813 int quoted; | 767 int quoted; |
814 int mathexit = 0; | 768 int mathexit = 0; |
815 enum syntaxcode code; | 769 enum syntaxcode code; |
816 int min_depth = depth; /* Err out if depth gets less than this. */ | 770 int min_depth = depth; /* Err out if depth gets less than this. */ |
817 Lisp_Object syntaxtab = buf->syntax_table; | 771 Lisp_Object syntaxtab = buf->syntax_table; |
818 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 772 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
819 | 773 |
820 if (depth > 0) min_depth = 0; | 774 if (depth > 0) min_depth = 0; |
821 | 775 |
822 while (count > 0) | 776 while (count > 0) |
823 { | 777 { |
1023 } | 977 } |
1024 | 978 |
1025 if (SYNTAX_PREFIX_UNSAFE (mirrortab, c)) | 979 if (SYNTAX_PREFIX_UNSAFE (mirrortab, c)) |
1026 continue; | 980 continue; |
1027 | 981 |
1028 switch (quoted ? Sword : code) | 982 switch (((quoted) ? Sword : code)) |
1029 { | 983 { |
1030 case Sword: | 984 case Sword: |
1031 case Ssymbol: | 985 case Ssymbol: |
1032 if (depth || !sexpflag) break; | 986 if (depth || !sexpflag) break; |
1033 /* This word counts as a sexp; count object finished after | 987 /* This word counts as a sexp; count object finished after |
1132 char_quoted (struct buffer *buf, Bufpos pos) | 1086 char_quoted (struct buffer *buf, Bufpos pos) |
1133 { | 1087 { |
1134 enum syntaxcode code; | 1088 enum syntaxcode code; |
1135 Bufpos beg = BUF_BEGV (buf); | 1089 Bufpos beg = BUF_BEGV (buf); |
1136 int quoted = 0; | 1090 int quoted = 0; |
1137 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 1091 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
1138 | 1092 |
1139 while (pos > beg | 1093 while (pos > beg |
1140 && ((code = SYNTAX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1))) | 1094 && ((code = SYNTAX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1))) |
1141 == Scharquote | 1095 == Scharquote |
1142 || code == Sescape)) | 1096 || code == Sescape)) |
1214 (buffer)) | 1168 (buffer)) |
1215 { | 1169 { |
1216 struct buffer *buf = decode_buffer (buffer, 0); | 1170 struct buffer *buf = decode_buffer (buffer, 0); |
1217 Bufpos beg = BUF_BEGV (buf); | 1171 Bufpos beg = BUF_BEGV (buf); |
1218 Bufpos pos = BUF_PT (buf); | 1172 Bufpos pos = BUF_PT (buf); |
1219 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 1173 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
1220 | 1174 |
1221 while (pos > beg && !char_quoted (buf, pos - 1) | 1175 while (pos > beg && !char_quoted (buf, pos - 1) |
1222 && (SYNTAX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1)) == Squote | 1176 && (SYNTAX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1)) == Squote |
1223 || SYNTAX_PREFIX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1)))) | 1177 || SYNTAX_PREFIX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1)))) |
1224 pos--; | 1178 pos--; |
1254 int mindepth; /* Lowest DEPTH value seen. */ | 1208 int mindepth; /* Lowest DEPTH value seen. */ |
1255 int start_quoted = 0; /* Nonzero means starting after a char quote */ | 1209 int start_quoted = 0; /* Nonzero means starting after a char quote */ |
1256 Lisp_Object tem; | 1210 Lisp_Object tem; |
1257 int mask; /* comment mask */ | 1211 int mask; /* comment mask */ |
1258 Lisp_Object syntaxtab = buf->syntax_table; | 1212 Lisp_Object syntaxtab = buf->syntax_table; |
1259 Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); | 1213 struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); |
1260 | 1214 |
1261 if (NILP (oldstate)) | 1215 if (NILP (oldstate)) |
1262 { | 1216 { |
1263 depth = 0; | 1217 depth = 0; |
1264 state.instring = -1; | 1218 state.instring = -1; |
1607 put_char_table (XCHAR_TABLE (closure->mirrortab), range, val); | 1561 put_char_table (XCHAR_TABLE (closure->mirrortab), range, val); |
1608 return 0; | 1562 return 0; |
1609 } | 1563 } |
1610 | 1564 |
1611 static void | 1565 static void |
1612 update_just_this_syntax_table (Lisp_Char_Table *ct) | 1566 update_just_this_syntax_table (struct Lisp_Char_Table *ct) |
1613 { | 1567 { |
1614 struct chartab_range range; | 1568 struct chartab_range range; |
1615 struct cmst_arg arg; | 1569 struct cmst_arg arg; |
1616 | 1570 |
1617 arg.mirrortab = ct->mirror_table; | 1571 arg.mirrortab = ct->mirror_table; |
1625 If this is the standard syntax table, we need to recompute | 1579 If this is the standard syntax table, we need to recompute |
1626 *all* syntax tables (yuck). Otherwise we just recompute this | 1580 *all* syntax tables (yuck). Otherwise we just recompute this |
1627 one. */ | 1581 one. */ |
1628 | 1582 |
1629 void | 1583 void |
1630 update_syntax_table (Lisp_Char_Table *ct) | 1584 update_syntax_table (struct Lisp_Char_Table *ct) |
1631 { | 1585 { |
1632 /* Don't be stymied at startup. */ | 1586 /* Don't be stymied at startup. */ |
1633 if (CHAR_TABLEP (Vstandard_syntax_table) | 1587 if (CHAR_TABLEP (Vstandard_syntax_table) |
1634 && ct == XCHAR_TABLE (Vstandard_syntax_table)) | 1588 && ct == XCHAR_TABLE (Vstandard_syntax_table)) |
1635 { | 1589 { |
1677 vars_of_syntax (void) | 1631 vars_of_syntax (void) |
1678 { | 1632 { |
1679 DEFVAR_BOOL ("parse-sexp-ignore-comments", &parse_sexp_ignore_comments /* | 1633 DEFVAR_BOOL ("parse-sexp-ignore-comments", &parse_sexp_ignore_comments /* |
1680 Non-nil means `forward-sexp', etc., should treat comments as whitespace. | 1634 Non-nil means `forward-sexp', etc., should treat comments as whitespace. |
1681 */ ); | 1635 */ ); |
1682 parse_sexp_ignore_comments = 0; | 1636 |
1683 | 1637 words_include_escapes = 0; |
1684 DEFVAR_BOOL ("words-include-escapes", &words_include_escapes /* | 1638 DEFVAR_BOOL ("words-include-escapes", &words_include_escapes /* |
1685 Non-nil means `forward-word', etc., should treat escape chars part of words. | 1639 Non-nil means `forward-word', etc., should treat escape chars part of words. |
1686 */ ); | 1640 */ ); |
1687 words_include_escapes = 0; | |
1688 | 1641 |
1689 no_quit_in_re_search = 0; | 1642 no_quit_in_re_search = 0; |
1690 } | |
1691 | |
1692 static void | |
1693 define_standard_syntax (const char *p, enum syntaxcode syn) | |
1694 { | |
1695 for (; *p; p++) | |
1696 Fput_char_table (make_char (*p), make_int (syn), Vstandard_syntax_table); | |
1697 } | 1643 } |
1698 | 1644 |
1699 void | 1645 void |
1700 complex_vars_of_syntax (void) | 1646 complex_vars_of_syntax (void) |
1701 { | 1647 { |
1702 Emchar i; | |
1703 const char *p; | |
1704 /* Set this now, so first buffer creation can refer to it. */ | 1648 /* Set this now, so first buffer creation can refer to it. */ |
1705 /* Make it nil before calling copy-syntax-table | 1649 /* Make it nil before calling copy-syntax-table |
1706 so that copy-syntax-table will know not to try to copy from garbage */ | 1650 so that copy-syntax-table will know not to try to copy from garbage */ |
1707 Vstandard_syntax_table = Qnil; | 1651 Vstandard_syntax_table = Qnil; |
1708 Vstandard_syntax_table = Fcopy_syntax_table (Qnil); | 1652 Vstandard_syntax_table = Fcopy_syntax_table (Qnil); |
1710 | 1654 |
1711 Vsyntax_designator_chars_string = make_string_nocopy (syntax_code_spec, | 1655 Vsyntax_designator_chars_string = make_string_nocopy (syntax_code_spec, |
1712 Smax); | 1656 Smax); |
1713 staticpro (&Vsyntax_designator_chars_string); | 1657 staticpro (&Vsyntax_designator_chars_string); |
1714 | 1658 |
1715 fill_char_table (XCHAR_TABLE (Vstandard_syntax_table), make_int (Spunct)); | 1659 fill_char_table (XCHAR_TABLE (Vstandard_syntax_table), |
1716 | 1660 make_int (Spunct)); |
1717 for (i = 0; i <= 32; i++) /* Control 0 plus SPACE */ | 1661 |
1718 Fput_char_table (make_char (i), make_int (Swhitespace), | 1662 { |
1663 Emchar i; | |
1664 | |
1665 for (i = 0; i <= 32; i++) | |
1666 Fput_char_table (make_char (i), make_int ((int) Swhitespace), | |
1667 Vstandard_syntax_table); | |
1668 for (i = 127; i <= 159; i++) | |
1669 Fput_char_table (make_char (i), make_int ((int) Swhitespace), | |
1670 Vstandard_syntax_table); | |
1671 | |
1672 for (i = 'a'; i <= 'z'; i++) | |
1673 Fput_char_table (make_char (i), make_int ((int) Sword), | |
1674 Vstandard_syntax_table); | |
1675 for (i = 'A'; i <= 'Z'; i++) | |
1676 Fput_char_table (make_char (i), make_int ((int) Sword), | |
1677 Vstandard_syntax_table); | |
1678 for (i = '0'; i <= '9'; i++) | |
1679 Fput_char_table (make_char (i), make_int ((int) Sword), | |
1680 Vstandard_syntax_table); | |
1681 Fput_char_table (make_char ('$'), make_int ((int) Sword), | |
1719 Vstandard_syntax_table); | 1682 Vstandard_syntax_table); |
1720 for (i = 127; i <= 159; i++) /* DEL plus Control 1 */ | 1683 Fput_char_table (make_char ('%'), make_int ((int) Sword), |
1721 Fput_char_table (make_char (i), make_int (Swhitespace), | |
1722 Vstandard_syntax_table); | 1684 Vstandard_syntax_table); |
1723 | 1685 |
1724 define_standard_syntax ("abcdefghijklmnopqrstuvwxyz" | 1686 { |
1725 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | 1687 Fput_char_table (make_char ('('), Fcons (make_int ((int) Sopen), |
1726 "0123456789" | 1688 make_char (')')), |
1727 "$%", Sword); | |
1728 define_standard_syntax ("\"", Sstring); | |
1729 define_standard_syntax ("\\", Sescape); | |
1730 define_standard_syntax ("_-+*/&|<>=", Ssymbol); | |
1731 define_standard_syntax (".,;:?!#@~^'`", Spunct); | |
1732 | |
1733 for (p = "()[]{}"; *p; p+=2) | |
1734 { | |
1735 Fput_char_table (make_char (p[0]), | |
1736 Fcons (make_int (Sopen), make_char (p[1])), | |
1737 Vstandard_syntax_table); | 1689 Vstandard_syntax_table); |
1738 Fput_char_table (make_char (p[1]), | 1690 Fput_char_table (make_char (')'), Fcons (make_int ((int) Sclose), |
1739 Fcons (make_int (Sclose), make_char (p[0])), | 1691 make_char ('(')), |
1740 Vstandard_syntax_table); | 1692 Vstandard_syntax_table); |
1741 } | 1693 Fput_char_table (make_char ('['), Fcons (make_int ((int) Sopen), |
1742 } | 1694 make_char (']')), |
1695 Vstandard_syntax_table); | |
1696 Fput_char_table (make_char (']'), Fcons (make_int ((int) Sclose), | |
1697 make_char ('[')), | |
1698 Vstandard_syntax_table); | |
1699 Fput_char_table (make_char ('{'), Fcons (make_int ((int) Sopen), | |
1700 make_char ('}')), | |
1701 Vstandard_syntax_table); | |
1702 Fput_char_table (make_char ('}'), Fcons (make_int ((int) Sclose), | |
1703 make_char ('{')), | |
1704 Vstandard_syntax_table); | |
1705 } | |
1706 | |
1707 Fput_char_table (make_char ('"'), make_int ((int) Sstring), | |
1708 Vstandard_syntax_table); | |
1709 Fput_char_table (make_char ('\\'), make_int ((int) Sescape), | |
1710 Vstandard_syntax_table); | |
1711 | |
1712 { | |
1713 CONST char *p; | |
1714 for (p = "_-+*/&|<>="; *p; p++) | |
1715 Fput_char_table (make_char (*p), make_int ((int) Ssymbol), | |
1716 Vstandard_syntax_table); | |
1717 | |
1718 for (p = ".,;:?!#@~^'`"; *p; p++) | |
1719 Fput_char_table (make_char (*p), make_int ((int) Spunct), | |
1720 Vstandard_syntax_table); | |
1721 } | |
1722 } | |
1723 } |