diff options
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/syntax.c b/src/syntax.c index 7bba336744a..6cbe0f6855f 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3547,8 +3547,10 @@ DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 0, doc: /* Parse Lisp syntax starting at FROM until TO; return status of parse at TO. Parsing stops at TO or when certain criteria are met; point is set to where parsing stops. -If fifth arg OLDSTATE is omitted or nil, - parsing assumes that FROM is the beginning of a function. + +If OLDSTATE is omitted or nil, parsing assumes that FROM is the + beginning of a function. If not, OLDSTATE should be the state at + FROM. Value is a list of elements describing final state of parsing: 0. depth in parens. @@ -3594,6 +3596,9 @@ Sixth arg COMMENTSTOP non-nil means stop after the start of a comment. else target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth. */ + if (XFIXNUM (to) < XFIXNUM (from)) + error ("End position should be larger than start position."); + validate_region (&from, &to); internalize_parse_state (oldstate, &state); scan_sexps_forward (&state, XFIXNUM (from), CHAR_TO_BYTE (XFIXNUM (from)), |