diff options
| author | Daniel Colascione | 2018-06-16 13:46:10 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2018-06-16 13:46:38 -0700 |
| commit | 938d252d1c6c5e2027aa250c649deb024154f936 (patch) | |
| tree | c0ee02c8cb40d0b7fc9bb0fa55ac8569491197c9 /src/syntax.h | |
| parent | 1502b377d35d6db623301829549ebcab9a2777e6 (diff) | |
| download | emacs-938d252d1c6c5e2027aa250c649deb024154f936.tar.gz emacs-938d252d1c6c5e2027aa250c649deb024154f936.zip | |
Make regex matching reentrant; update syntax during match
* src/lisp.h (compile_pattern): Remove prototype of
now-internal function.
* src/regex.c (POS_AS_IN_BUFFER): Consult gl_state instead of
re_match_object: the latter can change in Lisp.
(re_match_2_internal): Switch back to UPDATE_SYNTAX_* FROM
UPDATE_SYNTAX_FAST*, allowing calls into Lisp.
* src/regex.h (re_match_object): Uncomment declaration.
* src/search.c (struct regexp_cache): Add `busy' field.
(thaw_buffer_relocation): Delete; rely on unbind.
(compile_pattern_1): Assert pattern isn't busy.
(shrink_regexp_cache): Don't shrink busy patterns.
(clear_regexp_cache): Don't nuke busy patterns.
(unfreeze_pattern, freeze_pattern): New functions.
(compile_pattern): Return a regexp_cache pointer instead of the
re_pattern_buffer, allowing callers to use `freeze_pattern' if
needed. Do not consider busy patterns as cache hit candidates;
error if we run out of non-busy cache entries.
(looking_at_1, fast_looking_at): Snapshot
Vinhibit_changing_match_data; mark pattern busy while we're
matching it; unbind.
(string_match_1, fast_string_match_internal)
(fast_c_string_match_ignore_case): Adjust for compile_pattern
return type.
(search_buffer_re): Regex code from old search_buffer moved here;
snapshot Vinhibit_changing_match_data; mark pattern busy while
we're matching it; unbind.
(search_buffer_non_re): Non-regex code from old search_buffer
moved here.
(search_buffer): Split into search_buffer_re,
search_buffer_non_re.
(syms_of_search): Staticpro re_match_object, even though we really
shouldn't have to.
* src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST):
(UPDATE_SYNTAX_TABLE_FAST): Remove.
* src/thread.h (struct thread_state): Remove m_re_match_object,
which is global again. (It never needs to be preserved across
thread switch.)
Diffstat (limited to 'src/syntax.h')
| -rw-r--r-- | src/syntax.h | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/syntax.h b/src/syntax.h index 2171cbbba45..f02a17ce8d6 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -186,13 +186,6 @@ UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) | |||
| 186 | false, gl_state.object); | 186 | false, gl_state.object); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | INLINE void | ||
| 190 | UPDATE_SYNTAX_TABLE_FORWARD_FAST (ptrdiff_t charpos) | ||
| 191 | { | ||
| 192 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) | ||
| 193 | update_syntax_table (charpos + gl_state.offset, 1, false, gl_state.object); | ||
| 194 | } | ||
| 195 | |||
| 196 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is | 189 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is |
| 197 | currently good for a position after CHARPOS. */ | 190 | currently good for a position after CHARPOS. */ |
| 198 | 191 | ||
| @@ -212,13 +205,6 @@ UPDATE_SYNTAX_TABLE (ptrdiff_t charpos) | |||
| 212 | UPDATE_SYNTAX_TABLE_FORWARD (charpos); | 205 | UPDATE_SYNTAX_TABLE_FORWARD (charpos); |
| 213 | } | 206 | } |
| 214 | 207 | ||
| 215 | INLINE void | ||
| 216 | UPDATE_SYNTAX_TABLE_FAST (ptrdiff_t charpos) | ||
| 217 | { | ||
| 218 | UPDATE_SYNTAX_TABLE_BACKWARD (charpos); | ||
| 219 | UPDATE_SYNTAX_TABLE_FORWARD_FAST (charpos); | ||
| 220 | } | ||
| 221 | |||
| 222 | /* Set up the buffer-global syntax table. */ | 208 | /* Set up the buffer-global syntax table. */ |
| 223 | 209 | ||
| 224 | INLINE void | 210 | INLINE void |