aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax.h')
-rw-r--r--src/syntax.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/syntax.h b/src/syntax.h
index 9eb8701628b..01982be25a0 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -85,8 +85,6 @@ struct gl_state_s
85 and possibly at the 85 and possibly at the
86 intervals too, depending 86 intervals too, depending
87 on: */ 87 on: */
88 /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */
89 ptrdiff_t offset;
90}; 88};
91 89
92extern struct gl_state_s gl_state; 90extern struct gl_state_s gl_state;
@@ -147,28 +145,27 @@ extern bool syntax_prefix_flag_p (int c);
147 145
148extern unsigned char const syntax_spec_code[0400]; 146extern unsigned char const syntax_spec_code[0400];
149 147
150/* Convert the byte offset BYTEPOS into a character position, 148/* Convert the regexp's BYTEOFFSET into a character position,
151 for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT. 149 for the object recorded in gl_state with RE_SETUP_SYNTAX_TABLE_FOR_OBJECT.
152 150
153 The value is meant for use in code that does nothing when 151 The value is meant for use in code that does nothing when
154 parse_sexp_lookup_properties is false, so return 0 in that case, 152 parse_sexp_lookup_properties is false, so return 0 in that case,
155 for speed. */ 153 for speed. */
156 154
157INLINE ptrdiff_t 155INLINE ptrdiff_t
158SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos) 156RE_SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t byteoffset)
159{ 157{
160 return (! parse_sexp_lookup_properties 158 return (! parse_sexp_lookup_properties
161 ? 0 159 ? 0
162 : STRINGP (gl_state.object) 160 : STRINGP (gl_state.object)
163 ? string_byte_to_char (gl_state.object, bytepos) 161 ? string_byte_to_char (gl_state.object, byteoffset)
164 : BUFFERP (gl_state.object) 162 : BUFFERP (gl_state.object)
165 ? ((buf_bytepos_to_charpos 163 ? ((buf_bytepos_to_charpos
166 (XBUFFER (gl_state.object), 164 (XBUFFER (gl_state.object),
167 (bytepos + BUF_BEGV_BYTE (XBUFFER (gl_state.object)) - 1))) 165 (byteoffset + BUF_BEGV_BYTE (XBUFFER (gl_state.object))))))
168 - BUF_BEGV (XBUFFER (gl_state.object)) + 1)
169 : NILP (gl_state.object) 166 : NILP (gl_state.object)
170 ? BYTE_TO_CHAR (bytepos + BEGV_BYTE - 1) - BEGV + 1 167 ? BYTE_TO_CHAR (byteoffset + BEGV_BYTE)
171 : bytepos); 168 : byteoffset);
172} 169}
173 170
174/* Make syntax table state (gl_state) good for CHARPOS, assuming it is 171/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
@@ -178,8 +175,7 @@ INLINE void
178UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) 175UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos)
179{ /* Performs just-in-time syntax-propertization. */ 176{ /* Performs just-in-time syntax-propertization. */
180 if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) 177 if (parse_sexp_lookup_properties && charpos >= gl_state.e_property)
181 update_syntax_table_forward (charpos + gl_state.offset, 178 update_syntax_table_forward (charpos, false, gl_state.object);
182 false, gl_state.object);
183} 179}
184 180
185/* Make syntax table state (gl_state) good for CHARPOS, assuming it is 181/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
@@ -189,7 +185,7 @@ INLINE void
189UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos) 185UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos)
190{ 186{
191 if (parse_sexp_lookup_properties && charpos < gl_state.b_property) 187 if (parse_sexp_lookup_properties && charpos < gl_state.b_property)
192 update_syntax_table (charpos + gl_state.offset, -1, false, gl_state.object); 188 update_syntax_table (charpos, -1, false, gl_state.object);
193} 189}
194 190
195/* Make syntax table good for CHARPOS. */ 191/* Make syntax table good for CHARPOS. */
@@ -212,7 +208,7 @@ SETUP_BUFFER_SYNTAX_TABLE (void)
212} 208}
213 209
214extern ptrdiff_t scan_words (ptrdiff_t, EMACS_INT); 210extern ptrdiff_t scan_words (ptrdiff_t, EMACS_INT);
215extern void SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object, ptrdiff_t, ptrdiff_t); 211extern void RE_SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object, ptrdiff_t);
216 212
217INLINE_HEADER_END 213INLINE_HEADER_END
218 214