aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.h
diff options
context:
space:
mode:
authorKarl Heuer1998-04-12 06:51:58 +0000
committerKarl Heuer1998-04-12 06:51:58 +0000
commitf79b4b7ee28adece8322e29a5548c9904ebbe316 (patch)
tree5124ddcaa9cf2c746e513e4122972307f7a8e927 /src/syntax.h
parent1b62edd6ba4e95bdd43a0089005728c829ff0036 (diff)
downloademacs-f79b4b7ee28adece8322e29a5548c9904ebbe316.tar.gz
emacs-f79b4b7ee28adece8322e29a5548c9904ebbe316.zip
(SETUP_SYNTAX_TABLE_FOR_OBJECT): FROM counts chars.
(SYNTAX_TABLE_BYTE_TO_CHAR): Handle the offset properly both before and after conversion. (UPDATE_SYNTAX_TABLE_FORWARD): Arg renamed to charpos. (UPDATE_SYNTAX_TABLE_BACKWARD, UPDATE_SYNTAX_TABLE): Likewise.
Diffstat (limited to 'src/syntax.h')
-rw-r--r--src/syntax.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/syntax.h b/src/syntax.h
index e72012af24d..35d50899e3f 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -223,44 +223,45 @@ extern char syntax_code_spec[16];
223 : STRINGP (gl_state.object) \ 223 : STRINGP (gl_state.object) \
224 ? string_byte_to_char (gl_state.object, (bytepos)) \ 224 ? string_byte_to_char (gl_state.object, (bytepos)) \
225 : BUFFERP (gl_state.object) \ 225 : BUFFERP (gl_state.object) \
226 ? buf_bytepos_to_charpos (XBUFFER (gl_state.object), (bytepos)) \ 226 ? buf_bytepos_to_charpos (XBUFFER (gl_state.object), \
227 (bytepos) + BUF_BEGV_BYTE (XBUFFER (gl_state.object)) - 1) - BUF_BEGV (XBUFFER (gl_state.object)) + 1 \
227 : NILP (gl_state.object) \ 228 : NILP (gl_state.object) \
228 ? BYTE_TO_CHAR ((bytepos)) \ 229 ? BYTE_TO_CHAR ((bytepos) + BEGV_BYTE - 1) - BEGV + 1 \
229 : (bytepos)) 230 : (bytepos))
230 231
231/* Make syntax table state (gl_state) good for POS, assuming it is 232/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
232 currently good for a position before POS. */ 233 currently good for a position before CHARPOS. */
233 234
234#define UPDATE_SYNTAX_TABLE_FORWARD(pos) \ 235#define UPDATE_SYNTAX_TABLE_FORWARD(charpos) \
235 (parse_sexp_lookup_properties \ 236 (parse_sexp_lookup_properties \
236 && (pos) >= gl_state.e_property \ 237 && (charpos) >= gl_state.e_property \
237 ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, \ 238 ? (update_syntax_table ((charpos) + gl_state.offset, 1, 0, \
238 gl_state.object), \ 239 gl_state.object), \
239 1) \ 240 1) \
240 : 0) 241 : 0)
241 242
242/* Make syntax table state (gl_state) good for POS, assuming it is 243/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
243 currently good for a position after POS. */ 244 currently good for a position after CHARPOS. */
244 245
245#define UPDATE_SYNTAX_TABLE_BACKWARD(pos) \ 246#define UPDATE_SYNTAX_TABLE_BACKWARD(charpos) \
246 (parse_sexp_lookup_properties \ 247 (parse_sexp_lookup_properties \
247 && (pos) <= gl_state.b_property \ 248 && (charpos) <= gl_state.b_property \
248 ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, \ 249 ? (update_syntax_table ((charpos) + gl_state.offset, -1, 0, \
249 gl_state.object), \ 250 gl_state.object), \
250 1) \ 251 1) \
251 : 0) 252 : 0)
252 253
253/* Make syntax table good for POS. */ 254/* Make syntax table good for CHARPOS. */
254 255
255#define UPDATE_SYNTAX_TABLE(pos) \ 256#define UPDATE_SYNTAX_TABLE(charpos) \
256 (parse_sexp_lookup_properties \ 257 (parse_sexp_lookup_properties \
257 && (pos) <= gl_state.b_property \ 258 && (charpos) <= gl_state.b_property \
258 ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, \ 259 ? (update_syntax_table ((charpos) + gl_state.offset, -1, 0, \
259 gl_state.object), \ 260 gl_state.object), \
260 1) \ 261 1) \
261 : (parse_sexp_lookup_properties \ 262 : (parse_sexp_lookup_properties \
262 && (pos) >= gl_state.e_property \ 263 && (charpos) >= gl_state.e_property \
263 ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, \ 264 ? (update_syntax_table ((charpos) + gl_state.offset, 1, 0,\
264 gl_state.object), \ 265 gl_state.object), \
265 1) \ 266 1) \
266 : 0)) 267 : 0))
@@ -327,7 +328,7 @@ if (1) \
327 gl_state.use_global = 0; \ 328 gl_state.use_global = 0; \
328 gl_state.current_syntax_table = current_buffer->syntax_table; \ 329 gl_state.current_syntax_table = current_buffer->syntax_table; \
329 if (parse_sexp_lookup_properties) \ 330 if (parse_sexp_lookup_properties) \
330 update_syntax_table ((BYTE_TO_CHAR ((FROM) + gl_state.offset) \ 331 update_syntax_table (((FROM) + gl_state.offset \
331 + (COUNT > 0 ? 0 : -1)), \ 332 + (COUNT > 0 ? 0 : -1)), \
332 COUNT, 1, gl_state.object); \ 333 COUNT, 1, gl_state.object); \
333 } \ 334 } \