diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex-emacs.c | 43 | ||||
| -rw-r--r-- | src/syntax.c | 50 | ||||
| -rw-r--r-- | src/syntax.h | 24 |
3 files changed, 44 insertions, 73 deletions
diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 2571812cb39..746779490ad 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c | |||
| @@ -47,13 +47,6 @@ | |||
| 47 | /* Make syntax table lookup grant data in gl_state. */ | 47 | /* Make syntax table lookup grant data in gl_state. */ |
| 48 | #define SYNTAX(c) syntax_property (c, 1) | 48 | #define SYNTAX(c) syntax_property (c, 1) |
| 49 | 49 | ||
| 50 | /* Convert the pointer to the char to BEG-based offset from the start. */ | ||
| 51 | #define PTR_TO_OFFSET(d) POS_AS_IN_BUFFER (POINTER_TO_OFFSET (d)) | ||
| 52 | /* Strings are 0-indexed, buffers are 1-indexed; pun on the boolean | ||
| 53 | result to get the right base index. */ | ||
| 54 | #define POS_AS_IN_BUFFER(p) \ | ||
| 55 | ((p) + (NILP (gl_state.object) || BUFFERP (gl_state.object))) | ||
| 56 | |||
| 57 | #define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte) | 50 | #define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte) |
| 58 | #define RE_TARGET_MULTIBYTE_P(bufp) ((bufp)->target_multibyte) | 51 | #define RE_TARGET_MULTIBYTE_P(bufp) ((bufp)->target_multibyte) |
| 59 | #define RE_STRING_CHAR(p, multibyte) \ | 52 | #define RE_STRING_CHAR(p, multibyte) \ |
| @@ -3258,12 +3251,7 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, ptrdiff_t size1, | |||
| 3258 | /* See whether the pattern is anchored. */ | 3251 | /* See whether the pattern is anchored. */ |
| 3259 | anchored_start = (bufp->buffer[0] == begline); | 3252 | anchored_start = (bufp->buffer[0] == begline); |
| 3260 | 3253 | ||
| 3261 | gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ | 3254 | RE_SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, startpos); |
| 3262 | { | ||
| 3263 | ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos)); | ||
| 3264 | |||
| 3265 | SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); | ||
| 3266 | } | ||
| 3267 | 3255 | ||
| 3268 | /* Loop through the string, looking for a place to start matching. */ | 3256 | /* Loop through the string, looking for a place to start matching. */ |
| 3269 | for (;;) | 3257 | for (;;) |
| @@ -3871,10 +3859,7 @@ re_match_2 (struct re_pattern_buffer *bufp, | |||
| 3871 | { | 3859 | { |
| 3872 | ptrdiff_t result; | 3860 | ptrdiff_t result; |
| 3873 | 3861 | ||
| 3874 | ptrdiff_t charpos; | 3862 | RE_SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, pos); |
| 3875 | gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ | ||
| 3876 | charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos)); | ||
| 3877 | SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); | ||
| 3878 | 3863 | ||
| 3879 | result = re_match_2_internal (bufp, (re_char *) string1, size1, | 3864 | result = re_match_2_internal (bufp, (re_char *) string1, size1, |
| 3880 | (re_char *) string2, size2, | 3865 | (re_char *) string2, size2, |
| @@ -4806,8 +4791,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, | |||
| 4806 | int c1, c2; | 4791 | int c1, c2; |
| 4807 | int s1, s2; | 4792 | int s1, s2; |
| 4808 | int dummy; | 4793 | int dummy; |
| 4809 | ptrdiff_t offset = PTR_TO_OFFSET (d); | 4794 | ptrdiff_t offset = POINTER_TO_OFFSET (d); |
| 4810 | ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1; | 4795 | ptrdiff_t charpos = RE_SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1; |
| 4811 | UPDATE_SYNTAX_TABLE (charpos); | 4796 | UPDATE_SYNTAX_TABLE (charpos); |
| 4812 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 4797 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| 4813 | nchars++; | 4798 | nchars++; |
| @@ -4846,8 +4831,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, | |||
| 4846 | int c1, c2; | 4831 | int c1, c2; |
| 4847 | int s1, s2; | 4832 | int s1, s2; |
| 4848 | int dummy; | 4833 | int dummy; |
| 4849 | ptrdiff_t offset = PTR_TO_OFFSET (d); | 4834 | ptrdiff_t offset = POINTER_TO_OFFSET (d); |
| 4850 | ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 4835 | ptrdiff_t charpos = RE_SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 4851 | UPDATE_SYNTAX_TABLE (charpos); | 4836 | UPDATE_SYNTAX_TABLE (charpos); |
| 4852 | PREFETCH (); | 4837 | PREFETCH (); |
| 4853 | GET_CHAR_AFTER (c2, d, dummy); | 4838 | GET_CHAR_AFTER (c2, d, dummy); |
| @@ -4889,8 +4874,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, | |||
| 4889 | int c1, c2; | 4874 | int c1, c2; |
| 4890 | int s1, s2; | 4875 | int s1, s2; |
| 4891 | int dummy; | 4876 | int dummy; |
| 4892 | ptrdiff_t offset = PTR_TO_OFFSET (d); | 4877 | ptrdiff_t offset = POINTER_TO_OFFSET (d); |
| 4893 | ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1; | 4878 | ptrdiff_t charpos = RE_SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1; |
| 4894 | UPDATE_SYNTAX_TABLE (charpos); | 4879 | UPDATE_SYNTAX_TABLE (charpos); |
| 4895 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 4880 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| 4896 | nchars++; | 4881 | nchars++; |
| @@ -4931,8 +4916,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, | |||
| 4931 | is the character at D, and S2 is the syntax of C2. */ | 4916 | is the character at D, and S2 is the syntax of C2. */ |
| 4932 | int c1, c2; | 4917 | int c1, c2; |
| 4933 | int s1, s2; | 4918 | int s1, s2; |
| 4934 | ptrdiff_t offset = PTR_TO_OFFSET (d); | 4919 | ptrdiff_t offset = POINTER_TO_OFFSET (d); |
| 4935 | ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 4920 | ptrdiff_t charpos = RE_SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 4936 | UPDATE_SYNTAX_TABLE (charpos); | 4921 | UPDATE_SYNTAX_TABLE (charpos); |
| 4937 | PREFETCH (); | 4922 | PREFETCH (); |
| 4938 | c2 = RE_STRING_CHAR (d, target_multibyte); | 4923 | c2 = RE_STRING_CHAR (d, target_multibyte); |
| @@ -4972,8 +4957,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, | |||
| 4972 | is the character at D, and S2 is the syntax of C2. */ | 4957 | is the character at D, and S2 is the syntax of C2. */ |
| 4973 | int c1, c2; | 4958 | int c1, c2; |
| 4974 | int s1, s2; | 4959 | int s1, s2; |
| 4975 | ptrdiff_t offset = PTR_TO_OFFSET (d); | 4960 | ptrdiff_t offset = POINTER_TO_OFFSET (d); |
| 4976 | ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1; | 4961 | ptrdiff_t charpos = RE_SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1; |
| 4977 | UPDATE_SYNTAX_TABLE (charpos); | 4962 | UPDATE_SYNTAX_TABLE (charpos); |
| 4978 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 4963 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| 4979 | nchars++; | 4964 | nchars++; |
| @@ -5008,8 +4993,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, | |||
| 5008 | mcnt); | 4993 | mcnt); |
| 5009 | PREFETCH (); | 4994 | PREFETCH (); |
| 5010 | { | 4995 | { |
| 5011 | ptrdiff_t offset = PTR_TO_OFFSET (d); | 4996 | ptrdiff_t offset = POINTER_TO_OFFSET (d); |
| 5012 | ptrdiff_t pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 4997 | ptrdiff_t pos1 = RE_SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 5013 | UPDATE_SYNTAX_TABLE (pos1); | 4998 | UPDATE_SYNTAX_TABLE (pos1); |
| 5014 | } | 4999 | } |
| 5015 | { | 5000 | { |
diff --git a/src/syntax.c b/src/syntax.c index 79e16f652f3..e9e04e2d638 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -250,7 +250,6 @@ SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count) | |||
| 250 | gl_state.b_property = BEGV; | 250 | gl_state.b_property = BEGV; |
| 251 | gl_state.e_property = ZV + 1; | 251 | gl_state.e_property = ZV + 1; |
| 252 | gl_state.object = Qnil; | 252 | gl_state.object = Qnil; |
| 253 | gl_state.offset = 0; | ||
| 254 | if (parse_sexp_lookup_properties) | 253 | if (parse_sexp_lookup_properties) |
| 255 | { | 254 | { |
| 256 | if (count > 0) | 255 | if (count > 0) |
| @@ -266,46 +265,38 @@ SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count) | |||
| 266 | /* Same as above, but in OBJECT. If OBJECT is nil, use current buffer. | 265 | /* Same as above, but in OBJECT. If OBJECT is nil, use current buffer. |
| 267 | If it is t (which is only used in fast_c_string_match_ignore_case), | 266 | If it is t (which is only used in fast_c_string_match_ignore_case), |
| 268 | ignore properties altogether. | 267 | ignore properties altogether. |
| 269 | 268 | FROMBYTE is an regexp-byteoffset. */ | |
| 270 | This is meant for regex-emacs.c to use. For buffers, regex-emacs.c | ||
| 271 | passes arguments to the UPDATE_SYNTAX_TABLE functions which are | ||
| 272 | relative to BEGV. So if it is a buffer, we set the offset field to | ||
| 273 | BEGV. */ | ||
| 274 | 269 | ||
| 275 | void | 270 | void |
| 276 | SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, | 271 | RE_SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, |
| 277 | ptrdiff_t from, ptrdiff_t count) | 272 | ptrdiff_t frombyte) |
| 278 | { | 273 | { |
| 279 | SETUP_BUFFER_SYNTAX_TABLE (); | 274 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 280 | gl_state.object = object; | 275 | gl_state.object = object; |
| 281 | if (BUFFERP (gl_state.object)) | 276 | if (BUFFERP (gl_state.object)) |
| 282 | { | 277 | { |
| 283 | struct buffer *buf = XBUFFER (gl_state.object); | 278 | struct buffer *buf = XBUFFER (gl_state.object); |
| 284 | gl_state.b_property = 1; | 279 | gl_state.b_property = BEG; |
| 285 | gl_state.e_property = BUF_ZV (buf) - BUF_BEGV (buf) + 1; | 280 | gl_state.e_property = BUF_ZV (buf); |
| 286 | gl_state.offset = BUF_BEGV (buf) - 1; | ||
| 287 | } | 281 | } |
| 288 | else if (NILP (gl_state.object)) | 282 | else if (NILP (gl_state.object)) |
| 289 | { | 283 | { |
| 290 | gl_state.b_property = 1; | 284 | gl_state.b_property = BEG; |
| 291 | gl_state.e_property = ZV - BEGV + 1; | 285 | gl_state.e_property = ZV; /* FIXME: Why not +1 like in SETUP_SYNTAX_TABLE? */ |
| 292 | gl_state.offset = BEGV - 1; | ||
| 293 | } | 286 | } |
| 294 | else if (EQ (gl_state.object, Qt)) | 287 | else if (EQ (gl_state.object, Qt)) |
| 295 | { | 288 | { |
| 296 | gl_state.b_property = 0; | 289 | gl_state.b_property = 0; |
| 297 | gl_state.e_property = PTRDIFF_MAX; | 290 | gl_state.e_property = PTRDIFF_MAX; |
| 298 | gl_state.offset = 0; | ||
| 299 | } | 291 | } |
| 300 | else | 292 | else |
| 301 | { | 293 | { |
| 302 | gl_state.b_property = 0; | 294 | gl_state.b_property = 0; |
| 303 | gl_state.e_property = 1 + SCHARS (gl_state.object); | 295 | gl_state.e_property = 1 + SCHARS (gl_state.object); |
| 304 | gl_state.offset = 0; | ||
| 305 | } | 296 | } |
| 306 | if (parse_sexp_lookup_properties) | 297 | if (parse_sexp_lookup_properties) |
| 307 | update_syntax_table (from + gl_state.offset - (count <= 0), | 298 | update_syntax_table (RE_SYNTAX_TABLE_BYTE_TO_CHAR (frombyte), |
| 308 | count, 1, gl_state.object); | 299 | 1, 1, gl_state.object); |
| 309 | } | 300 | } |
| 310 | 301 | ||
| 311 | /* Update gl_state to an appropriate interval which contains CHARPOS. The | 302 | /* Update gl_state to an appropriate interval which contains CHARPOS. The |
| @@ -341,8 +332,8 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 341 | if (!i) | 332 | if (!i) |
| 342 | return; | 333 | return; |
| 343 | i = gl_state.forward_i; | 334 | i = gl_state.forward_i; |
| 344 | gl_state.b_property = i->position - gl_state.offset; | 335 | gl_state.b_property = i->position; |
| 345 | gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; | 336 | gl_state.e_property = INTERVAL_LAST_POS (i); |
| 346 | } | 337 | } |
| 347 | else | 338 | else |
| 348 | { | 339 | { |
| @@ -362,7 +353,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 362 | { | 353 | { |
| 363 | invalidate = false; | 354 | invalidate = false; |
| 364 | gl_state.forward_i = i; | 355 | gl_state.forward_i = i; |
| 365 | gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; | 356 | gl_state.e_property = INTERVAL_LAST_POS (i); |
| 366 | } | 357 | } |
| 367 | } | 358 | } |
| 368 | else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right. */ | 359 | else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right. */ |
| @@ -375,7 +366,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 375 | { | 366 | { |
| 376 | invalidate = false; | 367 | invalidate = false; |
| 377 | gl_state.backward_i = i; | 368 | gl_state.backward_i = i; |
| 378 | gl_state.b_property = i->position - gl_state.offset; | 369 | gl_state.b_property = i->position; |
| 379 | } | 370 | } |
| 380 | } | 371 | } |
| 381 | } | 372 | } |
| @@ -391,12 +382,12 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 391 | if (count > 0) | 382 | if (count > 0) |
| 392 | { | 383 | { |
| 393 | gl_state.backward_i = i; | 384 | gl_state.backward_i = i; |
| 394 | gl_state.b_property = i->position - gl_state.offset; | 385 | gl_state.b_property = i->position; |
| 395 | } | 386 | } |
| 396 | else | 387 | else |
| 397 | { | 388 | { |
| 398 | gl_state.forward_i = i; | 389 | gl_state.forward_i = i; |
| 399 | gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; | 390 | gl_state.e_property = INTERVAL_LAST_POS (i); |
| 400 | } | 391 | } |
| 401 | } | 392 | } |
| 402 | 393 | ||
| @@ -426,13 +417,13 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 426 | { | 417 | { |
| 427 | if (count > 0) | 418 | if (count > 0) |
| 428 | { | 419 | { |
| 429 | gl_state.e_property = i->position - gl_state.offset; | 420 | gl_state.e_property = i->position; |
| 430 | gl_state.forward_i = i; | 421 | gl_state.forward_i = i; |
| 431 | } | 422 | } |
| 432 | else | 423 | else |
| 433 | { | 424 | { |
| 434 | gl_state.b_property | 425 | gl_state.b_property |
| 435 | = i->position + LENGTH (i) - gl_state.offset; | 426 | = i->position + LENGTH (i); |
| 436 | gl_state.backward_i = i; | 427 | gl_state.backward_i = i; |
| 437 | } | 428 | } |
| 438 | return; | 429 | return; |
| @@ -442,7 +433,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 442 | if (count > 0) | 433 | if (count > 0) |
| 443 | { | 434 | { |
| 444 | gl_state.e_property | 435 | gl_state.e_property |
| 445 | = i->position + LENGTH (i) - gl_state.offset | 436 | = i->position + LENGTH (i) |
| 446 | /* e_property at EOB is not set to ZV but to ZV+1, so that | 437 | /* e_property at EOB is not set to ZV but to ZV+1, so that |
| 447 | we can do INC(from);UPDATE_SYNTAX_TABLE_FORWARD without | 438 | we can do INC(from);UPDATE_SYNTAX_TABLE_FORWARD without |
| 448 | having to check eob between the two. */ | 439 | having to check eob between the two. */ |
| @@ -451,7 +442,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 451 | } | 442 | } |
| 452 | else | 443 | else |
| 453 | { | 444 | { |
| 454 | gl_state.b_property = i->position - gl_state.offset; | 445 | gl_state.b_property = i->position; |
| 455 | gl_state.backward_i = i; | 446 | gl_state.backward_i = i; |
| 456 | } | 447 | } |
| 457 | return; | 448 | return; |
| @@ -2201,8 +2192,7 @@ skip_syntaxes (bool forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 2201 | while (!parse_sexp_lookup_properties | 2192 | while (!parse_sexp_lookup_properties |
| 2202 | || pos < gl_state.e_property); | 2193 | || pos < gl_state.e_property); |
| 2203 | 2194 | ||
| 2204 | update_syntax_table_forward (pos + gl_state.offset, | 2195 | update_syntax_table_forward (pos, false, gl_state.object); |
| 2205 | false, gl_state.object); | ||
| 2206 | } | 2196 | } |
| 2207 | } | 2197 | } |
| 2208 | else | 2198 | else |
diff --git a/src/syntax.h b/src/syntax.h index 9eb8701628b..01982be25a0 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -85,8 +85,6 @@ struct gl_state_s | |||
| 85 | and possibly at the | 85 | and possibly at the |
| 86 | intervals too, depending | 86 | intervals too, depending |
| 87 | on: */ | 87 | on: */ |
| 88 | /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ | ||
| 89 | ptrdiff_t offset; | ||
| 90 | }; | 88 | }; |
| 91 | 89 | ||
| 92 | extern struct gl_state_s gl_state; | 90 | extern struct gl_state_s gl_state; |
| @@ -147,28 +145,27 @@ extern bool syntax_prefix_flag_p (int c); | |||
| 147 | 145 | ||
| 148 | extern unsigned char const syntax_spec_code[0400]; | 146 | extern unsigned char const syntax_spec_code[0400]; |
| 149 | 147 | ||
| 150 | /* Convert the byte offset BYTEPOS into a character position, | 148 | /* Convert the regexp's BYTEOFFSET into a character position, |
| 151 | for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT. | 149 | for the object recorded in gl_state with RE_SETUP_SYNTAX_TABLE_FOR_OBJECT. |
| 152 | 150 | ||
| 153 | The value is meant for use in code that does nothing when | 151 | The value is meant for use in code that does nothing when |
| 154 | parse_sexp_lookup_properties is false, so return 0 in that case, | 152 | parse_sexp_lookup_properties is false, so return 0 in that case, |
| 155 | for speed. */ | 153 | for speed. */ |
| 156 | 154 | ||
| 157 | INLINE ptrdiff_t | 155 | INLINE ptrdiff_t |
| 158 | SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos) | 156 | RE_SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t byteoffset) |
| 159 | { | 157 | { |
| 160 | return (! parse_sexp_lookup_properties | 158 | return (! parse_sexp_lookup_properties |
| 161 | ? 0 | 159 | ? 0 |
| 162 | : STRINGP (gl_state.object) | 160 | : STRINGP (gl_state.object) |
| 163 | ? string_byte_to_char (gl_state.object, bytepos) | 161 | ? string_byte_to_char (gl_state.object, byteoffset) |
| 164 | : BUFFERP (gl_state.object) | 162 | : BUFFERP (gl_state.object) |
| 165 | ? ((buf_bytepos_to_charpos | 163 | ? ((buf_bytepos_to_charpos |
| 166 | (XBUFFER (gl_state.object), | 164 | (XBUFFER (gl_state.object), |
| 167 | (bytepos + BUF_BEGV_BYTE (XBUFFER (gl_state.object)) - 1))) | 165 | (byteoffset + BUF_BEGV_BYTE (XBUFFER (gl_state.object)))))) |
| 168 | - BUF_BEGV (XBUFFER (gl_state.object)) + 1) | ||
| 169 | : NILP (gl_state.object) | 166 | : NILP (gl_state.object) |
| 170 | ? BYTE_TO_CHAR (bytepos + BEGV_BYTE - 1) - BEGV + 1 | 167 | ? BYTE_TO_CHAR (byteoffset + BEGV_BYTE) |
| 171 | : bytepos); | 168 | : byteoffset); |
| 172 | } | 169 | } |
| 173 | 170 | ||
| 174 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is | 171 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is |
| @@ -178,8 +175,7 @@ INLINE void | |||
| 178 | UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) | 175 | UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) |
| 179 | { /* Performs just-in-time syntax-propertization. */ | 176 | { /* Performs just-in-time syntax-propertization. */ |
| 180 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) | 177 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) |
| 181 | update_syntax_table_forward (charpos + gl_state.offset, | 178 | update_syntax_table_forward (charpos, false, gl_state.object); |
| 182 | false, gl_state.object); | ||
| 183 | } | 179 | } |
| 184 | 180 | ||
| 185 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is | 181 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is |
| @@ -189,7 +185,7 @@ INLINE void | |||
| 189 | UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos) | 185 | UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos) |
| 190 | { | 186 | { |
| 191 | if (parse_sexp_lookup_properties && charpos < gl_state.b_property) | 187 | if (parse_sexp_lookup_properties && charpos < gl_state.b_property) |
| 192 | update_syntax_table (charpos + gl_state.offset, -1, false, gl_state.object); | 188 | update_syntax_table (charpos, -1, false, gl_state.object); |
| 193 | } | 189 | } |
| 194 | 190 | ||
| 195 | /* Make syntax table good for CHARPOS. */ | 191 | /* Make syntax table good for CHARPOS. */ |
| @@ -212,7 +208,7 @@ SETUP_BUFFER_SYNTAX_TABLE (void) | |||
| 212 | } | 208 | } |
| 213 | 209 | ||
| 214 | extern ptrdiff_t scan_words (ptrdiff_t, EMACS_INT); | 210 | extern ptrdiff_t scan_words (ptrdiff_t, EMACS_INT); |
| 215 | extern void SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object, ptrdiff_t, ptrdiff_t); | 211 | extern void RE_SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object, ptrdiff_t); |
| 216 | 212 | ||
| 217 | INLINE_HEADER_END | 213 | INLINE_HEADER_END |
| 218 | 214 | ||