diff options
| author | Stefan Monnier | 2010-03-10 09:45:21 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-03-10 09:45:21 -0500 |
| commit | d48cd3f48fdd0d67f906311b632fb58ae4765b5e (patch) | |
| tree | 01c407576bb4aa2e07765a0314a58d2344960fce /src/syntax.h | |
| parent | 61c264722eabe920e3fadf892eb9d2e1c84d1ae3 (diff) | |
| download | emacs-d48cd3f48fdd0d67f906311b632fb58ae4765b5e.tar.gz emacs-d48cd3f48fdd0d67f906311b632fb58ae4765b5e.zip | |
Cleanup setup of gl_state in various parts of the code.
* syntax.h (SETUP_BUFFER_SYNTAX_TABLE): New macro.
(SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT):
* syntax.c (find_defun_start, Fchar_syntax, Fmatching_paren, skip_chars):
* regex.c (regex_compile): Use it.
(re_compile_pattern): Don't set gl_state.current_syntax_table since
it's now set in regex_compile when/if we need it.
Diffstat (limited to 'src/syntax.h')
| -rw-r--r-- | src/syntax.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/syntax.h b/src/syntax.h index c36b1eb28f6..ec8fab0166c 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -245,6 +245,14 @@ extern char syntax_code_spec[16]; | |||
| 245 | 1) \ | 245 | 1) \ |
| 246 | : 0)) | 246 | : 0)) |
| 247 | 247 | ||
| 248 | /* This macro sets up the buffer-global syntax table. */ | ||
| 249 | #define SETUP_BUFFER_SYNTAX_TABLE() \ | ||
| 250 | do \ | ||
| 251 | { \ | ||
| 252 | gl_state.use_global = 0; \ | ||
| 253 | gl_state.current_syntax_table = current_buffer->syntax_table; \ | ||
| 254 | } while (0) | ||
| 255 | |||
| 248 | /* This macro should be called with FROM at the start of forward | 256 | /* This macro should be called with FROM at the start of forward |
| 249 | search, or after the last position of the backward search. It | 257 | search, or after the last position of the backward search. It |
| 250 | makes sure that the first char is picked up with correct table, so | 258 | makes sure that the first char is picked up with correct table, so |
| @@ -256,12 +264,11 @@ extern char syntax_code_spec[16]; | |||
| 256 | #define SETUP_SYNTAX_TABLE(FROM, COUNT) \ | 264 | #define SETUP_SYNTAX_TABLE(FROM, COUNT) \ |
| 257 | do \ | 265 | do \ |
| 258 | { \ | 266 | { \ |
| 267 | SETUP_BUFFER_SYNTAX_TABLE (); \ | ||
| 259 | gl_state.b_property = BEGV; \ | 268 | gl_state.b_property = BEGV; \ |
| 260 | gl_state.e_property = ZV + 1; \ | 269 | gl_state.e_property = ZV + 1; \ |
| 261 | gl_state.object = Qnil; \ | 270 | gl_state.object = Qnil; \ |
| 262 | gl_state.use_global = 0; \ | ||
| 263 | gl_state.offset = 0; \ | 271 | gl_state.offset = 0; \ |
| 264 | gl_state.current_syntax_table = current_buffer->syntax_table; \ | ||
| 265 | if (parse_sexp_lookup_properties) \ | 272 | if (parse_sexp_lookup_properties) \ |
| 266 | if ((COUNT) > 0 || (FROM) > BEGV) \ | 273 | if ((COUNT) > 0 || (FROM) > BEGV) \ |
| 267 | update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\ | 274 | update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\ |
| @@ -279,6 +286,7 @@ while (0) | |||
| 279 | #define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \ | 286 | #define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \ |
| 280 | do \ | 287 | do \ |
| 281 | { \ | 288 | { \ |
| 289 | SETUP_BUFFER_SYNTAX_TABLE (); \ | ||
| 282 | gl_state.object = (OBJECT); \ | 290 | gl_state.object = (OBJECT); \ |
| 283 | if (BUFFERP (gl_state.object)) \ | 291 | if (BUFFERP (gl_state.object)) \ |
| 284 | { \ | 292 | { \ |
| @@ -305,8 +313,6 @@ do \ | |||
| 305 | gl_state.e_property = 1 + SCHARS (gl_state.object); \ | 313 | gl_state.e_property = 1 + SCHARS (gl_state.object); \ |
| 306 | gl_state.offset = 0; \ | 314 | gl_state.offset = 0; \ |
| 307 | } \ | 315 | } \ |
| 308 | gl_state.use_global = 0; \ | ||
| 309 | gl_state.current_syntax_table = current_buffer->syntax_table; \ | ||
| 310 | if (parse_sexp_lookup_properties) \ | 316 | if (parse_sexp_lookup_properties) \ |
| 311 | update_syntax_table (((FROM) + gl_state.offset \ | 317 | update_syntax_table (((FROM) + gl_state.offset \ |
| 312 | + (COUNT > 0 ? 0 : -1)), \ | 318 | + (COUNT > 0 ? 0 : -1)), \ |