diff options
| author | Tom Tromey | 2013-07-06 23:18:58 -0600 |
|---|---|---|
| committer | Tom Tromey | 2013-07-06 23:18:58 -0600 |
| commit | 6dacdad5fcb278e5a16b38bb81786aac9ca27be4 (patch) | |
| tree | f5f331ea361ba0f99e0f9b638d183ad492a7da31 /src/syntax.c | |
| parent | 0a6f2ff0c8ceb29703e76cddd46ea3f176dd873a (diff) | |
| parent | 219afb88d9d484393418820d1c08dc93299110ec (diff) | |
| download | emacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.tar.gz emacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.zip | |
merge from trunk
this merges frmo trunk and fixes various build issues.
this needed a few ugly tweaks.
this hangs in "make check" now
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 396 |
1 files changed, 183 insertions, 213 deletions
diff --git a/src/syntax.c b/src/syntax.c index 390d732944d..ea15cf68c43 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -36,7 +36,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 36 | #include "intervals.h" | 36 | #include "intervals.h" |
| 37 | #include "category.h" | 37 | #include "category.h" |
| 38 | 38 | ||
| 39 | /* Then there are seven single-bit flags that have the following meanings: | 39 | /* Eight single-bit flags have the following meanings: |
| 40 | 1. This character is the first of a two-character comment-start sequence. | 40 | 1. This character is the first of a two-character comment-start sequence. |
| 41 | 2. This character is the second of a two-character comment-start sequence. | 41 | 2. This character is the second of a two-character comment-start sequence. |
| 42 | 3. This character is the first of a two-character comment-end sequence. | 42 | 3. This character is the first of a two-character comment-end sequence. |
| @@ -48,16 +48,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 48 | Note that any two-character sequence whose first character has flag 1 | 48 | Note that any two-character sequence whose first character has flag 1 |
| 49 | and whose second character has flag 2 will be interpreted as a comment start. | 49 | and whose second character has flag 2 will be interpreted as a comment start. |
| 50 | 50 | ||
| 51 | bit 6 and 8 are used to discriminate between different comment styles. | 51 | Bits 6 and 8 discriminate among different comment styles. |
| 52 | Languages such as C++ allow two orthogonal syntax start/end pairs | 52 | Languages such as C++ allow two orthogonal syntax start/end pairs |
| 53 | and bit 6 is used to determine whether a comment-end or Scommentend | 53 | and bit 6 determines whether a comment-end or Scommentend |
| 54 | ends style a or b. Comment markers can start style a, b, c, or bc. | 54 | ends style a or b. Comment markers can start style a, b, c, or bc. |
| 55 | Style a is always the default. | 55 | Style a is always the default. |
| 56 | For 2-char comment markers, the style b flag is only looked up on the second | 56 | For 2-char comment markers, the style b flag is looked up only on the second |
| 57 | char of the comment marker and on the first char of the comment ender. | 57 | char of the comment marker and on the first char of the comment ender. |
| 58 | For style c (like to for the nested flag), the flag can be placed on any | 58 | For style c (like the nested flag), the flag can be placed on any of |
| 59 | one of the chars. | 59 | the chars. */ |
| 60 | */ | ||
| 61 | 60 | ||
| 62 | /* These macros extract specific flags from an integer | 61 | /* These macros extract specific flags from an integer |
| 63 | that holds the syntax code and the flags. */ | 62 | that holds the syntax code and the flags. */ |
| @@ -73,13 +72,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 73 | #define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) | 72 | #define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) |
| 74 | 73 | ||
| 75 | #define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1) | 74 | #define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1) |
| 76 | #define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 22) & 2) | 75 | #define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 23) & 1) |
| 76 | #define SYNTAX_FLAGS_COMMENT_STYLEC2(flags) (((flags) >> 22) & 2) /* C * 2 */ | ||
| 77 | /* FLAGS should be the flags of the main char of the comment marker, e.g. | 77 | /* FLAGS should be the flags of the main char of the comment marker, e.g. |
| 78 | the second for comstart and the first for comend. */ | 78 | the second for comstart and the first for comend. */ |
| 79 | #define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \ | 79 | #define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \ |
| 80 | (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \ | 80 | (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \ |
| 81 | | SYNTAX_FLAGS_COMMENT_STYLEC (flags) \ | 81 | | SYNTAX_FLAGS_COMMENT_STYLEC2 (flags) \ |
| 82 | | SYNTAX_FLAGS_COMMENT_STYLEC (other_flags)) | 82 | | SYNTAX_FLAGS_COMMENT_STYLEC2 (other_flags)) |
| 83 | 83 | ||
| 84 | #define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1) | 84 | #define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1) |
| 85 | 85 | ||
| @@ -114,7 +114,7 @@ struct lisp_parse_state | |||
| 114 | int instring; /* -1 if not within string, else desired terminator. */ | 114 | int instring; /* -1 if not within string, else desired terminator. */ |
| 115 | EMACS_INT incomment; /* -1 if in unnestable comment else comment nesting */ | 115 | EMACS_INT incomment; /* -1 if in unnestable comment else comment nesting */ |
| 116 | int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ | 116 | int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ |
| 117 | int quoted; /* Nonzero if just after an escape char at end of parsing */ | 117 | bool quoted; /* True if just after an escape char at end of parsing. */ |
| 118 | EMACS_INT mindepth; /* Minimum depth seen while scanning. */ | 118 | EMACS_INT mindepth; /* Minimum depth seen while scanning. */ |
| 119 | /* Char number of most recent start-of-expression at current level */ | 119 | /* Char number of most recent start-of-expression at current level */ |
| 120 | ptrdiff_t thislevelstart; | 120 | ptrdiff_t thislevelstart; |
| @@ -143,13 +143,13 @@ 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 skip_chars (int, Lisp_Object, Lisp_Object, int); | 146 | static Lisp_Object skip_chars (bool, Lisp_Object, Lisp_Object, bool); |
| 147 | static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); | 147 | static Lisp_Object skip_syntaxes (bool, Lisp_Object, Lisp_Object); |
| 148 | static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); | 148 | static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, bool); |
| 149 | static void scan_sexps_forward (struct lisp_parse_state *, | 149 | static void scan_sexps_forward (struct lisp_parse_state *, |
| 150 | ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, | 150 | ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, |
| 151 | int, Lisp_Object, int); | 151 | bool, Lisp_Object, int); |
| 152 | static int in_classes (int, Lisp_Object); | 152 | static bool in_classes (int, Lisp_Object); |
| 153 | 153 | ||
| 154 | /* This setter is used only in this file, so it can be private. */ | 154 | /* This setter is used only in this file, so it can be private. */ |
| 155 | static void | 155 | static void |
| @@ -159,7 +159,8 @@ bset_syntax_table (struct buffer *b, Lisp_Object val) | |||
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | /* Whether the syntax of the character C has the prefix flag set. */ | 161 | /* Whether the syntax of the character C has the prefix flag set. */ |
| 162 | int syntax_prefix_flag_p (int c) | 162 | bool |
| 163 | syntax_prefix_flag_p (int c) | ||
| 163 | { | 164 | { |
| 164 | return SYNTAX_PREFIX (c); | 165 | return SYNTAX_PREFIX (c); |
| 165 | } | 166 | } |
| @@ -183,12 +184,12 @@ struct gl_state_s gl_state; /* Global state of syntax parser. */ | |||
| 183 | start/end of OBJECT. */ | 184 | start/end of OBJECT. */ |
| 184 | 185 | ||
| 185 | void | 186 | void |
| 186 | update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, | 187 | update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, |
| 187 | Lisp_Object object) | 188 | Lisp_Object object) |
| 188 | { | 189 | { |
| 189 | Lisp_Object tmp_table; | 190 | Lisp_Object tmp_table; |
| 190 | unsigned cnt = 0; | 191 | int cnt = 0; |
| 191 | int invalidate = 1; | 192 | bool invalidate = 1; |
| 192 | INTERVAL i; | 193 | INTERVAL i; |
| 193 | 194 | ||
| 194 | if (init) | 195 | if (init) |
| @@ -340,16 +341,16 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, | |||
| 340 | gl_state.b_property = gl_state.start; | 341 | gl_state.b_property = gl_state.start; |
| 341 | } | 342 | } |
| 342 | 343 | ||
| 343 | /* Returns TRUE if char at CHARPOS is quoted. | 344 | /* Returns true if char at CHARPOS is quoted. |
| 344 | Global syntax-table data should be set up already to be good at CHARPOS | 345 | Global syntax-table data should be set up already to be good at CHARPOS |
| 345 | or after. On return global syntax data is good for lookup at CHARPOS. */ | 346 | or after. On return global syntax data is good for lookup at CHARPOS. */ |
| 346 | 347 | ||
| 347 | static int | 348 | static bool |
| 348 | char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos) | 349 | char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos) |
| 349 | { | 350 | { |
| 350 | register enum syntaxcode code; | 351 | enum syntaxcode code; |
| 351 | register ptrdiff_t beg = BEGV; | 352 | ptrdiff_t beg = BEGV; |
| 352 | register int quoted = 0; | 353 | bool quoted = 0; |
| 353 | ptrdiff_t orig = charpos; | 354 | ptrdiff_t orig = charpos; |
| 354 | 355 | ||
| 355 | while (charpos > beg) | 356 | while (charpos > beg) |
| @@ -466,10 +467,11 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 466 | 467 | ||
| 467 | /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ | 468 | /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ |
| 468 | 469 | ||
| 469 | static int | 470 | static bool |
| 470 | prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte) | 471 | prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte) |
| 471 | { | 472 | { |
| 472 | int c, val; | 473 | int c; |
| 474 | bool val; | ||
| 473 | 475 | ||
| 474 | DEC_BOTH (pos, pos_byte); | 476 | DEC_BOTH (pos, pos_byte); |
| 475 | UPDATE_SYNTAX_TABLE_BACKWARD (pos); | 477 | UPDATE_SYNTAX_TABLE_BACKWARD (pos); |
| @@ -479,28 +481,11 @@ prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 479 | return val; | 481 | return val; |
| 480 | } | 482 | } |
| 481 | 483 | ||
| 482 | /* Return the SYNTAX_COMSTART_FIRST of the character before POS, POS_BYTE. */ | 484 | /* Check whether charpos FROM is at the end of a comment. |
| 483 | |||
| 484 | /* static int | ||
| 485 | * prev_char_comstart_first (pos, pos_byte) | ||
| 486 | * int pos, pos_byte; | ||
| 487 | * { | ||
| 488 | * int c, val; | ||
| 489 | * | ||
| 490 | * DEC_BOTH (pos, pos_byte); | ||
| 491 | * UPDATE_SYNTAX_TABLE_BACKWARD (pos); | ||
| 492 | * c = FETCH_CHAR (pos_byte); | ||
| 493 | * val = SYNTAX_COMSTART_FIRST (c); | ||
| 494 | * UPDATE_SYNTAX_TABLE_FORWARD (pos + 1); | ||
| 495 | * return val; | ||
| 496 | * } */ | ||
| 497 | |||
| 498 | /* Checks whether charpos FROM is at the end of a comment. | ||
| 499 | FROM_BYTE is the bytepos corresponding to FROM. | 485 | FROM_BYTE is the bytepos corresponding to FROM. |
| 500 | Do not move back before STOP. | 486 | Do not move back before STOP. |
| 501 | 487 | ||
| 502 | Return a positive value if we find a comment ending at FROM/FROM_BYTE; | 488 | Return true if we find a comment ending at FROM/FROM_BYTE. |
| 503 | return -1 otherwise. | ||
| 504 | 489 | ||
| 505 | If successful, store the charpos of the comment's beginning | 490 | If successful, store the charpos of the comment's beginning |
| 506 | into *CHARPOS_PTR, and the bytepos into *BYTEPOS_PTR. | 491 | into *CHARPOS_PTR, and the bytepos into *BYTEPOS_PTR. |
| @@ -508,8 +493,10 @@ prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 508 | Global syntax data remains valid for backward search starting at | 493 | Global syntax data remains valid for backward search starting at |
| 509 | the returned value (or at FROM, if the search was not successful). */ | 494 | the returned value (or at FROM, if the search was not successful). */ |
| 510 | 495 | ||
| 511 | static int | 496 | static bool |
| 512 | back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested, int comstyle, ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr) | 497 | back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, |
| 498 | bool comnested, int comstyle, ptrdiff_t *charpos_ptr, | ||
| 499 | ptrdiff_t *bytepos_ptr) | ||
| 513 | { | 500 | { |
| 514 | /* Look back, counting the parity of string-quotes, | 501 | /* Look back, counting the parity of string-quotes, |
| 515 | and recording the comment-starters seen. | 502 | and recording the comment-starters seen. |
| @@ -521,13 +508,13 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested | |||
| 521 | which is I+2X quotes from the comment-end. | 508 | which is I+2X quotes from the comment-end. |
| 522 | PARITY is current parity of quotes from the comment end. */ | 509 | PARITY is current parity of quotes from the comment end. */ |
| 523 | int string_style = -1; /* Presumed outside of any string. */ | 510 | int string_style = -1; /* Presumed outside of any string. */ |
| 524 | int string_lossage = 0; | 511 | bool string_lossage = 0; |
| 525 | /* Not a real lossage: indicates that we have passed a matching comment | 512 | /* Not a real lossage: indicates that we have passed a matching comment |
| 526 | starter plus a non-matching comment-ender, meaning that any matching | 513 | starter plus a non-matching comment-ender, meaning that any matching |
| 527 | comment-starter we might see later could be a false positive (hidden | 514 | comment-starter we might see later could be a false positive (hidden |
| 528 | inside another comment). | 515 | inside another comment). |
| 529 | Test case: { a (* b } c (* d *) */ | 516 | Test case: { a (* b } c (* d *) */ |
| 530 | int comment_lossage = 0; | 517 | bool comment_lossage = 0; |
| 531 | ptrdiff_t comment_end = from; | 518 | ptrdiff_t comment_end = from; |
| 532 | ptrdiff_t comment_end_byte = from_byte; | 519 | ptrdiff_t comment_end_byte = from_byte; |
| 533 | ptrdiff_t comstart_pos = 0; | 520 | ptrdiff_t comstart_pos = 0; |
| @@ -536,8 +523,8 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested | |||
| 536 | or 0 if we didn't come across it yet. */ | 523 | or 0 if we didn't come across it yet. */ |
| 537 | ptrdiff_t defun_start = 0; | 524 | ptrdiff_t defun_start = 0; |
| 538 | ptrdiff_t defun_start_byte = 0; | 525 | ptrdiff_t defun_start_byte = 0; |
| 539 | register enum syntaxcode code; | 526 | enum syntaxcode code; |
| 540 | int nesting = 1; /* current comment nesting */ | 527 | ptrdiff_t nesting = 1; /* current comment nesting */ |
| 541 | int c; | 528 | int c; |
| 542 | int syntax = 0; | 529 | int syntax = 0; |
| 543 | 530 | ||
| @@ -550,8 +537,8 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested | |||
| 550 | while (from != stop) | 537 | while (from != stop) |
| 551 | { | 538 | { |
| 552 | ptrdiff_t temp_byte; | 539 | ptrdiff_t temp_byte; |
| 553 | int prev_syntax, com2start, com2end; | 540 | int prev_syntax; |
| 554 | int comstart; | 541 | bool com2start, com2end, comstart; |
| 555 | 542 | ||
| 556 | /* Move back and examine a character. */ | 543 | /* Move back and examine a character. */ |
| 557 | DEC_BOTH (from, from_byte); | 544 | DEC_BOTH (from, from_byte); |
| @@ -772,7 +759,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested | |||
| 772 | *charpos_ptr = from; | 759 | *charpos_ptr = from; |
| 773 | *bytepos_ptr = from_byte; | 760 | *bytepos_ptr = from_byte; |
| 774 | 761 | ||
| 775 | return (from == comment_end) ? -1 : from; | 762 | return from != comment_end; |
| 776 | } | 763 | } |
| 777 | 764 | ||
| 778 | DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0, | 765 | DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0, |
| @@ -854,31 +841,28 @@ One argument, a syntax table. */) | |||
| 854 | into the code it signifies. | 841 | into the code it signifies. |
| 855 | This is used by modify-syntax-entry, and other things. */ | 842 | This is used by modify-syntax-entry, and other things. */ |
| 856 | 843 | ||
| 857 | unsigned char syntax_spec_code[0400] = | 844 | unsigned char const syntax_spec_code[0400] = |
| 858 | { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 845 | { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 859 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 846 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 860 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 847 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 861 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 848 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 862 | (char) Swhitespace, (char) Scomment_fence, (char) Sstring, 0377, | 849 | Swhitespace, Scomment_fence, Sstring, 0377, Smath, 0377, 0377, Squote, |
| 863 | (char) Smath, 0377, 0377, (char) Squote, | 850 | Sopen, Sclose, 0377, 0377, 0377, Swhitespace, Spunct, Scharquote, |
| 864 | (char) Sopen, (char) Sclose, 0377, 0377, | ||
| 865 | 0377, (char) Swhitespace, (char) Spunct, (char) Scharquote, | ||
| 866 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 851 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 867 | 0377, 0377, 0377, 0377, | 852 | 0377, 0377, 0377, 0377, Scomment, 0377, Sendcomment, 0377, |
| 868 | (char) Scomment, 0377, (char) Sendcomment, 0377, | 853 | Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */ |
| 869 | (char) Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */ | ||
| 870 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 854 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 871 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, | 855 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, Sword, |
| 872 | 0377, 0377, 0377, 0377, (char) Sescape, 0377, 0377, (char) Ssymbol, | 856 | 0377, 0377, 0377, 0377, Sescape, 0377, 0377, Ssymbol, |
| 873 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* `, a, ... */ | 857 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* `, a, ... */ |
| 874 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 858 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 875 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, | 859 | 0377, 0377, 0377, 0377, 0377, 0377, 0377, Sword, |
| 876 | 0377, 0377, 0377, 0377, (char) Sstring_fence, 0377, 0377, 0377 | 860 | 0377, 0377, 0377, 0377, Sstring_fence, 0377, 0377, 0377 |
| 877 | }; | 861 | }; |
| 878 | 862 | ||
| 879 | /* Indexed by syntax code, give the letter that describes it. */ | 863 | /* Indexed by syntax code, give the letter that describes it. */ |
| 880 | 864 | ||
| 881 | char syntax_code_spec[16] = | 865 | char const syntax_code_spec[16] = |
| 882 | { | 866 | { |
| 883 | ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@', | 867 | ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@', |
| 884 | '!', '|' | 868 | '!', '|' |
| @@ -904,15 +888,16 @@ are listed in the documentation of `modify-syntax-entry'. */) | |||
| 904 | CHECK_CHARACTER (character); | 888 | CHECK_CHARACTER (character); |
| 905 | char_int = XINT (character); | 889 | char_int = XINT (character); |
| 906 | SETUP_BUFFER_SYNTAX_TABLE (); | 890 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 907 | return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); | 891 | return make_number (syntax_code_spec[SYNTAX (char_int)]); |
| 908 | } | 892 | } |
| 909 | 893 | ||
| 910 | DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, | 894 | DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, |
| 911 | doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) | 895 | doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) |
| 912 | (Lisp_Object character) | 896 | (Lisp_Object character) |
| 913 | { | 897 | { |
| 914 | int char_int, code; | 898 | int char_int; |
| 915 | CHECK_NUMBER (character); | 899 | enum syntaxcode code; |
| 900 | CHECK_CHARACTER (character); | ||
| 916 | char_int = XINT (character); | 901 | char_int = XINT (character); |
| 917 | SETUP_BUFFER_SYNTAX_TABLE (); | 902 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 918 | code = SYNTAX (char_int); | 903 | code = SYNTAX (char_int); |
| @@ -929,19 +914,18 @@ cons cell \(CODE . MATCHING-CHAR) which can be used, for example, as | |||
| 929 | the value of a `syntax-table' text property. */) | 914 | the value of a `syntax-table' text property. */) |
| 930 | (Lisp_Object string) | 915 | (Lisp_Object string) |
| 931 | { | 916 | { |
| 932 | register const unsigned char *p; | 917 | const unsigned char *p; |
| 933 | register enum syntaxcode code; | ||
| 934 | int val; | 918 | int val; |
| 935 | Lisp_Object match; | 919 | Lisp_Object match; |
| 936 | 920 | ||
| 937 | CHECK_STRING (string); | 921 | CHECK_STRING (string); |
| 938 | 922 | ||
| 939 | p = SDATA (string); | 923 | p = SDATA (string); |
| 940 | code = (enum syntaxcode) syntax_spec_code[*p++]; | 924 | val = syntax_spec_code[*p++]; |
| 941 | if (((int) code & 0377) == 0377) | 925 | if (val == 0377) |
| 942 | error ("Invalid syntax description letter: %c", p[-1]); | 926 | error ("Invalid syntax description letter: %c", p[-1]); |
| 943 | 927 | ||
| 944 | if (code == Sinherit) | 928 | if (val == Sinherit) |
| 945 | return Qnil; | 929 | return Qnil; |
| 946 | 930 | ||
| 947 | if (*p) | 931 | if (*p) |
| @@ -956,7 +940,6 @@ the value of a `syntax-table' text property. */) | |||
| 956 | else | 940 | else |
| 957 | match = Qnil; | 941 | match = Qnil; |
| 958 | 942 | ||
| 959 | val = (int) code; | ||
| 960 | while (*p) | 943 | while (*p) |
| 961 | switch (*p++) | 944 | switch (*p++) |
| 962 | { | 945 | { |
| @@ -1078,10 +1061,8 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1078 | doc: /* Insert a description of the internal syntax description SYNTAX at point. */) | 1061 | doc: /* Insert a description of the internal syntax description SYNTAX at point. */) |
| 1079 | (Lisp_Object syntax) | 1062 | (Lisp_Object syntax) |
| 1080 | { | 1063 | { |
| 1081 | register enum syntaxcode code; | 1064 | int code, syntax_code; |
| 1082 | int syntax_code; | 1065 | bool start1, start2, end1, end2, prefix, comstyleb, comstylec, comnested; |
| 1083 | char desc, start1, start2, end1, end2, prefix, | ||
| 1084 | comstyleb, comstylec, comnested; | ||
| 1085 | char str[2]; | 1066 | char str[2]; |
| 1086 | Lisp_Object first, match_lisp, value = syntax; | 1067 | Lisp_Object first, match_lisp, value = syntax; |
| 1087 | 1068 | ||
| @@ -1113,7 +1094,7 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1113 | } | 1094 | } |
| 1114 | 1095 | ||
| 1115 | syntax_code = XINT (first) & INT_MAX; | 1096 | syntax_code = XINT (first) & INT_MAX; |
| 1116 | code = (enum syntaxcode) (syntax_code & 0377); | 1097 | code = syntax_code & 0377; |
| 1117 | start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); | 1098 | start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); |
| 1118 | start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; | 1099 | start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; |
| 1119 | end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code); | 1100 | end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code); |
| @@ -1123,14 +1104,13 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1123 | comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code); | 1104 | comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code); |
| 1124 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code); | 1105 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code); |
| 1125 | 1106 | ||
| 1126 | if ((int) code < 0 || (int) code >= (int) Smax) | 1107 | if (Smax <= code) |
| 1127 | { | 1108 | { |
| 1128 | insert_string ("invalid"); | 1109 | insert_string ("invalid"); |
| 1129 | return syntax; | 1110 | return syntax; |
| 1130 | } | 1111 | } |
| 1131 | desc = syntax_code_spec[(int) code]; | ||
| 1132 | 1112 | ||
| 1133 | str[0] = desc, str[1] = 0; | 1113 | str[0] = syntax_code_spec[code], str[1] = 0; |
| 1134 | insert (str, 1); | 1114 | insert (str, 1); |
| 1135 | 1115 | ||
| 1136 | if (NILP (match_lisp)) | 1116 | if (NILP (match_lisp)) |
| @@ -1431,21 +1411,21 @@ This function returns the distance traveled, either zero or negative. */) | |||
| 1431 | } | 1411 | } |
| 1432 | 1412 | ||
| 1433 | static Lisp_Object | 1413 | static Lisp_Object |
| 1434 | skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_classes) | 1414 | skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim, |
| 1415 | bool handle_iso_classes) | ||
| 1435 | { | 1416 | { |
| 1436 | register unsigned int c; | 1417 | int c; |
| 1437 | unsigned char fastmap[0400]; | 1418 | char fastmap[0400]; |
| 1438 | /* Store the ranges of non-ASCII characters. */ | 1419 | /* Store the ranges of non-ASCII characters. */ |
| 1439 | int *char_ranges IF_LINT (= NULL); | 1420 | int *char_ranges IF_LINT (= NULL); |
| 1440 | int n_char_ranges = 0; | 1421 | int n_char_ranges = 0; |
| 1441 | int negate = 0; | 1422 | bool negate = 0; |
| 1442 | register ptrdiff_t i, i_byte; | 1423 | ptrdiff_t i, i_byte; |
| 1443 | /* Set to 1 if the current buffer is multibyte and the region | 1424 | /* True if the current buffer is multibyte and the region contains |
| 1444 | contains non-ASCII chars. */ | 1425 | non-ASCII chars. */ |
| 1445 | int multibyte; | 1426 | bool multibyte; |
| 1446 | /* Set to 1 if STRING is multibyte and it contains non-ASCII | 1427 | /* True if STRING is multibyte and it contains non-ASCII chars. */ |
| 1447 | chars. */ | 1428 | bool string_multibyte; |
| 1448 | int string_multibyte; | ||
| 1449 | ptrdiff_t size_byte; | 1429 | ptrdiff_t size_byte; |
| 1450 | const unsigned char *str; | 1430 | const unsigned char *str; |
| 1451 | int len; | 1431 | int len; |
| @@ -1489,7 +1469,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1489 | 1469 | ||
| 1490 | if (! string_multibyte) | 1470 | if (! string_multibyte) |
| 1491 | { | 1471 | { |
| 1492 | int string_has_eight_bit = 0; | 1472 | bool string_has_eight_bit = 0; |
| 1493 | 1473 | ||
| 1494 | /* At first setup fastmap. */ | 1474 | /* At first setup fastmap. */ |
| 1495 | while (i_byte < size_byte) | 1475 | while (i_byte < size_byte) |
| @@ -1544,7 +1524,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1544 | if (i_byte + 1 < size_byte | 1524 | if (i_byte + 1 < size_byte |
| 1545 | && str[i_byte] == '-') | 1525 | && str[i_byte] == '-') |
| 1546 | { | 1526 | { |
| 1547 | unsigned int c2; | 1527 | int c2; |
| 1548 | 1528 | ||
| 1549 | /* Skip over the dash. */ | 1529 | /* Skip over the dash. */ |
| 1550 | i_byte++; | 1530 | i_byte++; |
| @@ -1557,7 +1537,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1557 | 1537 | ||
| 1558 | if (c <= c2) | 1538 | if (c <= c2) |
| 1559 | { | 1539 | { |
| 1560 | unsigned lim2 = c2 + 1; | 1540 | int lim2 = c2 + 1; |
| 1561 | while (c < lim2) | 1541 | while (c < lim2) |
| 1562 | fastmap[c++] = 1; | 1542 | fastmap[c++] = 1; |
| 1563 | if (! ASCII_CHAR_P (c2)) | 1543 | if (! ASCII_CHAR_P (c2)) |
| @@ -1577,34 +1557,31 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1577 | the corresponding multibyte chars. */ | 1557 | the corresponding multibyte chars. */ |
| 1578 | if (multibyte && string_has_eight_bit) | 1558 | if (multibyte && string_has_eight_bit) |
| 1579 | { | 1559 | { |
| 1580 | unsigned char fastmap2[0400]; | 1560 | char *p1; |
| 1581 | int range_start_byte, range_start_char; | 1561 | char himap[0200 + 1]; |
| 1582 | 1562 | memcpy (himap, fastmap + 0200, 0200); | |
| 1583 | memcpy (fastmap + 0200, fastmap2 + 0200, 0200); | 1563 | himap[0200] = 0; |
| 1584 | memset (fastmap + 0200, 0, 0200); | 1564 | memset (fastmap + 0200, 0, 0200); |
| 1585 | /* We are sure that this loop stops. */ | ||
| 1586 | for (i = 0200; ! fastmap2[i]; i++); | ||
| 1587 | c = BYTE8_TO_CHAR (i); | ||
| 1588 | fastmap[CHAR_LEADING_CODE (c)] = 1; | ||
| 1589 | range_start_byte = i; | ||
| 1590 | range_start_char = c; | ||
| 1591 | char_ranges = alloca (sizeof *char_ranges * 128 * 2); | 1565 | char_ranges = alloca (sizeof *char_ranges * 128 * 2); |
| 1592 | for (i = 129; i < 0400; i++) | 1566 | i = 0; |
| 1567 | |||
| 1568 | while ((p1 = memchr (himap + i, 1, 0200 - i))) | ||
| 1593 | { | 1569 | { |
| 1594 | c = BYTE8_TO_CHAR (i); | 1570 | /* Deduce the next range C..C2 from the next clump of 1s |
| 1595 | fastmap[CHAR_LEADING_CODE (c)] = 1; | 1571 | in HIMAP starting with &HIMAP[I]. HIMAP is the high |
| 1596 | if (i - range_start_byte != c - range_start_char) | 1572 | order half of the old FASTMAP. */ |
| 1597 | { | 1573 | int c2, leading_code; |
| 1598 | char_ranges[n_char_ranges++] = range_start_char; | 1574 | i = p1 - himap; |
| 1599 | char_ranges[n_char_ranges++] = ((i - 1 - range_start_byte) | 1575 | c = BYTE8_TO_CHAR (i + 0200); |
| 1600 | + range_start_char); | 1576 | i += strlen (p1); |
| 1601 | range_start_byte = i; | 1577 | c2 = BYTE8_TO_CHAR (i + 0200 - 1); |
| 1602 | range_start_char = c; | 1578 | |
| 1603 | } | 1579 | char_ranges[n_char_ranges++] = c; |
| 1580 | char_ranges[n_char_ranges++] = c2; | ||
| 1581 | leading_code = CHAR_LEADING_CODE (c); | ||
| 1582 | memset (fastmap + leading_code, 1, | ||
| 1583 | CHAR_LEADING_CODE (c2) - leading_code + 1); | ||
| 1604 | } | 1584 | } |
| 1605 | char_ranges[n_char_ranges++] = range_start_char; | ||
| 1606 | char_ranges[n_char_ranges++] = ((i - 1 - range_start_byte) | ||
| 1607 | + range_start_char); | ||
| 1608 | } | 1585 | } |
| 1609 | } | 1586 | } |
| 1610 | else /* STRING is multibyte */ | 1587 | else /* STRING is multibyte */ |
| @@ -1613,9 +1590,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1613 | 1590 | ||
| 1614 | while (i_byte < size_byte) | 1591 | while (i_byte < size_byte) |
| 1615 | { | 1592 | { |
| 1616 | unsigned char leading_code; | 1593 | int leading_code = str[i_byte]; |
| 1617 | |||
| 1618 | leading_code = str[i_byte]; | ||
| 1619 | c = STRING_CHAR_AND_LENGTH (str + i_byte, len); | 1594 | c = STRING_CHAR_AND_LENGTH (str + i_byte, len); |
| 1620 | i_byte += len; | 1595 | i_byte += len; |
| 1621 | 1596 | ||
| @@ -1669,8 +1644,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1669 | if (i_byte + 1 < size_byte | 1644 | if (i_byte + 1 < size_byte |
| 1670 | && str[i_byte] == '-') | 1645 | && str[i_byte] == '-') |
| 1671 | { | 1646 | { |
| 1672 | unsigned int c2; | 1647 | int c2, leading_code2; |
| 1673 | unsigned char leading_code2; | ||
| 1674 | 1648 | ||
| 1675 | /* Skip over the dash. */ | 1649 | /* Skip over the dash. */ |
| 1676 | i_byte++; | 1650 | i_byte++; |
| @@ -1684,7 +1658,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1684 | && i_byte < size_byte) | 1658 | && i_byte < size_byte) |
| 1685 | { | 1659 | { |
| 1686 | leading_code2 = str[i_byte]; | 1660 | leading_code2 = str[i_byte]; |
| 1687 | c2 =STRING_CHAR_AND_LENGTH (str + i_byte, len); | 1661 | c2 = STRING_CHAR_AND_LENGTH (str + i_byte, len); |
| 1688 | i_byte += len; | 1662 | i_byte += len; |
| 1689 | } | 1663 | } |
| 1690 | 1664 | ||
| @@ -1698,7 +1672,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1698 | } | 1672 | } |
| 1699 | if (! ASCII_CHAR_P (c)) | 1673 | if (! ASCII_CHAR_P (c)) |
| 1700 | { | 1674 | { |
| 1701 | unsigned lim2 = leading_code2 + 1; | 1675 | int lim2 = leading_code2 + 1; |
| 1702 | while (leading_code < lim2) | 1676 | while (leading_code < lim2) |
| 1703 | fastmap[leading_code++] = 1; | 1677 | fastmap[leading_code++] = 1; |
| 1704 | if (c <= c2) | 1678 | if (c <= c2) |
| @@ -1731,7 +1705,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1731 | for (i = 0; i < n_char_ranges; i += 2) | 1705 | for (i = 0; i < n_char_ranges; i += 2) |
| 1732 | { | 1706 | { |
| 1733 | int c1 = char_ranges[i]; | 1707 | int c1 = char_ranges[i]; |
| 1734 | unsigned lim2 = char_ranges[i + 1] + 1; | 1708 | int lim2 = char_ranges[i + 1] + 1; |
| 1735 | 1709 | ||
| 1736 | for (; c1 < lim2; c1++) | 1710 | for (; c1 < lim2; c1++) |
| 1737 | { | 1711 | { |
| @@ -1927,13 +1901,13 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1927 | 1901 | ||
| 1928 | 1902 | ||
| 1929 | static Lisp_Object | 1903 | static Lisp_Object |
| 1930 | skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | 1904 | skip_syntaxes (bool forwardp, Lisp_Object string, Lisp_Object lim) |
| 1931 | { | 1905 | { |
| 1932 | register unsigned int c; | 1906 | int c; |
| 1933 | unsigned char fastmap[0400]; | 1907 | unsigned char fastmap[0400]; |
| 1934 | int negate = 0; | 1908 | bool negate = 0; |
| 1935 | register ptrdiff_t i, i_byte; | 1909 | ptrdiff_t i, i_byte; |
| 1936 | int multibyte; | 1910 | bool multibyte; |
| 1937 | ptrdiff_t size_byte; | 1911 | ptrdiff_t size_byte; |
| 1938 | unsigned char *str; | 1912 | unsigned char *str; |
| 1939 | 1913 | ||
| @@ -2021,7 +1995,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 2021 | stop = endp; | 1995 | stop = endp; |
| 2022 | } | 1996 | } |
| 2023 | c = STRING_CHAR_AND_LENGTH (p, nbytes); | 1997 | c = STRING_CHAR_AND_LENGTH (p, nbytes); |
| 2024 | if (! fastmap[(int) SYNTAX (c)]) | 1998 | if (! fastmap[SYNTAX (c)]) |
| 2025 | break; | 1999 | break; |
| 2026 | p += nbytes, pos++, pos_byte += nbytes; | 2000 | p += nbytes, pos++, pos_byte += nbytes; |
| 2027 | UPDATE_SYNTAX_TABLE_FORWARD (pos); | 2001 | UPDATE_SYNTAX_TABLE_FORWARD (pos); |
| @@ -2038,7 +2012,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 2038 | p = GAP_END_ADDR; | 2012 | p = GAP_END_ADDR; |
| 2039 | stop = endp; | 2013 | stop = endp; |
| 2040 | } | 2014 | } |
| 2041 | if (! fastmap[(int) SYNTAX (*p)]) | 2015 | if (! fastmap[SYNTAX (*p)]) |
| 2042 | break; | 2016 | break; |
| 2043 | p++, pos++, pos_byte++; | 2017 | p++, pos++, pos_byte++; |
| 2044 | UPDATE_SYNTAX_TABLE_FORWARD (pos); | 2018 | UPDATE_SYNTAX_TABLE_FORWARD (pos); |
| @@ -2064,7 +2038,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 2064 | prev_p = p; | 2038 | prev_p = p; |
| 2065 | while (--p >= stop && ! CHAR_HEAD_P (*p)); | 2039 | while (--p >= stop && ! CHAR_HEAD_P (*p)); |
| 2066 | c = STRING_CHAR (p); | 2040 | c = STRING_CHAR (p); |
| 2067 | if (! fastmap[(int) SYNTAX (c)]) | 2041 | if (! fastmap[SYNTAX (c)]) |
| 2068 | break; | 2042 | break; |
| 2069 | pos--, pos_byte -= prev_p - p; | 2043 | pos--, pos_byte -= prev_p - p; |
| 2070 | } | 2044 | } |
| @@ -2081,7 +2055,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 2081 | stop = endp; | 2055 | stop = endp; |
| 2082 | } | 2056 | } |
| 2083 | UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); | 2057 | UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); |
| 2084 | if (! fastmap[(int) SYNTAX (p[-1])]) | 2058 | if (! fastmap[SYNTAX (p[-1])]) |
| 2085 | break; | 2059 | break; |
| 2086 | p--, pos--, pos_byte--; | 2060 | p--, pos--, pos_byte--; |
| 2087 | } | 2061 | } |
| @@ -2095,14 +2069,14 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 2095 | } | 2069 | } |
| 2096 | } | 2070 | } |
| 2097 | 2071 | ||
| 2098 | /* Return 1 if character C belongs to one of the ISO classes | 2072 | /* Return true if character C belongs to one of the ISO classes |
| 2099 | in the list ISO_CLASSES. Each class is represented by an | 2073 | in the list ISO_CLASSES. Each class is represented by an |
| 2100 | integer which is its type according to re_wctype. */ | 2074 | integer which is its type according to re_wctype. */ |
| 2101 | 2075 | ||
| 2102 | static int | 2076 | static bool |
| 2103 | in_classes (int c, Lisp_Object iso_classes) | 2077 | in_classes (int c, Lisp_Object iso_classes) |
| 2104 | { | 2078 | { |
| 2105 | int fits_class = 0; | 2079 | bool fits_class = 0; |
| 2106 | 2080 | ||
| 2107 | while (CONSP (iso_classes)) | 2081 | while (CONSP (iso_classes)) |
| 2108 | { | 2082 | { |
| @@ -2122,26 +2096,26 @@ in_classes (int c, Lisp_Object iso_classes) | |||
| 2122 | FROM_BYTE is the bytepos corresponding to FROM. | 2096 | FROM_BYTE is the bytepos corresponding to FROM. |
| 2123 | Do not move past STOP (a charpos). | 2097 | Do not move past STOP (a charpos). |
| 2124 | The comment over which we have to jump is of style STYLE | 2098 | The comment over which we have to jump is of style STYLE |
| 2125 | (either SYNTAX_FLAGS_COMMENT_STYLE(foo) or ST_COMMENT_STYLE). | 2099 | (either SYNTAX_FLAGS_COMMENT_STYLE (foo) or ST_COMMENT_STYLE). |
| 2126 | NESTING should be positive to indicate the nesting at the beginning | 2100 | NESTING should be positive to indicate the nesting at the beginning |
| 2127 | for nested comments and should be zero or negative else. | 2101 | for nested comments and should be zero or negative else. |
| 2128 | ST_COMMENT_STYLE cannot be nested. | 2102 | ST_COMMENT_STYLE cannot be nested. |
| 2129 | PREV_SYNTAX is the SYNTAX_WITH_FLAGS of the previous character | 2103 | PREV_SYNTAX is the SYNTAX_WITH_FLAGS of the previous character |
| 2130 | (or 0 If the search cannot start in the middle of a two-character). | 2104 | (or 0 If the search cannot start in the middle of a two-character). |
| 2131 | 2105 | ||
| 2132 | If successful, return 1 and store the charpos of the comment's end | 2106 | If successful, return true and store the charpos of the comment's end |
| 2133 | into *CHARPOS_PTR and the corresponding bytepos into *BYTEPOS_PTR. | 2107 | into *CHARPOS_PTR and the corresponding bytepos into *BYTEPOS_PTR. |
| 2134 | Else, return 0 and store the charpos STOP into *CHARPOS_PTR, the | 2108 | Else, return false and store the charpos STOP into *CHARPOS_PTR, the |
| 2135 | corresponding bytepos into *BYTEPOS_PTR and the current nesting | 2109 | corresponding bytepos into *BYTEPOS_PTR and the current nesting |
| 2136 | (as defined for state.incomment) in *INCOMMENT_PTR. | 2110 | (as defined for state.incomment) in *INCOMMENT_PTR. |
| 2137 | 2111 | ||
| 2138 | The comment end is the last character of the comment rather than the | 2112 | The comment end is the last character of the comment rather than the |
| 2139 | character just after the comment. | 2113 | character just after the comment. |
| 2140 | 2114 | ||
| 2141 | Global syntax data is assumed to initially be valid for FROM and | 2115 | Global syntax data is assumed to initially be valid for FROM and |
| 2142 | remains valid for forward search starting at the returned position. */ | 2116 | remains valid for forward search starting at the returned position. */ |
| 2143 | 2117 | ||
| 2144 | static int | 2118 | static bool |
| 2145 | forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | 2119 | forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, |
| 2146 | EMACS_INT nesting, int style, int prev_syntax, | 2120 | EMACS_INT nesting, int style, int prev_syntax, |
| 2147 | ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr, | 2121 | ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr, |
| @@ -2247,14 +2221,12 @@ If COUNT comments are found as expected, with nothing except whitespace | |||
| 2247 | between them, return t; otherwise return nil. */) | 2221 | between them, return t; otherwise return nil. */) |
| 2248 | (Lisp_Object count) | 2222 | (Lisp_Object count) |
| 2249 | { | 2223 | { |
| 2250 | register ptrdiff_t from; | 2224 | ptrdiff_t from, from_byte, stop; |
| 2251 | ptrdiff_t from_byte; | 2225 | int c, c1; |
| 2252 | register ptrdiff_t stop; | 2226 | enum syntaxcode code; |
| 2253 | register int c, c1; | ||
| 2254 | register enum syntaxcode code; | ||
| 2255 | int comstyle = 0; /* style of comment encountered */ | 2227 | int comstyle = 0; /* style of comment encountered */ |
| 2256 | int comnested = 0; /* whether the comment is nestable or not */ | 2228 | bool comnested = 0; /* whether the comment is nestable or not */ |
| 2257 | int found; | 2229 | bool found; |
| 2258 | EMACS_INT count1; | 2230 | EMACS_INT count1; |
| 2259 | ptrdiff_t out_charpos, out_bytepos; | 2231 | ptrdiff_t out_charpos, out_bytepos; |
| 2260 | EMACS_INT dummy; | 2232 | EMACS_INT dummy; |
| @@ -2274,7 +2246,8 @@ between them, return t; otherwise return nil. */) | |||
| 2274 | { | 2246 | { |
| 2275 | do | 2247 | do |
| 2276 | { | 2248 | { |
| 2277 | int comstart_first, syntax, other_syntax; | 2249 | bool comstart_first; |
| 2250 | int syntax, other_syntax; | ||
| 2278 | 2251 | ||
| 2279 | if (from == stop) | 2252 | if (from == stop) |
| 2280 | { | 2253 | { |
| @@ -2302,8 +2275,7 @@ between them, return t; otherwise return nil. */) | |||
| 2302 | the comment section. */ | 2275 | the comment section. */ |
| 2303 | code = Scomment; | 2276 | code = Scomment; |
| 2304 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); | 2277 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2305 | comnested | 2278 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
| 2306 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | ||
| 2307 | INC_BOTH (from, from_byte); | 2279 | INC_BOTH (from, from_byte); |
| 2308 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2280 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2309 | } | 2281 | } |
| @@ -2339,7 +2311,8 @@ between them, return t; otherwise return nil. */) | |||
| 2339 | { | 2311 | { |
| 2340 | while (1) | 2312 | while (1) |
| 2341 | { | 2313 | { |
| 2342 | int quoted, syntax; | 2314 | bool quoted; |
| 2315 | int syntax; | ||
| 2343 | 2316 | ||
| 2344 | if (from <= stop) | 2317 | if (from <= stop) |
| 2345 | { | 2318 | { |
| @@ -2373,14 +2346,13 @@ between them, return t; otherwise return nil. */) | |||
| 2373 | c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2346 | c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2374 | other_syntax = SYNTAX_WITH_FLAGS (c1); | 2347 | other_syntax = SYNTAX_WITH_FLAGS (c1); |
| 2375 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); | 2348 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2376 | comnested | 2349 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
| 2377 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | ||
| 2378 | } | 2350 | } |
| 2379 | 2351 | ||
| 2380 | if (code == Scomment_fence) | 2352 | if (code == Scomment_fence) |
| 2381 | { | 2353 | { |
| 2382 | /* Skip until first preceding unquoted comment_fence. */ | 2354 | /* Skip until first preceding unquoted comment_fence. */ |
| 2383 | int fence_found = 0; | 2355 | bool fence_found = 0; |
| 2384 | ptrdiff_t ini = from, ini_byte = from_byte; | 2356 | ptrdiff_t ini = from, ini_byte = from_byte; |
| 2385 | 2357 | ||
| 2386 | while (1) | 2358 | while (1) |
| @@ -2411,7 +2383,7 @@ between them, return t; otherwise return nil. */) | |||
| 2411 | { | 2383 | { |
| 2412 | found = back_comment (from, from_byte, stop, comnested, comstyle, | 2384 | found = back_comment (from, from_byte, stop, comnested, comstyle, |
| 2413 | &out_charpos, &out_bytepos); | 2385 | &out_charpos, &out_bytepos); |
| 2414 | if (found == -1) | 2386 | if (!found) |
| 2415 | { | 2387 | { |
| 2416 | if (c == '\n') | 2388 | if (c == '\n') |
| 2417 | /* This end-of-line is not an end-of-comment. | 2389 | /* This end-of-line is not an end-of-comment. |
| @@ -2461,26 +2433,25 @@ between them, return t; otherwise return nil. */) | |||
| 2461 | ? SYNTAX (c) : Ssymbol) | 2433 | ? SYNTAX (c) : Ssymbol) |
| 2462 | 2434 | ||
| 2463 | static Lisp_Object | 2435 | static Lisp_Object |
| 2464 | scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag) | 2436 | scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) |
| 2465 | { | 2437 | { |
| 2466 | Lisp_Object val; | 2438 | Lisp_Object val; |
| 2467 | register ptrdiff_t stop = count > 0 ? ZV : BEGV; | 2439 | ptrdiff_t stop = count > 0 ? ZV : BEGV; |
| 2468 | register int c, c1; | 2440 | int c, c1; |
| 2469 | int stringterm; | 2441 | int stringterm; |
| 2470 | int quoted; | 2442 | bool quoted; |
| 2471 | int mathexit = 0; | 2443 | bool mathexit = 0; |
| 2472 | register enum syntaxcode code, temp_code; | 2444 | enum syntaxcode code, temp_code, c_code; |
| 2473 | EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */ | 2445 | EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */ |
| 2474 | int comstyle = 0; /* style of comment encountered */ | 2446 | int comstyle = 0; /* style of comment encountered */ |
| 2475 | int comnested = 0; /* whether the comment is nestable or not */ | 2447 | bool comnested = 0; /* whether the comment is nestable or not */ |
| 2476 | ptrdiff_t temp_pos; | 2448 | ptrdiff_t temp_pos; |
| 2477 | EMACS_INT last_good = from; | 2449 | EMACS_INT last_good = from; |
| 2478 | int found; | 2450 | bool found; |
| 2479 | ptrdiff_t from_byte; | 2451 | ptrdiff_t from_byte; |
| 2480 | ptrdiff_t out_bytepos, out_charpos; | 2452 | ptrdiff_t out_bytepos, out_charpos; |
| 2481 | int temp; | ||
| 2482 | EMACS_INT dummy; | 2453 | EMACS_INT dummy; |
| 2483 | int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; | 2454 | bool multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; |
| 2484 | 2455 | ||
| 2485 | if (depth > 0) min_depth = 0; | 2456 | if (depth > 0) min_depth = 0; |
| 2486 | 2457 | ||
| @@ -2497,7 +2468,8 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2497 | { | 2468 | { |
| 2498 | while (from < stop) | 2469 | while (from < stop) |
| 2499 | { | 2470 | { |
| 2500 | int comstart_first, prefix, syntax, other_syntax; | 2471 | bool comstart_first, prefix; |
| 2472 | int syntax, other_syntax; | ||
| 2501 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2473 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2502 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2474 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2503 | syntax = SYNTAX_WITH_FLAGS (c); | 2475 | syntax = SYNTAX_WITH_FLAGS (c); |
| @@ -2523,8 +2495,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2523 | the comment section */ | 2495 | the comment section */ |
| 2524 | code = Scomment; | 2496 | code = Scomment; |
| 2525 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); | 2497 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2526 | comnested | 2498 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
| 2527 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | ||
| 2528 | INC_BOTH (from, from_byte); | 2499 | INC_BOTH (from, from_byte); |
| 2529 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2500 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2530 | } | 2501 | } |
| @@ -2550,8 +2521,8 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2550 | 2521 | ||
| 2551 | /* Some compilers can't handle this inside the switch. */ | 2522 | /* Some compilers can't handle this inside the switch. */ |
| 2552 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2523 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2553 | temp = SYNTAX_WITH_MULTIBYTE_CHECK (c); | 2524 | c_code = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
| 2554 | switch (temp) | 2525 | switch (c_code) |
| 2555 | { | 2526 | { |
| 2556 | case Scharquote: | 2527 | case Scharquote: |
| 2557 | case Sescape: | 2528 | case Sescape: |
| @@ -2634,8 +2605,8 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2634 | break; | 2605 | break; |
| 2635 | 2606 | ||
| 2636 | /* Some compilers can't handle this inside the switch. */ | 2607 | /* Some compilers can't handle this inside the switch. */ |
| 2637 | temp = SYNTAX_WITH_MULTIBYTE_CHECK (c); | 2608 | c_code = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
| 2638 | switch (temp) | 2609 | switch (c_code) |
| 2639 | { | 2610 | { |
| 2640 | case Scharquote: | 2611 | case Scharquote: |
| 2641 | case Sescape: | 2612 | case Sescape: |
| @@ -2694,8 +2665,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2694 | c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2665 | c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2695 | other_syntax = SYNTAX_WITH_FLAGS (c2); | 2666 | other_syntax = SYNTAX_WITH_FLAGS (c2); |
| 2696 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); | 2667 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2697 | comnested | 2668 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
| 2698 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | ||
| 2699 | } | 2669 | } |
| 2700 | 2670 | ||
| 2701 | /* Quoting turns anything except a comment-ender | 2671 | /* Quoting turns anything except a comment-ender |
| @@ -2780,13 +2750,13 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2780 | break; | 2750 | break; |
| 2781 | found = back_comment (from, from_byte, stop, comnested, comstyle, | 2751 | found = back_comment (from, from_byte, stop, comnested, comstyle, |
| 2782 | &out_charpos, &out_bytepos); | 2752 | &out_charpos, &out_bytepos); |
| 2783 | /* FIXME: if found == -1, then it really wasn't a comment-end. | 2753 | /* FIXME: if !found, it really wasn't a comment-end. |
| 2784 | For single-char Sendcomment, we can't do much about it apart | 2754 | For single-char Sendcomment, we can't do much about it apart |
| 2785 | from skipping the char. | 2755 | from skipping the char. |
| 2786 | For 2-char endcomments, we could try again, taking both | 2756 | For 2-char endcomments, we could try again, taking both |
| 2787 | chars as separate entities, but it's a lot of trouble | 2757 | chars as separate entities, but it's a lot of trouble |
| 2788 | for very little gain, so we don't bother either. -sm */ | 2758 | for very little gain, so we don't bother either. -sm */ |
| 2789 | if (found != -1) | 2759 | if (found) |
| 2790 | from = out_charpos, from_byte = out_bytepos; | 2760 | from = out_charpos, from_byte = out_bytepos; |
| 2791 | break; | 2761 | break; |
| 2792 | 2762 | ||
| @@ -2941,7 +2911,7 @@ This includes chars with "quote" or "prefix" syntax (' or p). */) | |||
| 2941 | /* Parse forward from FROM / FROM_BYTE to END, | 2911 | /* Parse forward from FROM / FROM_BYTE to END, |
| 2942 | assuming that FROM has state OLDSTATE (nil means FROM is start of function), | 2912 | assuming that FROM has state OLDSTATE (nil means FROM is start of function), |
| 2943 | and return a description of the state of the parse at END. | 2913 | and return a description of the state of the parse at END. |
| 2944 | If STOPBEFORE is nonzero, stop at the start of an atom. | 2914 | If STOPBEFORE, stop at the start of an atom. |
| 2945 | If COMMENTSTOP is 1, stop at the start of a comment. | 2915 | If COMMENTSTOP is 1, stop at the start of a comment. |
| 2946 | If COMMENTSTOP is -1, stop at the start or end of a comment, | 2916 | If COMMENTSTOP is -1, stop at the start or end of a comment, |
| 2947 | after the beginning of a string, or after the end of a string. */ | 2917 | after the beginning of a string, or after the end of a string. */ |
| @@ -2949,30 +2919,29 @@ This includes chars with "quote" or "prefix" syntax (' or p). */) | |||
| 2949 | static void | 2919 | static void |
| 2950 | scan_sexps_forward (struct lisp_parse_state *stateptr, | 2920 | scan_sexps_forward (struct lisp_parse_state *stateptr, |
| 2951 | ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t end, | 2921 | ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t end, |
| 2952 | EMACS_INT targetdepth, int stopbefore, | 2922 | EMACS_INT targetdepth, bool stopbefore, |
| 2953 | Lisp_Object oldstate, int commentstop) | 2923 | Lisp_Object oldstate, int commentstop) |
| 2954 | { | 2924 | { |
| 2955 | struct lisp_parse_state state; | 2925 | struct lisp_parse_state state; |
| 2956 | 2926 | enum syntaxcode code; | |
| 2957 | register enum syntaxcode code; | ||
| 2958 | int c1; | 2927 | int c1; |
| 2959 | int comnested; | 2928 | bool comnested; |
| 2960 | struct level { ptrdiff_t last, prev; }; | 2929 | struct level { ptrdiff_t last, prev; }; |
| 2961 | struct level levelstart[100]; | 2930 | struct level levelstart[100]; |
| 2962 | register struct level *curlevel = levelstart; | 2931 | struct level *curlevel = levelstart; |
| 2963 | struct level *endlevel = levelstart + 100; | 2932 | struct level *endlevel = levelstart + 100; |
| 2964 | register EMACS_INT depth; /* Paren depth of current scanning location. | 2933 | EMACS_INT depth; /* Paren depth of current scanning location. |
| 2965 | level - levelstart equals this except | 2934 | level - levelstart equals this except |
| 2966 | when the depth becomes negative. */ | 2935 | when the depth becomes negative. */ |
| 2967 | EMACS_INT mindepth; /* Lowest DEPTH value seen. */ | 2936 | EMACS_INT mindepth; /* Lowest DEPTH value seen. */ |
| 2968 | int start_quoted = 0; /* Nonzero means starting after a char quote */ | 2937 | bool start_quoted = 0; /* True means starting after a char quote. */ |
| 2969 | Lisp_Object tem; | 2938 | Lisp_Object tem; |
| 2970 | ptrdiff_t prev_from; /* Keep one character before FROM. */ | 2939 | ptrdiff_t prev_from; /* Keep one character before FROM. */ |
| 2971 | ptrdiff_t prev_from_byte; | 2940 | ptrdiff_t prev_from_byte; |
| 2972 | int prev_from_syntax; | 2941 | int prev_from_syntax; |
| 2973 | int boundary_stop = commentstop == -1; | 2942 | bool boundary_stop = commentstop == -1; |
| 2974 | int nofence; | 2943 | bool nofence; |
| 2975 | int found; | 2944 | bool found; |
| 2976 | ptrdiff_t out_bytepos, out_charpos; | 2945 | ptrdiff_t out_bytepos, out_charpos; |
| 2977 | int temp; | 2946 | int temp; |
| 2978 | 2947 | ||
| @@ -3103,8 +3072,8 @@ do { prev_from = from; \ | |||
| 3103 | terminates the comment section. */ | 3072 | terminates the comment section. */ |
| 3104 | state.comstyle | 3073 | state.comstyle |
| 3105 | = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax); | 3074 | = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax); |
| 3106 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); | 3075 | comnested = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) |
| 3107 | comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (syntax); | 3076 | | SYNTAX_FLAGS_COMMENT_NESTED (syntax)); |
| 3108 | state.incomment = comnested ? 1 : -1; | 3077 | state.incomment = comnested ? 1 : -1; |
| 3109 | state.comstr_start = prev_from; | 3078 | state.comstr_start = prev_from; |
| 3110 | INC_FROM; | 3079 | INC_FROM; |
| @@ -3149,9 +3118,9 @@ do { prev_from = from; \ | |||
| 3149 | while (from < end) | 3118 | while (from < end) |
| 3150 | { | 3119 | { |
| 3151 | /* Some compilers can't handle this inside the switch. */ | 3120 | /* Some compilers can't handle this inside the switch. */ |
| 3152 | temp = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 3121 | int symchar = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 3153 | temp = SYNTAX (temp); | 3122 | enum syntaxcode symcharcode = SYNTAX (symchar); |
| 3154 | switch (temp) | 3123 | switch (symcharcode) |
| 3155 | { | 3124 | { |
| 3156 | case Scharquote: | 3125 | case Scharquote: |
| 3157 | case Sescape: | 3126 | case Sescape: |
| @@ -3233,19 +3202,20 @@ do { prev_from = from; \ | |||
| 3233 | while (1) | 3202 | while (1) |
| 3234 | { | 3203 | { |
| 3235 | int c; | 3204 | int c; |
| 3205 | enum syntaxcode c_code; | ||
| 3236 | 3206 | ||
| 3237 | if (from >= end) goto done; | 3207 | if (from >= end) goto done; |
| 3238 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 3208 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 3239 | /* Some compilers can't handle this inside the switch. */ | 3209 | /* Some compilers can't handle this inside the switch. */ |
| 3240 | temp = SYNTAX (c); | 3210 | c_code = SYNTAX (c); |
| 3241 | 3211 | ||
| 3242 | /* Check TEMP here so that if the char has | 3212 | /* Check C_CODE here so that if the char has |
| 3243 | a syntax-table property which says it is NOT | 3213 | a syntax-table property which says it is NOT |
| 3244 | a string character, it does not end the string. */ | 3214 | a string character, it does not end the string. */ |
| 3245 | if (nofence && c == state.instring && temp == Sstring) | 3215 | if (nofence && c == state.instring && c_code == Sstring) |
| 3246 | break; | 3216 | break; |
| 3247 | 3217 | ||
| 3248 | switch (temp) | 3218 | switch (c_code) |
| 3249 | { | 3219 | { |
| 3250 | case Sstring_fence: | 3220 | case Sstring_fence: |
| 3251 | if (!nofence) goto string_end; | 3221 | if (!nofence) goto string_end; |
| @@ -3401,25 +3371,25 @@ init_syntax_once (void) | |||
| 3401 | create syntax tables. */ | 3371 | create syntax tables. */ |
| 3402 | Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0)); | 3372 | Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0)); |
| 3403 | 3373 | ||
| 3404 | temp = AREF (Vsyntax_code_object, (int) Swhitespace); | 3374 | temp = AREF (Vsyntax_code_object, Swhitespace); |
| 3405 | 3375 | ||
| 3406 | Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); | 3376 | Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); |
| 3407 | 3377 | ||
| 3408 | /* Control characters should not be whitespace. */ | 3378 | /* Control characters should not be whitespace. */ |
| 3409 | temp = AREF (Vsyntax_code_object, (int) Spunct); | 3379 | temp = AREF (Vsyntax_code_object, Spunct); |
| 3410 | for (i = 0; i <= ' ' - 1; i++) | 3380 | for (i = 0; i <= ' ' - 1; i++) |
| 3411 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); | 3381 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
| 3412 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); | 3382 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); |
| 3413 | 3383 | ||
| 3414 | /* Except that a few really are whitespace. */ | 3384 | /* Except that a few really are whitespace. */ |
| 3415 | temp = AREF (Vsyntax_code_object, (int) Swhitespace); | 3385 | temp = AREF (Vsyntax_code_object, Swhitespace); |
| 3416 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); | 3386 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); |
| 3417 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); | 3387 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); |
| 3418 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); | 3388 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); |
| 3419 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); | 3389 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); |
| 3420 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); | 3390 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); |
| 3421 | 3391 | ||
| 3422 | temp = AREF (Vsyntax_code_object, (int) Sword); | 3392 | temp = AREF (Vsyntax_code_object, Sword); |
| 3423 | for (i = 'a'; i <= 'z'; i++) | 3393 | for (i = 'a'; i <= 'z'; i++) |
| 3424 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); | 3394 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
| 3425 | for (i = 'A'; i <= 'Z'; i++) | 3395 | for (i = 'A'; i <= 'Z'; i++) |
| @@ -3443,18 +3413,18 @@ init_syntax_once (void) | |||
| 3443 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '}', | 3413 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '}', |
| 3444 | Fcons (make_number (Sclose), make_number ('{'))); | 3414 | Fcons (make_number (Sclose), make_number ('{'))); |
| 3445 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '"', | 3415 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '"', |
| 3446 | Fcons (make_number ((int) Sstring), Qnil)); | 3416 | Fcons (make_number (Sstring), Qnil)); |
| 3447 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\', | 3417 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\', |
| 3448 | Fcons (make_number ((int) Sescape), Qnil)); | 3418 | Fcons (make_number (Sescape), Qnil)); |
| 3449 | 3419 | ||
| 3450 | temp = AREF (Vsyntax_code_object, (int) Ssymbol); | 3420 | temp = AREF (Vsyntax_code_object, Ssymbol); |
| 3451 | for (i = 0; i < 10; i++) | 3421 | for (i = 0; i < 10; i++) |
| 3452 | { | 3422 | { |
| 3453 | c = "_-+*/&|<>="[i]; | 3423 | c = "_-+*/&|<>="[i]; |
| 3454 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); | 3424 | SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); |
| 3455 | } | 3425 | } |
| 3456 | 3426 | ||
| 3457 | temp = AREF (Vsyntax_code_object, (int) Spunct); | 3427 | temp = AREF (Vsyntax_code_object, Spunct); |
| 3458 | for (i = 0; i < 12; i++) | 3428 | for (i = 0; i < 12; i++) |
| 3459 | { | 3429 | { |
| 3460 | c = ".,;:?!#@~^'`"[i]; | 3430 | c = ".,;:?!#@~^'`"[i]; |
| @@ -3462,7 +3432,7 @@ init_syntax_once (void) | |||
| 3462 | } | 3432 | } |
| 3463 | 3433 | ||
| 3464 | /* All multibyte characters have syntax `word' by default. */ | 3434 | /* All multibyte characters have syntax `word' by default. */ |
| 3465 | temp = AREF (Vsyntax_code_object, (int) Sword); | 3435 | temp = AREF (Vsyntax_code_object, Sword); |
| 3466 | char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); | 3436 | char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); |
| 3467 | } | 3437 | } |
| 3468 | 3438 | ||