Mercurial > emacs
comparison src/syntax.h @ 21481:e53c0d01cf31
(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.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sun, 12 Apr 1998 06:51:58 +0000 |
parents | dac44ee5f772 |
children | 917424c9c149 |
comparison
equal
deleted
inserted
replaced
21480:20aab049dc4a | 21481:e53c0d01cf31 |
---|---|
221 (! parse_sexp_lookup_properties \ | 221 (! parse_sexp_lookup_properties \ |
222 ? 0 \ | 222 ? 0 \ |
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)) |
267 | 268 |
268 /* This macro should be called with FROM at the start of forward | 269 /* This macro should be called with FROM at the start of forward |
325 gl_state.offset = 0; \ | 326 gl_state.offset = 0; \ |
326 } \ | 327 } \ |
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 } \ |
334 else | 335 else |
335 | 336 |