aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c289
1 files changed, 151 insertions, 138 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 3e51099794b..d3cafcc472e 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1,5 +1,5 @@
1/* GNU Emacs routines to deal with syntax tables; also word and list parsing. 1/* GNU Emacs routines to deal with syntax tables; also word and list parsing.
2 Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2011 2 Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2012
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -20,13 +20,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22 22
23#include <ctype.h>
24#include <sys/types.h> 23#include <sys/types.h>
25#include <setjmp.h> 24
26#include "lisp.h" 25#include "lisp.h"
27#include "commands.h" 26#include "commands.h"
28#include "buffer.h"
29#include "character.h" 27#include "character.h"
28#include "buffer.h"
30#include "keymap.h" 29#include "keymap.h"
31#include "regex.h" 30#include "regex.h"
32 31
@@ -111,18 +110,18 @@ Lisp_Object syntax_temp;
111 110
112struct lisp_parse_state 111struct lisp_parse_state
113 { 112 {
114 int depth; /* Depth at end of parsing. */ 113 EMACS_INT depth; /* Depth at end of parsing. */
115 int instring; /* -1 if not within string, else desired terminator. */ 114 int instring; /* -1 if not within string, else desired terminator. */
116 int incomment; /* -1 if in unnestable comment else comment nesting */ 115 EMACS_INT incomment; /* -1 if in unnestable comment else comment nesting */
117 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. */
118 int quoted; /* Nonzero if just after an escape char at end of parsing */ 117 int quoted; /* Nonzero if just after an escape char at end of parsing */
119 int mindepth; /* Minimum depth seen while scanning. */ 118 EMACS_INT mindepth; /* Minimum depth seen while scanning. */
120 /* Char number of most recent start-of-expression at current level */ 119 /* Char number of most recent start-of-expression at current level */
121 EMACS_INT thislevelstart; 120 ptrdiff_t thislevelstart;
122 /* Char number of start of containing expression */ 121 /* Char number of start of containing expression */
123 EMACS_INT prevlevelstart; 122 ptrdiff_t prevlevelstart;
124 EMACS_INT location; /* Char number at which parsing stopped. */ 123 ptrdiff_t location; /* Char number at which parsing stopped. */
125 EMACS_INT comstr_start; /* Position of last comment/string starter. */ 124 ptrdiff_t comstr_start; /* Position of last comment/string starter. */
126 Lisp_Object levelstarts; /* Char numbers of starts-of-expression 125 Lisp_Object levelstarts; /* Char numbers of starts-of-expression
127 of levels (starting from outermost). */ 126 of levels (starting from outermost). */
128 }; 127 };
@@ -135,22 +134,28 @@ struct lisp_parse_state
135 find_start_begv is the BEGV value when it was found. 134 find_start_begv is the BEGV value when it was found.
136 find_start_modiff is the value of MODIFF when it was found. */ 135 find_start_modiff is the value of MODIFF when it was found. */
137 136
138static EMACS_INT find_start_pos; 137static ptrdiff_t find_start_pos;
139static EMACS_INT find_start_value; 138static ptrdiff_t find_start_value;
140static EMACS_INT find_start_value_byte; 139static ptrdiff_t find_start_value_byte;
141static struct buffer *find_start_buffer; 140static struct buffer *find_start_buffer;
142static EMACS_INT find_start_begv; 141static ptrdiff_t find_start_begv;
143static int find_start_modiff; 142static EMACS_INT find_start_modiff;
144 143
145 144
146static Lisp_Object Fsyntax_table_p (Lisp_Object);
147static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); 145static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int);
148static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); 146static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object);
149static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); 147static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int);
150static void scan_sexps_forward (struct lisp_parse_state *, 148static void scan_sexps_forward (struct lisp_parse_state *,
151 EMACS_INT, EMACS_INT, EMACS_INT, int, 149 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT,
152 int, Lisp_Object, int); 150 int, Lisp_Object, int);
153static int in_classes (int, Lisp_Object); 151static int in_classes (int, Lisp_Object);
152
153/* This setter is used only in this file, so it can be private. */
154static void
155bset_syntax_table (struct buffer *b, Lisp_Object val)
156{
157 b->INTERNAL_FIELD (syntax_table) = val;
158}
154 159
155/* Whether the syntax of the character C has the prefix flag set. */ 160/* Whether the syntax of the character C has the prefix flag set. */
156int syntax_prefix_flag_p (int c) 161int syntax_prefix_flag_p (int c)
@@ -172,12 +177,12 @@ struct gl_state_s gl_state; /* Global state of syntax parser. */
172 direction than the intervals - or in an interval. We update the 177 direction than the intervals - or in an interval. We update the
173 current syntax-table basing on the property of this interval, and 178 current syntax-table basing on the property of this interval, and
174 update the interval to start further than CHARPOS - or be 179 update the interval to start further than CHARPOS - or be
175 NULL_INTERVAL. We also update lim_property to be the next value of 180 NULL. We also update lim_property to be the next value of
176 charpos to call this subroutine again - or be before/after the 181 charpos to call this subroutine again - or be before/after the
177 start/end of OBJECT. */ 182 start/end of OBJECT. */
178 183
179void 184void
180update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init, 185update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init,
181 Lisp_Object object) 186 Lisp_Object object)
182{ 187{
183 Lisp_Object tmp_table; 188 Lisp_Object tmp_table;
@@ -193,7 +198,7 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
193 i = interval_of (charpos, object); 198 i = interval_of (charpos, object);
194 gl_state.backward_i = gl_state.forward_i = i; 199 gl_state.backward_i = gl_state.forward_i = i;
195 invalidate = 0; 200 invalidate = 0;
196 if (NULL_INTERVAL_P (i)) 201 if (!i)
197 return; 202 return;
198 /* interval_of updates only ->position of the return value, so 203 /* interval_of updates only ->position of the return value, so
199 update the parents manually to speed up update_interval. */ 204 update the parents manually to speed up update_interval. */
@@ -218,7 +223,7 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
218 223
219 /* We are guaranteed to be called with CHARPOS either in i, 224 /* We are guaranteed to be called with CHARPOS either in i,
220 or further off. */ 225 or further off. */
221 if (NULL_INTERVAL_P (i)) 226 if (!i)
222 error ("Error in syntax_table logic for to-the-end intervals"); 227 error ("Error in syntax_table logic for to-the-end intervals");
223 else if (charpos < i->position) /* Move left. */ 228 else if (charpos < i->position) /* Move left. */
224 { 229 {
@@ -288,7 +293,7 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
288 } 293 }
289 } 294 }
290 295
291 while (!NULL_INTERVAL_P (i)) 296 while (i)
292 { 297 {
293 if (cnt && !EQ (tmp_table, textget (i->plist, Qsyntax_table))) 298 if (cnt && !EQ (tmp_table, textget (i->plist, Qsyntax_table)))
294 { 299 {
@@ -314,7 +319,7 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
314 /* e_property at EOB is not set to ZV but to ZV+1, so that 319 /* e_property at EOB is not set to ZV but to ZV+1, so that
315 we can do INC(from);UPDATE_SYNTAX_TABLE_FORWARD without 320 we can do INC(from);UPDATE_SYNTAX_TABLE_FORWARD without
316 having to check eob between the two. */ 321 having to check eob between the two. */
317 + (NULL_INTERVAL_P (next_interval (i)) ? 1 : 0); 322 + (next_interval (i) ? 0 : 1);
318 gl_state.forward_i = i; 323 gl_state.forward_i = i;
319 } 324 }
320 else 325 else
@@ -327,7 +332,7 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
327 cnt++; 332 cnt++;
328 i = count > 0 ? next_interval (i) : previous_interval (i); 333 i = count > 0 ? next_interval (i) : previous_interval (i);
329 } 334 }
330 eassert (NULL_INTERVAL_P (i)); /* This property goes to the end. */ 335 eassert (i == NULL); /* This property goes to the end. */
331 if (count > 0) 336 if (count > 0)
332 gl_state.e_property = gl_state.stop; 337 gl_state.e_property = gl_state.stop;
333 else 338 else
@@ -339,12 +344,12 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
339 or after. On return global syntax data is good for lookup at CHARPOS. */ 344 or after. On return global syntax data is good for lookup at CHARPOS. */
340 345
341static int 346static int
342char_quoted (EMACS_INT charpos, EMACS_INT bytepos) 347char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos)
343{ 348{
344 register enum syntaxcode code; 349 register enum syntaxcode code;
345 register EMACS_INT beg = BEGV; 350 register ptrdiff_t beg = BEGV;
346 register int quoted = 0; 351 register int quoted = 0;
347 EMACS_INT orig = charpos; 352 ptrdiff_t orig = charpos;
348 353
349 while (charpos > beg) 354 while (charpos > beg)
350 { 355 {
@@ -367,8 +372,8 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
367/* Return the bytepos one character before BYTEPOS. 372/* Return the bytepos one character before BYTEPOS.
368 We assume that BYTEPOS is not at the start of the buffer. */ 373 We assume that BYTEPOS is not at the start of the buffer. */
369 374
370static inline EMACS_INT 375static ptrdiff_t
371dec_bytepos (EMACS_INT bytepos) 376dec_bytepos (ptrdiff_t bytepos)
372{ 377{
373 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) 378 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
374 return bytepos - 1; 379 return bytepos - 1;
@@ -391,10 +396,10 @@ dec_bytepos (EMACS_INT bytepos)
391 valid on return from the subroutine, so the caller should explicitly 396 valid on return from the subroutine, so the caller should explicitly
392 update the global data. */ 397 update the global data. */
393 398
394static EMACS_INT 399static ptrdiff_t
395find_defun_start (EMACS_INT pos, EMACS_INT pos_byte) 400find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
396{ 401{
397 EMACS_INT opoint = PT, opoint_byte = PT_BYTE; 402 ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;
398 403
399 if (!open_paren_in_column_0_is_defun_start) 404 if (!open_paren_in_column_0_is_defun_start)
400 { 405 {
@@ -461,7 +466,7 @@ find_defun_start (EMACS_INT pos, EMACS_INT pos_byte)
461/* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ 466/* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */
462 467
463static int 468static int
464prev_char_comend_first (EMACS_INT pos, EMACS_INT pos_byte) 469prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte)
465{ 470{
466 int c, val; 471 int c, val;
467 472
@@ -503,7 +508,7 @@ prev_char_comend_first (EMACS_INT pos, EMACS_INT pos_byte)
503 the returned value (or at FROM, if the search was not successful). */ 508 the returned value (or at FROM, if the search was not successful). */
504 509
505static int 510static int
506back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested, int comstyle, EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr) 511back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested, int comstyle, ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr)
507{ 512{
508 /* Look back, counting the parity of string-quotes, 513 /* Look back, counting the parity of string-quotes,
509 and recording the comment-starters seen. 514 and recording the comment-starters seen.
@@ -522,14 +527,14 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
522 inside another comment). 527 inside another comment).
523 Test case: { a (* b } c (* d *) */ 528 Test case: { a (* b } c (* d *) */
524 int comment_lossage = 0; 529 int comment_lossage = 0;
525 EMACS_INT comment_end = from; 530 ptrdiff_t comment_end = from;
526 EMACS_INT comment_end_byte = from_byte; 531 ptrdiff_t comment_end_byte = from_byte;
527 EMACS_INT comstart_pos = 0; 532 ptrdiff_t comstart_pos = 0;
528 EMACS_INT comstart_byte IF_LINT (= 0); 533 ptrdiff_t comstart_byte IF_LINT (= 0);
529 /* Place where the containing defun starts, 534 /* Place where the containing defun starts,
530 or 0 if we didn't come across it yet. */ 535 or 0 if we didn't come across it yet. */
531 EMACS_INT defun_start = 0; 536 ptrdiff_t defun_start = 0;
532 EMACS_INT defun_start_byte = 0; 537 ptrdiff_t defun_start_byte = 0;
533 register enum syntaxcode code; 538 register enum syntaxcode code;
534 int nesting = 1; /* current comment nesting */ 539 int nesting = 1; /* current comment nesting */
535 int c; 540 int c;
@@ -543,7 +548,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
543 that determines quote parity to the comment-end. */ 548 that determines quote parity to the comment-end. */
544 while (from != stop) 549 while (from != stop)
545 { 550 {
546 EMACS_INT temp_byte; 551 ptrdiff_t temp_byte;
547 int prev_syntax, com2start, com2end; 552 int prev_syntax, com2start, com2end;
548 int comstart; 553 int comstart;
549 554
@@ -581,7 +586,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
581 have %..\n and %{..}%. */ 586 have %..\n and %{..}%. */
582 if (from > stop && (com2end || comstart)) 587 if (from > stop && (com2end || comstart))
583 { 588 {
584 EMACS_INT next = from, next_byte = from_byte; 589 ptrdiff_t next = from, next_byte = from_byte;
585 int next_c, next_syntax; 590 int next_c, next_syntax;
586 DEC_BOTH (next, next_byte); 591 DEC_BOTH (next, next_byte);
587 UPDATE_SYNTAX_TABLE_BACKWARD (next); 592 UPDATE_SYNTAX_TABLE_BACKWARD (next);
@@ -737,7 +742,8 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
737 { 742 {
738 scan_sexps_forward (&state, 743 scan_sexps_forward (&state,
739 defun_start, defun_start_byte, 744 defun_start, defun_start_byte,
740 comment_end, -10000, 0, Qnil, 0); 745 comment_end, TYPE_MINIMUM (EMACS_INT),
746 0, Qnil, 0);
741 defun_start = comment_end; 747 defun_start = comment_end;
742 if (state.incomment == (comnested ? 1 : -1) 748 if (state.incomment == (comnested ? 1 : -1)
743 && state.comstyle == comstyle) 749 && state.comstyle == comstyle)
@@ -819,7 +825,7 @@ It is a copy of the TABLE, which defaults to the standard syntax table. */)
819 825
820 /* Only the standard syntax table should have a default element. 826 /* Only the standard syntax table should have a default element.
821 Other syntax tables should inherit from parents instead. */ 827 Other syntax tables should inherit from parents instead. */
822 XCHAR_TABLE (copy)->defalt = Qnil; 828 set_char_table_defalt (copy, Qnil);
823 829
824 /* Copied syntax tables should all have parents. 830 /* Copied syntax tables should all have parents.
825 If we copied one with no parent, such as the standard syntax table, 831 If we copied one with no parent, such as the standard syntax table,
@@ -836,7 +842,7 @@ One argument, a syntax table. */)
836{ 842{
837 int idx; 843 int idx;
838 check_syntax_table (table); 844 check_syntax_table (table);
839 BVAR (current_buffer, syntax_table) = table; 845 bset_syntax_table (current_buffer, table);
840 /* Indicate that this buffer now has a specified syntax table. */ 846 /* Indicate that this buffer now has a specified syntax table. */
841 idx = PER_BUFFER_VAR_IDX (syntax_table); 847 idx = PER_BUFFER_VAR_IDX (syntax_table);
842 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 848 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -915,11 +921,11 @@ DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
915} 921}
916 922
917DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0, 923DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0,
918 doc: /* Convert a syntax specification STRING into syntax cell form. 924 doc: /* Convert a syntax descriptor STRING into a raw syntax descriptor.
919STRING should be a string as it is allowed as argument of 925STRING should be a string of the form allowed as argument of
920`modify-syntax-entry'. Value is the equivalent cons cell 926`modify-syntax-entry'. The return value is a raw syntax descriptor: a
921\(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table' 927cons cell \(CODE . MATCHING-CHAR) which can be used, for example, as
922text property. */) 928the value of a `syntax-table' text property. */)
923 (Lisp_Object string) 929 (Lisp_Object string)
924{ 930{
925 register const unsigned char *p; 931 register const unsigned char *p;
@@ -987,7 +993,7 @@ text property. */)
987 } 993 }
988 994
989 if (val < ASIZE (Vsyntax_code_object) && NILP (match)) 995 if (val < ASIZE (Vsyntax_code_object) && NILP (match))
990 return XVECTOR (Vsyntax_code_object)->contents[val]; 996 return AREF (Vsyntax_code_object, val);
991 else 997 else
992 /* Since we can't use a shared object, let's make a new one. */ 998 /* Since we can't use a shared object, let's make a new one. */
993 return Fcons (make_number (val), match); 999 return Fcons (make_number (val), match);
@@ -1009,7 +1015,7 @@ The first character of NEWENTRY should be one of the following:
1009 " string quote. \\ escape. 1015 " string quote. \\ escape.
1010 $ paired delimiter. ' expression quote or prefix operator. 1016 $ paired delimiter. ' expression quote or prefix operator.
1011 < comment starter. > comment ender. 1017 < comment starter. > comment ender.
1012 / character-quote. @ inherit from `standard-syntax-table'. 1018 / character-quote. @ inherit from parent table.
1013 | generic string fence. ! generic comment fence. 1019 | generic string fence. ! generic comment fence.
1014 1020
1015Only single-character comment start and end sequences are represented thus. 1021Only single-character comment start and end sequences are represented thus.
@@ -1099,13 +1105,13 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1099 first = XCAR (value); 1105 first = XCAR (value);
1100 match_lisp = XCDR (value); 1106 match_lisp = XCDR (value);
1101 1107
1102 if (!INTEGERP (first) || !(NILP (match_lisp) || INTEGERP (match_lisp))) 1108 if (!INTEGERP (first) || !(NILP (match_lisp) || CHARACTERP (match_lisp)))
1103 { 1109 {
1104 insert_string ("invalid"); 1110 insert_string ("invalid");
1105 return syntax; 1111 return syntax;
1106 } 1112 }
1107 1113
1108 syntax_code = XINT (first); 1114 syntax_code = XINT (first) & INT_MAX;
1109 code = (enum syntaxcode) (syntax_code & 0377); 1115 code = (enum syntaxcode) (syntax_code & 0377);
1110 start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); 1116 start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code);
1111 start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; 1117 start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);;
@@ -1152,7 +1158,7 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1152 1158
1153 insert_string ("\twhich means: "); 1159 insert_string ("\twhich means: ");
1154 1160
1155 switch (SWITCH_ENUM_CAST (code)) 1161 switch (code)
1156 { 1162 {
1157 case Swhitespace: 1163 case Swhitespace:
1158 insert_string ("whitespace"); break; 1164 insert_string ("whitespace"); break;
@@ -1223,12 +1229,12 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1223 If that many words cannot be found before the end of the buffer, return 0. 1229 If that many words cannot be found before the end of the buffer, return 0.
1224 COUNT negative means scan backward and stop at word beginning. */ 1230 COUNT negative means scan backward and stop at word beginning. */
1225 1231
1226EMACS_INT 1232ptrdiff_t
1227scan_words (register EMACS_INT from, register EMACS_INT count) 1233scan_words (register ptrdiff_t from, register EMACS_INT count)
1228{ 1234{
1229 register EMACS_INT beg = BEGV; 1235 register ptrdiff_t beg = BEGV;
1230 register EMACS_INT end = ZV; 1236 register ptrdiff_t end = ZV;
1231 register EMACS_INT from_byte = CHAR_TO_BYTE (from); 1237 register ptrdiff_t from_byte = CHAR_TO_BYTE (from);
1232 register enum syntaxcode code; 1238 register enum syntaxcode code;
1233 int ch0, ch1; 1239 int ch0, ch1;
1234 Lisp_Object func, pos; 1240 Lisp_Object func, pos;
@@ -1263,7 +1269,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
1263 if (! NILP (Ffboundp (func))) 1269 if (! NILP (Ffboundp (func)))
1264 { 1270 {
1265 pos = call2 (func, make_number (from - 1), make_number (end)); 1271 pos = call2 (func, make_number (from - 1), make_number (end));
1266 if (INTEGERP (pos) && XINT (pos) > from) 1272 if (INTEGERP (pos) && from < XINT (pos) && XINT (pos) <= ZV)
1267 { 1273 {
1268 from = XINT (pos); 1274 from = XINT (pos);
1269 from_byte = CHAR_TO_BYTE (from); 1275 from_byte = CHAR_TO_BYTE (from);
@@ -1313,7 +1319,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
1313 if (! NILP (Ffboundp (func))) 1319 if (! NILP (Ffboundp (func)))
1314 { 1320 {
1315 pos = call2 (func, make_number (from), make_number (beg)); 1321 pos = call2 (func, make_number (from), make_number (beg));
1316 if (INTEGERP (pos) && XINT (pos) < from) 1322 if (INTEGERP (pos) && BEGV <= XINT (pos) && XINT (pos) < from)
1317 { 1323 {
1318 from = XINT (pos); 1324 from = XINT (pos);
1319 from_byte = CHAR_TO_BYTE (from); 1325 from_byte = CHAR_TO_BYTE (from);
@@ -1357,7 +1363,7 @@ and the function returns nil. Field boundaries are not noticed if
1357 (Lisp_Object arg) 1363 (Lisp_Object arg)
1358{ 1364{
1359 Lisp_Object tmp; 1365 Lisp_Object tmp;
1360 int orig_val, val; 1366 ptrdiff_t orig_val, val;
1361 1367
1362 if (NILP (arg)) 1368 if (NILP (arg))
1363 XSETFASTINT (arg, 1); 1369 XSETFASTINT (arg, 1);
@@ -1432,14 +1438,14 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1432 int *char_ranges IF_LINT (= NULL); 1438 int *char_ranges IF_LINT (= NULL);
1433 int n_char_ranges = 0; 1439 int n_char_ranges = 0;
1434 int negate = 0; 1440 int negate = 0;
1435 register EMACS_INT i, i_byte; 1441 register ptrdiff_t i, i_byte;
1436 /* Set to 1 if the current buffer is multibyte and the region 1442 /* Set to 1 if the current buffer is multibyte and the region
1437 contains non-ASCII chars. */ 1443 contains non-ASCII chars. */
1438 int multibyte; 1444 int multibyte;
1439 /* Set to 1 if STRING is multibyte and it contains non-ASCII 1445 /* Set to 1 if STRING is multibyte and it contains non-ASCII
1440 chars. */ 1446 chars. */
1441 int string_multibyte; 1447 int string_multibyte;
1442 EMACS_INT size_byte; 1448 ptrdiff_t size_byte;
1443 const unsigned char *str; 1449 const unsigned char *str;
1444 int len; 1450 int len;
1445 Lisp_Object iso_classes; 1451 Lisp_Object iso_classes;
@@ -1581,7 +1587,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1581 fastmap[CHAR_LEADING_CODE (c)] = 1; 1587 fastmap[CHAR_LEADING_CODE (c)] = 1;
1582 range_start_byte = i; 1588 range_start_byte = i;
1583 range_start_char = c; 1589 range_start_char = c;
1584 char_ranges = (int *) alloca (sizeof (int) * 128 * 2); 1590 char_ranges = alloca (sizeof *char_ranges * 128 * 2);
1585 for (i = 129; i < 0400; i++) 1591 for (i = 129; i < 0400; i++)
1586 { 1592 {
1587 c = BYTE8_TO_CHAR (i); 1593 c = BYTE8_TO_CHAR (i);
@@ -1602,7 +1608,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1602 } 1608 }
1603 else /* STRING is multibyte */ 1609 else /* STRING is multibyte */
1604 { 1610 {
1605 char_ranges = (int *) alloca (sizeof (int) * SCHARS (string) * 2); 1611 char_ranges = alloca (sizeof *char_ranges * SCHARS (string) * 2);
1606 1612
1607 while (i_byte < size_byte) 1613 while (i_byte < size_byte)
1608 { 1614 {
@@ -1753,9 +1759,9 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1753 } 1759 }
1754 1760
1755 { 1761 {
1756 EMACS_INT start_point = PT; 1762 ptrdiff_t start_point = PT;
1757 EMACS_INT pos = PT; 1763 ptrdiff_t pos = PT;
1758 EMACS_INT pos_byte = PT_BYTE; 1764 ptrdiff_t pos_byte = PT_BYTE;
1759 unsigned char *p = PT_ADDR, *endp, *stop; 1765 unsigned char *p = PT_ADDR, *endp, *stop;
1760 1766
1761 if (forwardp) 1767 if (forwardp)
@@ -1925,9 +1931,9 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
1925 register unsigned int c; 1931 register unsigned int c;
1926 unsigned char fastmap[0400]; 1932 unsigned char fastmap[0400];
1927 int negate = 0; 1933 int negate = 0;
1928 register EMACS_INT i, i_byte; 1934 register ptrdiff_t i, i_byte;
1929 int multibyte; 1935 int multibyte;
1930 EMACS_INT size_byte; 1936 ptrdiff_t size_byte;
1931 unsigned char *str; 1937 unsigned char *str;
1932 1938
1933 CHECK_STRING (string); 1939 CHECK_STRING (string);
@@ -1980,9 +1986,9 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
1980 fastmap[i] ^= 1; 1986 fastmap[i] ^= 1;
1981 1987
1982 { 1988 {
1983 EMACS_INT start_point = PT; 1989 ptrdiff_t start_point = PT;
1984 EMACS_INT pos = PT; 1990 ptrdiff_t pos = PT;
1985 EMACS_INT pos_byte = PT_BYTE; 1991 ptrdiff_t pos_byte = PT_BYTE;
1986 unsigned char *p = PT_ADDR, *endp, *stop; 1992 unsigned char *p = PT_ADDR, *endp, *stop;
1987 1993
1988 if (forwardp) 1994 if (forwardp)
@@ -2135,10 +2141,10 @@ in_classes (int c, Lisp_Object iso_classes)
2135 remains valid for forward search starting at the returned position. */ 2141 remains valid for forward search starting at the returned position. */
2136 2142
2137static int 2143static int
2138forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, 2144forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
2139 int nesting, int style, int prev_syntax, 2145 EMACS_INT nesting, int style, int prev_syntax,
2140 EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr, 2146 ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr,
2141 int *incomment_ptr) 2147 EMACS_INT *incomment_ptr)
2142{ 2148{
2143 register int c, c1; 2149 register int c, c1;
2144 register enum syntaxcode code; 2150 register enum syntaxcode code;
@@ -2240,17 +2246,17 @@ If COUNT comments are found as expected, with nothing except whitespace
2240between them, return t; otherwise return nil. */) 2246between them, return t; otherwise return nil. */)
2241 (Lisp_Object count) 2247 (Lisp_Object count)
2242{ 2248{
2243 register EMACS_INT from; 2249 register ptrdiff_t from;
2244 EMACS_INT from_byte; 2250 ptrdiff_t from_byte;
2245 register EMACS_INT stop; 2251 register ptrdiff_t stop;
2246 register int c, c1; 2252 register int c, c1;
2247 register enum syntaxcode code; 2253 register enum syntaxcode code;
2248 int comstyle = 0; /* style of comment encountered */ 2254 int comstyle = 0; /* style of comment encountered */
2249 int comnested = 0; /* whether the comment is nestable or not */ 2255 int comnested = 0; /* whether the comment is nestable or not */
2250 int found; 2256 int found;
2251 EMACS_INT count1; 2257 EMACS_INT count1;
2252 EMACS_INT out_charpos, out_bytepos; 2258 ptrdiff_t out_charpos, out_bytepos;
2253 int dummy; 2259 EMACS_INT dummy;
2254 2260
2255 CHECK_NUMBER (count); 2261 CHECK_NUMBER (count);
2256 count1 = XINT (count); 2262 count1 = XINT (count);
@@ -2374,7 +2380,7 @@ between them, return t; otherwise return nil. */)
2374 { 2380 {
2375 /* Skip until first preceding unquoted comment_fence. */ 2381 /* Skip until first preceding unquoted comment_fence. */
2376 int fence_found = 0; 2382 int fence_found = 0;
2377 EMACS_INT ini = from, ini_byte = from_byte; 2383 ptrdiff_t ini = from, ini_byte = from_byte;
2378 2384
2379 while (1) 2385 while (1)
2380 { 2386 {
@@ -2457,21 +2463,22 @@ static Lisp_Object
2457scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag) 2463scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag)
2458{ 2464{
2459 Lisp_Object val; 2465 Lisp_Object val;
2460 register EMACS_INT stop = count > 0 ? ZV : BEGV; 2466 register ptrdiff_t stop = count > 0 ? ZV : BEGV;
2461 register int c, c1; 2467 register int c, c1;
2462 int stringterm; 2468 int stringterm;
2463 int quoted; 2469 int quoted;
2464 int mathexit = 0; 2470 int mathexit = 0;
2465 register enum syntaxcode code, temp_code; 2471 register enum syntaxcode code, temp_code;
2466 int min_depth = depth; /* Err out if depth gets less than this. */ 2472 EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */
2467 int comstyle = 0; /* style of comment encountered */ 2473 int comstyle = 0; /* style of comment encountered */
2468 int comnested = 0; /* whether the comment is nestable or not */ 2474 int comnested = 0; /* whether the comment is nestable or not */
2469 EMACS_INT temp_pos; 2475 ptrdiff_t temp_pos;
2470 EMACS_INT last_good = from; 2476 EMACS_INT last_good = from;
2471 int found; 2477 int found;
2472 EMACS_INT from_byte; 2478 ptrdiff_t from_byte;
2473 EMACS_INT out_bytepos, out_charpos; 2479 ptrdiff_t out_bytepos, out_charpos;
2474 int temp, dummy; 2480 int temp;
2481 EMACS_INT dummy;
2475 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; 2482 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol;
2476 2483
2477 if (depth > 0) min_depth = 0; 2484 if (depth > 0) min_depth = 0;
@@ -2524,7 +2531,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2524 if (prefix) 2531 if (prefix)
2525 continue; 2532 continue;
2526 2533
2527 switch (SWITCH_ENUM_CAST (code)) 2534 switch (code)
2528 { 2535 {
2529 case Sescape: 2536 case Sescape:
2530 case Scharquote: 2537 case Scharquote:
@@ -2701,7 +2708,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2701 else if (SYNTAX_FLAGS_PREFIX (syntax)) 2708 else if (SYNTAX_FLAGS_PREFIX (syntax))
2702 continue; 2709 continue;
2703 2710
2704 switch (SWITCH_ENUM_CAST (code)) 2711 switch (code)
2705 { 2712 {
2706 case Sword: 2713 case Sword:
2707 case Ssymbol: 2714 case Ssymbol:
@@ -2844,18 +2851,23 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2844 2851
2845DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, 2852DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
2846 doc: /* Scan from character number FROM by COUNT lists. 2853 doc: /* Scan from character number FROM by COUNT lists.
2847Returns the character number of the position thus found. 2854Scan forward if COUNT is positive, backward if COUNT is negative.
2855Return the character number of the position thus found.
2856
2857A \"list", in this context, refers to a balanced parenthetical
2858grouping, as determined by the syntax table.
2848 2859
2849If DEPTH is nonzero, paren depth begins counting from that value, 2860If DEPTH is nonzero, treat that as the nesting depth of the starting
2850only places where the depth in parentheses becomes zero 2861point (i.e. the starting point is DEPTH parentheses deep). This
2851are candidates for stopping; COUNT such places are counted. 2862function scans over parentheses until the depth goes to zero COUNT
2852Thus, a positive value for DEPTH means go out levels. 2863times. Hence, positive DEPTH moves out that number of levels of
2864parentheses, while negative DEPTH moves to a deeper level.
2853 2865
2854Comments are ignored if `parse-sexp-ignore-comments' is non-nil. 2866Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
2855 2867
2856If the beginning or end of (the accessible part of) the buffer is reached 2868If we reach the beginning or end of the accessible part of the buffer
2857and the depth is wrong, an error is signaled. 2869before we have scanned over COUNT lists, return nil if the depth at
2858If the depth is right but the count is not used up, nil is returned. */) 2870that point is zero, and signal a error if the depth is nonzero. */)
2859 (Lisp_Object from, Lisp_Object count, Lisp_Object depth) 2871 (Lisp_Object from, Lisp_Object count, Lisp_Object depth)
2860{ 2872{
2861 CHECK_NUMBER (from); 2873 CHECK_NUMBER (from);
@@ -2890,11 +2902,11 @@ DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
2890This includes chars with "quote" or "prefix" syntax (' or p). */) 2902This includes chars with "quote" or "prefix" syntax (' or p). */)
2891 (void) 2903 (void)
2892{ 2904{
2893 EMACS_INT beg = BEGV; 2905 ptrdiff_t beg = BEGV;
2894 EMACS_INT opoint = PT; 2906 ptrdiff_t opoint = PT;
2895 EMACS_INT opoint_byte = PT_BYTE; 2907 ptrdiff_t opoint_byte = PT_BYTE;
2896 EMACS_INT pos = PT; 2908 ptrdiff_t pos = PT;
2897 EMACS_INT pos_byte = PT_BYTE; 2909 ptrdiff_t pos_byte = PT_BYTE;
2898 int c; 2910 int c;
2899 2911
2900 if (pos <= beg) 2912 if (pos <= beg)
@@ -2935,8 +2947,8 @@ This includes chars with "quote" or "prefix" syntax (' or p). */)
2935 2947
2936static void 2948static void
2937scan_sexps_forward (struct lisp_parse_state *stateptr, 2949scan_sexps_forward (struct lisp_parse_state *stateptr,
2938 EMACS_INT from, EMACS_INT from_byte, EMACS_INT end, 2950 ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t end,
2939 int targetdepth, int stopbefore, 2951 EMACS_INT targetdepth, int stopbefore,
2940 Lisp_Object oldstate, int commentstop) 2952 Lisp_Object oldstate, int commentstop)
2941{ 2953{
2942 struct lisp_parse_state state; 2954 struct lisp_parse_state state;
@@ -2944,23 +2956,23 @@ scan_sexps_forward (struct lisp_parse_state *stateptr,
2944 register enum syntaxcode code; 2956 register enum syntaxcode code;
2945 int c1; 2957 int c1;
2946 int comnested; 2958 int comnested;
2947 struct level { int last, prev; }; 2959 struct level { ptrdiff_t last, prev; };
2948 struct level levelstart[100]; 2960 struct level levelstart[100];
2949 register struct level *curlevel = levelstart; 2961 register struct level *curlevel = levelstart;
2950 struct level *endlevel = levelstart + 100; 2962 struct level *endlevel = levelstart + 100;
2951 register int depth; /* Paren depth of current scanning location. 2963 register EMACS_INT depth; /* Paren depth of current scanning location.
2952 level - levelstart equals this except 2964 level - levelstart equals this except
2953 when the depth becomes negative. */ 2965 when the depth becomes negative. */
2954 int mindepth; /* Lowest DEPTH value seen. */ 2966 EMACS_INT mindepth; /* Lowest DEPTH value seen. */
2955 int start_quoted = 0; /* Nonzero means starting after a char quote */ 2967 int start_quoted = 0; /* Nonzero means starting after a char quote */
2956 Lisp_Object tem; 2968 Lisp_Object tem;
2957 EMACS_INT prev_from; /* Keep one character before FROM. */ 2969 ptrdiff_t prev_from; /* Keep one character before FROM. */
2958 EMACS_INT prev_from_byte; 2970 ptrdiff_t prev_from_byte;
2959 int prev_from_syntax; 2971 int prev_from_syntax;
2960 int boundary_stop = commentstop == -1; 2972 int boundary_stop = commentstop == -1;
2961 int nofence; 2973 int nofence;
2962 int found; 2974 int found;
2963 EMACS_INT out_bytepos, out_charpos; 2975 ptrdiff_t out_bytepos, out_charpos;
2964 int temp; 2976 int temp;
2965 2977
2966 prev_from = from; 2978 prev_from = from;
@@ -3004,7 +3016,7 @@ do { prev_from = from; \
3004 tem = Fcar (oldstate); 3016 tem = Fcar (oldstate);
3005 /* Check whether we are inside string_fence-style string: */ 3017 /* Check whether we are inside string_fence-style string: */
3006 state.instring = (!NILP (tem) 3018 state.instring = (!NILP (tem)
3007 ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE) 3019 ? (CHARACTERP (tem) ? XFASTINT (tem) : ST_STRING_STYLE)
3008 : -1); 3020 : -1);
3009 3021
3010 oldstate = Fcdr (oldstate); 3022 oldstate = Fcdr (oldstate);
@@ -3024,19 +3036,21 @@ do { prev_from = from; \
3024 tem = Fcar (oldstate); 3036 tem = Fcar (oldstate);
3025 state.comstyle = (NILP (tem) 3037 state.comstyle = (NILP (tem)
3026 ? 0 3038 ? 0
3027 : (EQ (tem, Qsyntax_table) 3039 : (RANGED_INTEGERP (0, tem, ST_COMMENT_STYLE)
3028 ? ST_COMMENT_STYLE 3040 ? XINT (tem)
3029 : INTEGERP (tem) ? XINT (tem) : 1)); 3041 : ST_COMMENT_STYLE));
3030 3042
3031 oldstate = Fcdr (oldstate); 3043 oldstate = Fcdr (oldstate);
3032 tem = Fcar (oldstate); 3044 tem = Fcar (oldstate);
3033 state.comstr_start = NILP (tem) ? -1 : XINT (tem) ; 3045 state.comstr_start =
3046 RANGED_INTEGERP (PTRDIFF_MIN, tem, PTRDIFF_MAX) ? XINT (tem) : -1;
3034 oldstate = Fcdr (oldstate); 3047 oldstate = Fcdr (oldstate);
3035 tem = Fcar (oldstate); 3048 tem = Fcar (oldstate);
3036 while (!NILP (tem)) /* >= second enclosing sexps. */ 3049 while (!NILP (tem)) /* >= second enclosing sexps. */
3037 { 3050 {
3038 /* curlevel++->last ran into compiler bug on Apollo */ 3051 Lisp_Object temhd = Fcar (tem);
3039 curlevel->last = XINT (Fcar (tem)); 3052 if (RANGED_INTEGERP (PTRDIFF_MIN, temhd, PTRDIFF_MAX))
3053 curlevel->last = XINT (temhd);
3040 if (++curlevel == endlevel) 3054 if (++curlevel == endlevel)
3041 curlevel--; /* error ("Nesting too deep for parser"); */ 3055 curlevel--; /* error ("Nesting too deep for parser"); */
3042 curlevel->prev = -1; 3056 curlevel->prev = -1;
@@ -3115,7 +3129,7 @@ do { prev_from = from; \
3115 3129
3116 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) 3130 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax))
3117 continue; 3131 continue;
3118 switch (SWITCH_ENUM_CAST (code)) 3132 switch (code)
3119 { 3133 {
3120 case Sescape: 3134 case Sescape:
3121 case Scharquote: 3135 case Scharquote:
@@ -3309,14 +3323,14 @@ Fourth arg STOPBEFORE non-nil means stop when come to
3309 any character that starts a sexp. 3323 any character that starts a sexp.
3310Fifth arg OLDSTATE is a list like what this function returns. 3324Fifth arg OLDSTATE is a list like what this function returns.
3311 It is used to initialize the state of the parse. Elements number 1, 2, 6 3325 It is used to initialize the state of the parse. Elements number 1, 2, 6
3312 and 8 are ignored. 3326 are ignored.
3313Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. 3327Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3314 If it is symbol `syntax-table', stop after the start of a comment or a 3328 If it is symbol `syntax-table', stop after the start of a comment or a
3315 string, or after end of a comment or a string. */) 3329 string, or after end of a comment or a string. */)
3316 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) 3330 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop)
3317{ 3331{
3318 struct lisp_parse_state state; 3332 struct lisp_parse_state state;
3319 int target; 3333 EMACS_INT target;
3320 3334
3321 if (!NILP (targetdepth)) 3335 if (!NILP (targetdepth))
3322 { 3336 {
@@ -3324,7 +3338,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3324 target = XINT (targetdepth); 3338 target = XINT (targetdepth);
3325 } 3339 }
3326 else 3340 else
3327 target = -100000; /* We won't reach this depth */ 3341 target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth */
3328 3342
3329 validate_region (&from, &to); 3343 validate_region (&from, &to);
3330 scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)), 3344 scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)),
@@ -3377,32 +3391,31 @@ init_syntax_once (void)
3377 /* Create objects which can be shared among syntax tables. */ 3391 /* Create objects which can be shared among syntax tables. */
3378 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); 3392 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil);
3379 for (i = 0; i < ASIZE (Vsyntax_code_object); i++) 3393 for (i = 0; i < ASIZE (Vsyntax_code_object); i++)
3380 XVECTOR (Vsyntax_code_object)->contents[i] 3394 ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil));
3381 = Fcons (make_number (i), Qnil);
3382 3395
3383 /* Now we are ready to set up this property, so we can 3396 /* Now we are ready to set up this property, so we can
3384 create syntax tables. */ 3397 create syntax tables. */
3385 Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0)); 3398 Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0));
3386 3399
3387 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace]; 3400 temp = AREF (Vsyntax_code_object, (int) Swhitespace);
3388 3401
3389 Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); 3402 Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp);
3390 3403
3391 /* Control characters should not be whitespace. */ 3404 /* Control characters should not be whitespace. */
3392 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; 3405 temp = AREF (Vsyntax_code_object, (int) Spunct);
3393 for (i = 0; i <= ' ' - 1; i++) 3406 for (i = 0; i <= ' ' - 1; i++)
3394 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); 3407 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
3395 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); 3408 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp);
3396 3409
3397 /* Except that a few really are whitespace. */ 3410 /* Except that a few really are whitespace. */
3398 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace]; 3411 temp = AREF (Vsyntax_code_object, (int) Swhitespace);
3399 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); 3412 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp);
3400 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); 3413 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp);
3401 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); 3414 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp);
3402 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); 3415 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp);
3403 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); 3416 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp);
3404 3417
3405 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; 3418 temp = AREF (Vsyntax_code_object, (int) Sword);
3406 for (i = 'a'; i <= 'z'; i++) 3419 for (i = 'a'; i <= 'z'; i++)
3407 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); 3420 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
3408 for (i = 'A'; i <= 'Z'; i++) 3421 for (i = 'A'; i <= 'Z'; i++)
@@ -3430,14 +3443,14 @@ init_syntax_once (void)
3430 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\', 3443 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\',
3431 Fcons (make_number ((int) Sescape), Qnil)); 3444 Fcons (make_number ((int) Sescape), Qnil));
3432 3445
3433 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Ssymbol]; 3446 temp = AREF (Vsyntax_code_object, (int) Ssymbol);
3434 for (i = 0; i < 10; i++) 3447 for (i = 0; i < 10; i++)
3435 { 3448 {
3436 c = "_-+*/&|<>="[i]; 3449 c = "_-+*/&|<>="[i];
3437 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); 3450 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp);
3438 } 3451 }
3439 3452
3440 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; 3453 temp = AREF (Vsyntax_code_object, (int) Spunct);
3441 for (i = 0; i < 12; i++) 3454 for (i = 0; i < 12; i++)
3442 { 3455 {
3443 c = ".,;:?!#@~^'`"[i]; 3456 c = ".,;:?!#@~^'`"[i];
@@ -3445,7 +3458,7 @@ init_syntax_once (void)
3445 } 3458 }
3446 3459
3447 /* All multibyte characters have syntax `word' by default. */ 3460 /* All multibyte characters have syntax `word' by default. */
3448 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; 3461 temp = AREF (Vsyntax_code_object, (int) Sword);
3449 char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); 3462 char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp);
3450} 3463}
3451 3464
@@ -3466,9 +3479,9 @@ syms_of_syntax (void)
3466 3479
3467 DEFSYM (Qscan_error, "scan-error"); 3480 DEFSYM (Qscan_error, "scan-error");
3468 Fput (Qscan_error, Qerror_conditions, 3481 Fput (Qscan_error, Qerror_conditions,
3469 pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); 3482 listn (CONSTYPE_PURE, 2, Qscan_error, Qerror));
3470 Fput (Qscan_error, Qerror_message, 3483 Fput (Qscan_error, Qerror_message,
3471 make_pure_c_string ("Scan error")); 3484 build_pure_c_string ("Scan error"));
3472 3485
3473 DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments, 3486 DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments,
3474 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); 3487 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */);
@@ -3489,7 +3502,7 @@ See the info node `(elisp)Syntax Properties' for a description of the
3489 3502
3490 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start", 3503 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start",
3491 open_paren_in_column_0_is_defun_start, 3504 open_paren_in_column_0_is_defun_start,
3492 doc: /* *Non-nil means an open paren in column 0 denotes the start of a defun. */); 3505 doc: /* Non-nil means an open paren in column 0 denotes the start of a defun. */);
3493 open_paren_in_column_0_is_defun_start = 1; 3506 open_paren_in_column_0_is_defun_start = 1;
3494 3507
3495 3508