diff options
| author | Stefan Monnier | 2015-09-09 15:14:52 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-09-09 15:14:52 -0400 |
| commit | ab21f61a552f038485d40218dfd94a16b843eb52 (patch) | |
| tree | 876a849cbfffc86a355480c17f93589fab012f82 /src/syntax.h | |
| parent | 74baea086d1ea606bae99bfc8c9195c21d5530fc (diff) | |
| download | emacs-ab21f61a552f038485d40218dfd94a16b843eb52.tar.gz emacs-ab21f61a552f038485d40218dfd94a16b843eb52.zip | |
Make syntax.c call syntax-propertize on demand
* lisp/emacs-lisp/syntax.el (syntax--jit-propertize): New function.
(parse-sexp-propertize-function): Use it.
(syntax-propertize): Disable parse-sexp-propertize-function.
* src/syntax.c (parse_sexp_propertize, update_syntax_table_forward):
New functions.
(syms_of_syntax): New vars `parse-sexp-propertize-done' and
`parse-sexp-propertize-function'.
* src/syntax.h (struct gl_state_s): Add `e_property_truncated' field.
(UPDATE_SYNTAX_TABLE_FORWARD): Use update_syntax_table_forward.
(SETUP_BUFFER_SYNTAX_TABLE): Set e_property_truncated.
* lisp/progmodes/elisp-mode.el (elisp-byte-code-syntax-propertize):
Don't assume `point' is set.
Diffstat (limited to 'src/syntax.h')
| -rw-r--r-- | src/syntax.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/syntax.h b/src/syntax.h index bfcb87168ba..9c44181155f 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | INLINE_HEADER_BEGIN | 21 | INLINE_HEADER_BEGIN |
| 22 | 22 | ||
| 23 | extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); | 23 | extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); |
| 24 | extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object); | ||
| 24 | 25 | ||
| 25 | /* The standard syntax table is stored where it will automatically | 26 | /* The standard syntax table is stored where it will automatically |
| 26 | be used in all new buffers. */ | 27 | be used in all new buffers. */ |
| @@ -52,30 +53,32 @@ enum syntaxcode | |||
| 52 | other side by any char with the same syntaxcode. */ | 53 | other side by any char with the same syntaxcode. */ |
| 53 | Sstring_fence, /* Starts/ends string which is delimited on the | 54 | Sstring_fence, /* Starts/ends string which is delimited on the |
| 54 | other side by any char with the same syntaxcode. */ | 55 | other side by any char with the same syntaxcode. */ |
| 55 | Smax /* Upper bound on codes that are meaningful */ | 56 | Smax /* Upper bound on codes that are meaningful. */ |
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | 59 | ||
| 59 | struct gl_state_s | 60 | struct gl_state_s |
| 60 | { | 61 | { |
| 61 | Lisp_Object object; /* The object we are scanning. */ | 62 | Lisp_Object object; /* The object we are scanning. */ |
| 62 | ptrdiff_t start; /* Where to stop. */ | 63 | ptrdiff_t start; /* Where to stop. */ |
| 63 | ptrdiff_t stop; /* Where to stop. */ | 64 | ptrdiff_t stop; /* Where to stop. */ |
| 64 | bool use_global; /* Whether to use global_code | 65 | bool use_global; /* Whether to use global_code |
| 65 | or c_s_t. */ | 66 | or c_s_t. */ |
| 66 | Lisp_Object global_code; /* Syntax code of current char. */ | 67 | Lisp_Object global_code; /* Syntax code of current char. */ |
| 67 | Lisp_Object current_syntax_table; /* Syntax table for current pos. */ | 68 | Lisp_Object current_syntax_table; /* Syntax table for current pos. */ |
| 68 | Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ | 69 | Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ |
| 69 | ptrdiff_t b_property; /* First index where c_s_t is valid. */ | 70 | ptrdiff_t b_property; /* First index where c_s_t is valid. */ |
| 70 | ptrdiff_t e_property; /* First index where c_s_t is | 71 | ptrdiff_t e_property; /* First index where c_s_t is |
| 71 | not valid. */ | 72 | not valid. */ |
| 72 | INTERVAL forward_i; /* Where to start lookup on forward */ | 73 | bool e_property_truncated; /* true if e_property if was truncated |
| 74 | by parse_sexp_propertize_done. */ | ||
| 75 | INTERVAL forward_i; /* Where to start lookup on forward. */ | ||
| 73 | INTERVAL backward_i; /* or backward movement. The | 76 | INTERVAL backward_i; /* or backward movement. The |
| 74 | data in c_s_t is valid | 77 | data in c_s_t is valid |
| 75 | between these intervals, | 78 | between these intervals, |
| 76 | and possibly at the | 79 | and possibly at the |
| 77 | intervals too, depending | 80 | intervals too, depending |
| 78 | on: */ | 81 | on: */ |
| 79 | /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ | 82 | /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ |
| 80 | ptrdiff_t offset; | 83 | ptrdiff_t offset; |
| 81 | }; | 84 | }; |
| @@ -173,7 +176,7 @@ INLINE void | |||
| 173 | UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) | 176 | UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) |
| 174 | { | 177 | { |
| 175 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) | 178 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) |
| 176 | update_syntax_table (charpos + gl_state.offset, 1, false, gl_state.object); | 179 | update_syntax_table_forward (charpos + gl_state.offset, false, gl_state.object); |
| 177 | } | 180 | } |
| 178 | 181 | ||
| 179 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is | 182 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is |
| @@ -201,6 +204,7 @@ INLINE void | |||
| 201 | SETUP_BUFFER_SYNTAX_TABLE (void) | 204 | SETUP_BUFFER_SYNTAX_TABLE (void) |
| 202 | { | 205 | { |
| 203 | gl_state.use_global = false; | 206 | gl_state.use_global = false; |
| 207 | gl_state.e_property_truncated = false; | ||
| 204 | gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); | 208 | gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); |
| 205 | } | 209 | } |
| 206 | 210 | ||