diff options
| author | Tom Tromey | 2013-03-08 11:57:29 -0700 |
|---|---|---|
| committer | Tom Tromey | 2013-03-08 11:57:29 -0700 |
| commit | 71f91792e3013b397996905224f387da5cc539a9 (patch) | |
| tree | 4c3d3ba909e76deea1cdf73b73fca67a57149465 /src/syntax.c | |
| parent | 6f4de085f065e11f4df3195d47479f28f5ef08ba (diff) | |
| parent | b5426561089d39f18b42bed9dbfcb531f43ed562 (diff) | |
| download | emacs-71f91792e3013b397996905224f387da5cc539a9.tar.gz emacs-71f91792e3013b397996905224f387da5cc539a9.zip | |
merge from trunk
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c index 72d904914ec..390d732944d 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). */ |
| @@ -3277,6 +3278,7 @@ do { prev_from = from; \ | |||
| 3277 | 3278 | ||
| 3278 | stop: /* Here if stopping before start of sexp. */ | 3279 | stop: /* Here if stopping before start of sexp. */ |
| 3279 | from = prev_from; /* We have just fetched the char that starts it; */ | 3280 | from = prev_from; /* We have just fetched the char that starts it; */ |
| 3281 | from_byte = prev_from_byte; | ||
| 3280 | goto done; /* but return the position before it. */ | 3282 | goto done; /* but return the position before it. */ |
| 3281 | 3283 | ||
| 3282 | endquoted: | 3284 | endquoted: |
| @@ -3288,6 +3290,7 @@ do { prev_from = from; \ | |||
| 3288 | state.prevlevelstart | 3290 | state.prevlevelstart |
| 3289 | = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; | 3291 | = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; |
| 3290 | state.location = from; | 3292 | state.location = from; |
| 3293 | state.location_byte = from_byte; | ||
| 3291 | state.levelstarts = Qnil; | 3294 | state.levelstarts = Qnil; |
| 3292 | while (curlevel > levelstart) | 3295 | while (curlevel > levelstart) |
| 3293 | state.levelstarts = Fcons (make_number ((--curlevel)->last), | 3296 | state.levelstarts = Fcons (make_number ((--curlevel)->last), |
| @@ -3327,7 +3330,8 @@ Fifth arg OLDSTATE is a list like what this function returns. | |||
| 3327 | Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. | 3330 | Sixth 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 | 3331 | 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. */) | 3332 | 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) | 3333 | (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, |
| 3334 | Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) | ||
| 3331 | { | 3335 | { |
| 3332 | struct lisp_parse_state state; | 3336 | struct lisp_parse_state state; |
| 3333 | EMACS_INT target; | 3337 | EMACS_INT target; |
| @@ -3347,7 +3351,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. | |||
| 3347 | (NILP (commentstop) | 3351 | (NILP (commentstop) |
| 3348 | ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); | 3352 | ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); |
| 3349 | 3353 | ||
| 3350 | SET_PT (state.location); | 3354 | SET_PT_BOTH (state.location, state.location_byte); |
| 3351 | 3355 | ||
| 3352 | return Fcons (make_number (state.depth), | 3356 | return Fcons (make_number (state.depth), |
| 3353 | Fcons (state.prevlevelstart < 0 | 3357 | Fcons (state.prevlevelstart < 0 |
| @@ -3389,8 +3393,8 @@ init_syntax_once (void) | |||
| 3389 | Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); | 3393 | Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); |
| 3390 | 3394 | ||
| 3391 | /* Create objects which can be shared among syntax tables. */ | 3395 | /* Create objects which can be shared among syntax tables. */ |
| 3392 | Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); | 3396 | Vsyntax_code_object = make_uninit_vector (Smax); |
| 3393 | for (i = 0; i < ASIZE (Vsyntax_code_object); i++) | 3397 | for (i = 0; i < Smax; i++) |
| 3394 | ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil)); | 3398 | ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil)); |
| 3395 | 3399 | ||
| 3396 | /* Now we are ready to set up this property, so we can | 3400 | /* Now we are ready to set up this property, so we can |