fix indentation of some error messages
`raise-syntax-error' and `raise-arguments-error' do not try to adjust indentation, anymore, because it's too confusing
This commit is contained in:
parent
4323096a46
commit
91791983aa
|
@ -871,7 +871,7 @@
|
||||||
(null? (cdr l)))
|
(null? (cdr l)))
|
||||||
(raise-syntax-error
|
(raise-syntax-error
|
||||||
#f
|
#f
|
||||||
"missing procedure expression;\nprobably originally (), which is an illegal empty application"
|
"missing procedure expression;\n probably originally (), which is an illegal empty application"
|
||||||
stx)
|
stx)
|
||||||
(begin
|
(begin
|
||||||
(when l
|
(when l
|
||||||
|
|
|
@ -213,8 +213,8 @@ as a ``result'' instead of an ``argument.''}
|
||||||
Creates an @racket[exn:fail:contract] value and @racket[raise]s it as
|
Creates an @racket[exn:fail:contract] value and @racket[raise]s it as
|
||||||
an exception. The @racket[name] is used as the source procedure's
|
an exception. The @racket[name] is used as the source procedure's
|
||||||
name in the error message. The @racket[message] is the error
|
name in the error message. The @racket[message] is the error
|
||||||
message; if @racket[message] contains newline characters, each new line is
|
message; if @racket[message] contains newline characters, each extra line should be
|
||||||
suitably indented (by adding one extra space at the start).
|
suitably indented (with one extra space at the start of each line), but it should not end with a newline character.
|
||||||
Each @racket[field] must have a corresponding @racket[v],
|
Each @racket[field] must have a corresponding @racket[v],
|
||||||
and the two are rendered on their own
|
and the two are rendered on their own
|
||||||
line in the error message, with each @racket[v] formatted
|
line in the error message, with each @racket[v] formatted
|
||||||
|
@ -313,8 +313,8 @@ exception. Macros use this procedure to report syntax errors.
|
||||||
The @racket[name] argument is usually @racket[#f] when @racket[expr]
|
The @racket[name] argument is usually @racket[#f] when @racket[expr]
|
||||||
is provided; it is described in more detail below. The
|
is provided; it is described in more detail below. The
|
||||||
@racket[message] is used as the main body of the error message; if
|
@racket[message] is used as the main body of the error message; if
|
||||||
@racket[message] contains newline characters, each new line is
|
@racket[message] contains newline characters, each new line should be
|
||||||
suitably indented (by adding one extra space at the start).
|
suitably indented (with one space at the start), and it should not end with a newline character.
|
||||||
|
|
||||||
The optional @racket[expr] argument is the erroneous source syntax
|
The optional @racket[expr] argument is the erroneous source syntax
|
||||||
object or S-expression (but the expression @racket[#f] cannot be
|
object or S-expression (but the expression @racket[#f] cannot be
|
||||||
|
|
|
@ -361,7 +361,7 @@ static int check_form(Scheme_Object *form, Scheme_Object *base_form)
|
||||||
static void bad_form(Scheme_Object *form, int l)
|
static void bad_form(Scheme_Object *form, int l)
|
||||||
{
|
{
|
||||||
scheme_wrong_syntax(NULL, NULL, form,
|
scheme_wrong_syntax(NULL, NULL, form,
|
||||||
"bad syntax;\nhas %d part%s after keyword",
|
"bad syntax;\n has %d part%s after keyword",
|
||||||
l - 1, (l != 2) ? "s" : "");
|
l - 1, (l != 2) ? "s" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4814,13 +4814,13 @@ scheme_compile_expand_expr(Scheme_Object *form, Scheme_Comp_Env *env,
|
||||||
scheme_wrong_syntax(scheme_compile_stx_string,
|
scheme_wrong_syntax(scheme_compile_stx_string,
|
||||||
orig_unbound_name, form,
|
orig_unbound_name, form,
|
||||||
"unbound identifier%s;\n"
|
"unbound identifier%s;\n"
|
||||||
"also, no %S syntax transformer is bound",
|
" also, no %S syntax transformer is bound",
|
||||||
phase,
|
phase,
|
||||||
SCHEME_STX_VAL(stx));
|
SCHEME_STX_VAL(stx));
|
||||||
} else {
|
} else {
|
||||||
scheme_wrong_syntax(scheme_compile_stx_string, NULL, form,
|
scheme_wrong_syntax(scheme_compile_stx_string, NULL, form,
|
||||||
"%s is not allowed;\n"
|
"%s is not allowed;\n"
|
||||||
"no %S syntax transformer is bound%s",
|
" no %S syntax transformer is bound%s",
|
||||||
not_allowed,
|
not_allowed,
|
||||||
SCHEME_STX_VAL(stx),
|
SCHEME_STX_VAL(stx),
|
||||||
phase);
|
phase);
|
||||||
|
|
|
@ -1821,8 +1821,6 @@ void scheme_contract_error(const char *name, const char *msg, ...)
|
||||||
nlen = strlen(name);
|
nlen = strlen(name);
|
||||||
seplen = strlen(sep);
|
seplen = strlen(sep);
|
||||||
|
|
||||||
msg = indent_lines(msg, &mlen, 0, 1);
|
|
||||||
|
|
||||||
len += mlen + nlen + seplen + 10;
|
len += mlen + nlen + seplen + 10;
|
||||||
|
|
||||||
s = scheme_malloc_atomic(len);
|
s = scheme_malloc_atomic(len);
|
||||||
|
@ -1857,7 +1855,7 @@ void scheme_wrong_chaperoned(const char *who, const char *what, Scheme_Object *o
|
||||||
|
|
||||||
sprintf(buf,
|
sprintf(buf,
|
||||||
"non-chaperone result;\n"
|
"non-chaperone result;\n"
|
||||||
"received a %s that is not a chaperone of the original %s",
|
" received a %s that is not a chaperone of the original %s",
|
||||||
what, what);
|
what, what);
|
||||||
|
|
||||||
scheme_contract_error(who,
|
scheme_contract_error(who,
|
||||||
|
@ -2164,8 +2162,6 @@ static void do_wrong_syntax(const char *where,
|
||||||
where = scheme_symbol_val(who);
|
where = scheme_symbol_val(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
s = (char *)indent_lines(s, &slen, 0, 1);
|
|
||||||
|
|
||||||
if (v) {
|
if (v) {
|
||||||
if (dv)
|
if (dv)
|
||||||
blen = scheme_sprintf(buffer, blen,
|
blen = scheme_sprintf(buffer, blen,
|
||||||
|
@ -2742,11 +2738,6 @@ static Scheme_Object *do_raise_mismatch_error(const char *who, int mismatch, int
|
||||||
s = scheme_char_string_to_byte_string(argv[i+offset]);
|
s = scheme_char_string_to_byte_string(argv[i+offset]);
|
||||||
st = SCHEME_BYTE_STR_VAL(s);
|
st = SCHEME_BYTE_STR_VAL(s);
|
||||||
slen = SCHEME_BYTE_STRLEN_VAL(s);
|
slen = SCHEME_BYTE_STRLEN_VAL(s);
|
||||||
if (i == 1) {
|
|
||||||
intptr_t fl = slen;
|
|
||||||
st = (char *)indent_lines(st, &fl, 0, 1);
|
|
||||||
slen = fl;
|
|
||||||
}
|
|
||||||
if (!mismatch)
|
if (!mismatch)
|
||||||
total += 5;
|
total += 5;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2781,7 +2772,6 @@ static Scheme_Object *do_raise_mismatch_error(const char *who, int mismatch, int
|
||||||
} else {
|
} else {
|
||||||
s2 = SCHEME_BYTE_STR_VAL(s);
|
s2 = SCHEME_BYTE_STR_VAL(s);
|
||||||
l2 = SCHEME_BYTE_STRLEN_VAL(s);
|
l2 = SCHEME_BYTE_STRLEN_VAL(s);
|
||||||
s2 = (char *)indent_lines(s2, &l2, 0, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scheme_raise_exn(MZEXN_FAIL_CONTRACT,
|
scheme_raise_exn(MZEXN_FAIL_CONTRACT,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user