Lisp_Object Vsyntax_designator_chars_string;
+Lisp_Object Qscan_error;
+
/* This is the internal form of the parse state used in parse-partial-sexp. */
struct lisp_parse_state {
enum syntaxcode code;
int syncode;
int min_depth = depth; /* Err out if depth gets less than this. */
+ Bufpos last_good = from;
if (depth > 0)
min_depth = 0;
c = BUF_FETCH_CHAR(buf, from);
syncode = SYNTAX_CODE_FROM_CACHE(mirrortab, c);
code = SYNTAX_FROM_CODE(syncode);
+ if (depth == min_depth)
+ last_good = from;
from++;
/* a 1-char comment start sequence */
if (depth < min_depth) {
if (noerror)
return Qnil;
- error("Containing expression "
- "ends prematurely");
+ signal_type_error_2(Qscan_error,
+ "Containing expression "
+ "ends prematurely",
+ make_int(last_good),
+ make_int(from));
}
break;
if (noerror) {
return Qnil;
}
- error("Containing expression "
- "ends prematurely");
+ signal_type_error_2(Qscan_error,
+ "Containing expression "
+ "ends premeturely",
+ make_int(last_good),
+ make_int(from));
}
break;
lose:
if (!noerror)
- error("Unbalanced parentheses");
+ signal_type_error_2(Qscan_error, "Unbalanced parentheses",
+ make_int(last_good), make_int(from));
return Qnil;
}
DEFSUBR(Fscan_sexps);
DEFSUBR(Fbackward_prefix_chars);
DEFSUBR(Fparse_partial_sexp);
+
+ DEFERROR_STANDARD(Qscan_error, Qsyntax_error);
}
void vars_of_syntax(void)