diff options
| author | Kenichi Handa | 2012-07-17 07:25:00 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-07-17 07:25:00 +0900 |
| commit | 69c41c4070c86baac11a627e9c3d366420aeb7cc (patch) | |
| tree | e07fda92570b5e4f264c9a7869b57960940008f0 /src/syntax.c | |
| parent | 8c536f15bf95916d56bb50495d22b7da7e09fff9 (diff) | |
| parent | 758e556a7ab8f61c007e34310ba399a9aaf15362 (diff) | |
| download | emacs-69c41c4070c86baac11a627e9c3d366420aeb7cc.tar.gz emacs-69c41c4070c86baac11a627e9c3d366420aeb7cc.zip | |
merge trunk
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/syntax.c b/src/syntax.c index 71da13e7a66..69c2789ed39 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -25,8 +25,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | #include <setjmp.h> | 25 | #include <setjmp.h> |
| 26 | #include "lisp.h" | 26 | #include "lisp.h" |
| 27 | #include "commands.h" | 27 | #include "commands.h" |
| 28 | #include "buffer.h" | ||
| 29 | #include "character.h" | 28 | #include "character.h" |
| 29 | #include "buffer.h" | ||
| 30 | #include "keymap.h" | 30 | #include "keymap.h" |
| 31 | #include "regex.h" | 31 | #include "regex.h" |
| 32 | 32 | ||
| @@ -143,7 +143,6 @@ static ptrdiff_t find_start_begv; | |||
| 143 | static EMACS_INT find_start_modiff; | 143 | static EMACS_INT find_start_modiff; |
| 144 | 144 | ||
| 145 | 145 | ||
| 146 | static Lisp_Object Fsyntax_table_p (Lisp_Object); | ||
| 147 | static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); | 146 | static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); |
| 148 | static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); | 147 | static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); |
| 149 | static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); | 148 | static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); |
| @@ -988,7 +987,7 @@ text property. */) | |||
| 988 | } | 987 | } |
| 989 | 988 | ||
| 990 | if (val < ASIZE (Vsyntax_code_object) && NILP (match)) | 989 | if (val < ASIZE (Vsyntax_code_object) && NILP (match)) |
| 991 | return XVECTOR (Vsyntax_code_object)->contents[val]; | 990 | return AREF (Vsyntax_code_object, val); |
| 992 | else | 991 | else |
| 993 | /* Since we can't use a shared object, let's make a new one. */ | 992 | /* Since we can't use a shared object, let's make a new one. */ |
| 994 | return Fcons (make_number (val), match); | 993 | return Fcons (make_number (val), match); |
| @@ -1582,7 +1581,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1582 | fastmap[CHAR_LEADING_CODE (c)] = 1; | 1581 | fastmap[CHAR_LEADING_CODE (c)] = 1; |
| 1583 | range_start_byte = i; | 1582 | range_start_byte = i; |
| 1584 | range_start_char = c; | 1583 | range_start_char = c; |
| 1585 | char_ranges = (int *) alloca (sizeof (int) * 128 * 2); | 1584 | char_ranges = alloca (sizeof *char_ranges * 128 * 2); |
| 1586 | for (i = 129; i < 0400; i++) | 1585 | for (i = 129; i < 0400; i++) |
| 1587 | { | 1586 | { |
| 1588 | c = BYTE8_TO_CHAR (i); | 1587 | c = BYTE8_TO_CHAR (i); |
| @@ -1603,7 +1602,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1603 | } | 1602 | } |
| 1604 | else /* STRING is multibyte */ | 1603 | else /* STRING is multibyte */ |
| 1605 | { | 1604 | { |
| 1606 | char_ranges = (int *) alloca (sizeof (int) * SCHARS (string) * 2); | 1605 | char_ranges = alloca (sizeof *char_ranges * SCHARS (string) * 2); |
| 1607 | 1606 | ||
| 1608 | while (i_byte < size_byte) | 1607 | while (i_byte < size_byte) |
| 1609 | { | 1608 | { |
| @@ -3386,32 +3385,31 @@ init_syntax_once (void) | |||
| 3386 | /* Create objects which can be shared among syntax tables. */ | 3385 | /* Create objects which can be shared among syntax tables. */ |
| 3387 | Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); | 3386 | Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); |
| 3388 | for (i = 0; i < ASIZE (Vsyntax_code_object); i++) | 3387 | for (i = 0; i < ASIZE (Vsyntax_code_object); i++) |
| 3389 | XVECTOR (Vsyntax_code_object)->contents[i] | 3388 | ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil)); |
| 3390 | = Fcons (make_number (i), Qnil); | ||
| 3391 | 3389 | ||
| 3392 | /* Now we are ready to set up this property, so we can | 3390 | /* Now we are ready to set up this property, so we can |
| 3393 | create syntax tables. */ | 3391 | create syntax tables. */ |
| 3394 | Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0)); | 3392 | Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0)); |
| 3395 | 3393 | ||
| 3396 | temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace]; | 3394 | temp = AREF (Vsyntax_code_object, (int) Swhitespace); |
| 3397 | 3395 | ||
| 3398 | Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); | 3396 | Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); |
| 3399 | 3397 | ||
| 3400 | /* Control characters should not be whitespace. */ | 3398 | /* Control characters should not be whitespace. */ |
| 3401 | temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; | 3399 | temp = AREF (Vsyntax_code_object, (int) Spunct); |
| 3402 | for (i = 0; i <= ' ' - 1; i++) | 3400 | for (i = 0; i <= ' ' - 1; i++) |
| 3403 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); | 3401 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
| 3404 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); | 3402 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); |
| 3405 | 3403 | ||
| 3406 | /* Except that a few really are whitespace. */ | 3404 | /* Except that a few really are whitespace. */ |
| 3407 | temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace]; | 3405 | temp = AREF (Vsyntax_code_object, (int) Swhitespace); |
| 3408 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); | 3406 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); |
| 3409 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); | 3407 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); |
| 3410 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); | 3408 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); |
| 3411 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); | 3409 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); |
| 3412 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); | 3410 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); |
| 3413 | 3411 | ||
| 3414 | temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; | 3412 | temp = AREF (Vsyntax_code_object, (int) Sword); |
| 3415 | for (i = 'a'; i <= 'z'; i++) | 3413 | for (i = 'a'; i <= 'z'; i++) |
| 3416 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); | 3414 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
| 3417 | for (i = 'A'; i <= 'Z'; i++) | 3415 | for (i = 'A'; i <= 'Z'; i++) |
| @@ -3439,14 +3437,14 @@ init_syntax_once (void) | |||
| 3439 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\', | 3437 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\', |
| 3440 | Fcons (make_number ((int) Sescape), Qnil)); | 3438 | Fcons (make_number ((int) Sescape), Qnil)); |
| 3441 | 3439 | ||
| 3442 | temp = XVECTOR (Vsyntax_code_object)->contents[(int) Ssymbol]; | 3440 | temp = AREF (Vsyntax_code_object, (int) Ssymbol); |
| 3443 | for (i = 0; i < 10; i++) | 3441 | for (i = 0; i < 10; i++) |
| 3444 | { | 3442 | { |
| 3445 | c = "_-+*/&|<>="[i]; | 3443 | c = "_-+*/&|<>="[i]; |
| 3446 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); | 3444 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); |
| 3447 | } | 3445 | } |
| 3448 | 3446 | ||
| 3449 | temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; | 3447 | temp = AREF (Vsyntax_code_object, (int) Spunct); |
| 3450 | for (i = 0; i < 12; i++) | 3448 | for (i = 0; i < 12; i++) |
| 3451 | { | 3449 | { |
| 3452 | c = ".,;:?!#@~^'`"[i]; | 3450 | c = ".,;:?!#@~^'`"[i]; |
| @@ -3454,7 +3452,7 @@ init_syntax_once (void) | |||
| 3454 | } | 3452 | } |
| 3455 | 3453 | ||
| 3456 | /* All multibyte characters have syntax `word' by default. */ | 3454 | /* All multibyte characters have syntax `word' by default. */ |
| 3457 | temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; | 3455 | temp = AREF (Vsyntax_code_object, (int) Sword); |
| 3458 | char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); | 3456 | char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); |
| 3459 | } | 3457 | } |
| 3460 | 3458 | ||
| @@ -3477,7 +3475,7 @@ syms_of_syntax (void) | |||
| 3477 | Fput (Qscan_error, Qerror_conditions, | 3475 | Fput (Qscan_error, Qerror_conditions, |
| 3478 | pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); | 3476 | pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); |
| 3479 | Fput (Qscan_error, Qerror_message, | 3477 | Fput (Qscan_error, Qerror_message, |
| 3480 | make_pure_c_string ("Scan error")); | 3478 | build_pure_c_string ("Scan error")); |
| 3481 | 3479 | ||
| 3482 | DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments, | 3480 | DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments, |
| 3483 | doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); | 3481 | doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); |