aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorDmitry Antipov2013-02-08 18:44:53 +0400
committerDmitry Antipov2013-02-08 18:44:53 +0400
commit8ca30920525154d5eef67899b04dde77f4176169 (patch)
tree21370d2a80e1698b9fcd835527ee3dda5f8324fa /src/syntax.c
parent6130b96ae7ed9632e7623fb86eac695edc401098 (diff)
downloademacs-8ca30920525154d5eef67899b04dde77f4176169.tar.gz
emacs-8ca30920525154d5eef67899b04dde77f4176169.zip
* search.c (scan_buffer): Calculate end byte position just once.
(scan_newline): Do not recalculate start_byte. (search_command): Use eassert. * syntax.c (struct lisp_parse_state): New member location_byte. (scan_sexps_forward): Record from_byte and avoid redundant character to byte position calculation ... (Fparse_partial_sexp): ... here. Break too long line.
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 6febcd266c0..42500b0cb76 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -121,6 +121,7 @@ struct lisp_parse_state
121 /* Char number of start of containing expression */ 121 /* Char number of start of containing expression */
122 ptrdiff_t prevlevelstart; 122 ptrdiff_t prevlevelstart;
123 ptrdiff_t location; /* Char number at which parsing stopped. */ 123 ptrdiff_t location; /* Char number at which parsing stopped. */
124 ptrdiff_t location_byte; /* Corresponding byte position. */
124 ptrdiff_t comstr_start; /* Position of last comment/string starter. */ 125 ptrdiff_t comstr_start; /* Position of last comment/string starter. */
125 Lisp_Object levelstarts; /* Char numbers of starts-of-expression 126 Lisp_Object levelstarts; /* Char numbers of starts-of-expression
126 of levels (starting from outermost). */ 127 of levels (starting from outermost). */
@@ -3288,6 +3289,7 @@ do { prev_from = from; \
3288 state.prevlevelstart 3289 state.prevlevelstart
3289 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; 3290 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last;
3290 state.location = from; 3291 state.location = from;
3292 state.location_byte = from_byte;
3291 state.levelstarts = Qnil; 3293 state.levelstarts = Qnil;
3292 while (curlevel > levelstart) 3294 while (curlevel > levelstart)
3293 state.levelstarts = Fcons (make_number ((--curlevel)->last), 3295 state.levelstarts = Fcons (make_number ((--curlevel)->last),
@@ -3327,7 +3329,8 @@ Fifth arg OLDSTATE is a list like what this function returns.
3327Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. 3329Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3328 If it is symbol `syntax-table', stop after the start of a comment or a 3330 If it is symbol `syntax-table', stop after the start of a comment or a
3329 string, or after end of a comment or a string. */) 3331 string, or after end of a comment or a string. */)
3330 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) 3332 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth,
3333 Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop)
3331{ 3334{
3332 struct lisp_parse_state state; 3335 struct lisp_parse_state state;
3333 EMACS_INT target; 3336 EMACS_INT target;
@@ -3347,7 +3350,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3347 (NILP (commentstop) 3350 (NILP (commentstop)
3348 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); 3351 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));
3349 3352
3350 SET_PT (state.location); 3353 SET_PT_BOTH (state.location, state.location_byte);
3351 3354
3352 return Fcons (make_number (state.depth), 3355 return Fcons (make_number (state.depth),
3353 Fcons (state.prevlevelstart < 0 3356 Fcons (state.prevlevelstart < 0