comparison src/syntax.c @ 3540:efa52de8c279

[xemacs-hg @ 2006-08-04 20:01:05 by aidan] Handle Latin-1 in syntax.c; make guillemets string delimiters.
author aidan
date Fri, 04 Aug 2006 20:01:14 +0000
parents a66d0a29e183
children 981a144e71fa
comparison
equal deleted inserted replaced
3539:9a4534f784c2 3540:efa52de8c279
144 return find_start_value; 144 return find_start_value;
145 } 145 }
146 146
147 DEFUN ("syntax-table-p", Fsyntax_table_p, 1, 1, 0, /* 147 DEFUN ("syntax-table-p", Fsyntax_table_p, 1, 1, 0, /*
148 Return t if OBJECT is a syntax table. 148 Return t if OBJECT is a syntax table.
149 Any vector of 256 elements will do.
150 */ 149 */
151 (object)) 150 (object))
152 { 151 {
153 return (CHAR_TABLEP (object) 152 return (CHAR_TABLEP (object)
154 && XCHAR_TABLE_TYPE (object) == CHAR_TABLE_TYPE_SYNTAX) 153 && XCHAR_TABLE_TYPE (object) == CHAR_TABLE_TYPE_SYNTAX)
2449 Vbogus_syntax_table_value = make_float (0.0); 2448 Vbogus_syntax_table_value = make_float (0.0);
2450 staticpro (&Vbogus_syntax_table_value); 2449 staticpro (&Vbogus_syntax_table_value);
2451 } 2450 }
2452 2451
2453 static void 2452 static void
2454 define_standard_syntax (const char *p, enum syntaxcode syn) 2453 define_standard_syntax (const UExtbyte *p, enum syntaxcode syn)
2455 { 2454 {
2456 for (; *p; p++) 2455 for (; *p; p++)
2457 Fput_char_table (make_char (*p), make_int (syn), Vstandard_syntax_table); 2456 Fput_char_table (make_char (*p), make_int (syn), Vstandard_syntax_table);
2458 } 2457 }
2459 2458
2460 void 2459 void
2461 complex_vars_of_syntax (void) 2460 complex_vars_of_syntax (void)
2462 { 2461 {
2463 Ichar i; 2462 Ichar i;
2464 const char *p; 2463 const UExtbyte *p; /* Latin-1, not internal format. */
2465 /* Set this now, so first buffer creation can refer to it. */ 2464
2466 /* Make it nil before calling copy-syntax-table 2465 #define SET_RANGE_SYNTAX(start, end, syntax) \
2467 so that copy-syntax-table will know not to try to copy from garbage */ 2466 do { \
2467 for (i = start; i <= end; i++) \
2468 Fput_char_table(make_char(i), make_int(syntax), \
2469 Vstandard_syntax_table); \
2470 } while (0)
2471
2472 /* Set this now, so first buffer creation can refer to it.
2473
2474 Make it nil before calling copy-syntax-table so that copy-syntax-table
2475 will know not to try to copy from garbage */
2468 Vstandard_syntax_table = Qnil; 2476 Vstandard_syntax_table = Qnil;
2469 Vstandard_syntax_table = Fcopy_syntax_table (Qnil); 2477 Vstandard_syntax_table = Fcopy_syntax_table (Qnil);
2470 staticpro (&Vstandard_syntax_table); 2478 staticpro (&Vstandard_syntax_table);
2471 2479
2472 Vtemp_table_for_use_updating_syntax_tables = Fmake_char_table (Qgeneric); 2480 Vtemp_table_for_use_updating_syntax_tables = Fmake_char_table (Qgeneric);
2474 2482
2475 Vsyntax_designator_chars_string = make_string_nocopy (syntax_code_spec, 2483 Vsyntax_designator_chars_string = make_string_nocopy (syntax_code_spec,
2476 Smax); 2484 Smax);
2477 staticpro (&Vsyntax_designator_chars_string); 2485 staticpro (&Vsyntax_designator_chars_string);
2478 2486
2487 /* Default character syntax is word. */
2479 set_char_table_default (Vstandard_syntax_table, make_int (Sword)); 2488 set_char_table_default (Vstandard_syntax_table, make_int (Sword));
2480 2489
2481 for (i = 0; i <= 32; i++) /* Control 0 plus SPACE */ 2490 /* Control 0; treat as punctuation */
2482 Fput_char_table (make_char (i), make_int (Swhitespace), 2491 SET_RANGE_SYNTAX(0, 32, Spunct);
2483 Vstandard_syntax_table); 2492
2484 for (i = 127; i <= 159; i++) /* DEL plus Control 1 */ 2493 /* The whitespace--overwriting some of the above changes. */
2485 Fput_char_table (make_char (i), make_int (Swhitespace), 2494 define_standard_syntax(" \t\015\014", Swhitespace);
2486 Vstandard_syntax_table); 2495
2487 2496 /* DEL plus Control 1 */
2488 define_standard_syntax ("abcdefghijklmnopqrstuvwxyz" 2497 SET_RANGE_SYNTAX(127, 159, Spunct);
2489 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 2498
2490 "0123456789"
2491 "$%", Sword);
2492 define_standard_syntax ("\"", Sstring); 2499 define_standard_syntax ("\"", Sstring);
2493 define_standard_syntax ("\\", Sescape); 2500 define_standard_syntax ("\\", Sescape);
2494 define_standard_syntax ("_-+*/&|<>=", Ssymbol); 2501 define_standard_syntax ("_-+*/&|<>=", Ssymbol);
2495 define_standard_syntax (".,;:?!#@~^'`", Spunct); 2502 define_standard_syntax (".,;:?!#@~^'`", Spunct);
2496 2503
2501 Vstandard_syntax_table); 2508 Vstandard_syntax_table);
2502 Fput_char_table (make_char (p[1]), 2509 Fput_char_table (make_char (p[1]),
2503 Fcons (make_int (Sclose), make_char (p[0])), 2510 Fcons (make_int (Sclose), make_char (p[0])),
2504 Vstandard_syntax_table); 2511 Vstandard_syntax_table);
2505 } 2512 }
2506 } 2513
2514 /* Latin 1 "symbols." This contrasts with the FSF, where they're word
2515 constituents. */
2516 SET_RANGE_SYNTAX(0240, 0277, Ssymbol);
2517
2518 /* The guillemets. These are not parentheses, in contrast to what the old
2519 code did. */
2520 define_standard_syntax("\253\273", Sstring);
2521
2522 /* The inverted exclamation mark, and the multiplication and division
2523 signs. */
2524 define_standard_syntax("\241\327\367", Spunct);
2525
2526 #undef SET_RANGE_SYNTAX
2527 }