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:
Matthew Flatt 2012-06-23 02:20:59 -07:00
parent 4323096a46
commit 91791983aa
4 changed files with 9 additions and 19 deletions

View File

@ -871,7 +871,7 @@
(null? (cdr l)))
(raise-syntax-error
#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)
(begin
(when l

View File

@ -213,8 +213,8 @@ as a ``result'' instead of an ``argument.''}
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
name in the error message. The @racket[message] is the error
message; if @racket[message] contains newline characters, each new line is
suitably indented (by adding one extra space at the start).
message; if @racket[message] contains newline characters, each extra line should be
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],
and the two are rendered on their own
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]
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] contains newline characters, each new line is
suitably indented (by adding one extra space at the start).
@racket[message] contains newline characters, each new line should be
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
object or S-expression (but the expression @racket[#f] cannot be

View File

@ -361,7 +361,7 @@ static int check_form(Scheme_Object *form, Scheme_Object *base_form)
static void bad_form(Scheme_Object *form, int l)
{
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" : "");
}
@ -4814,13 +4814,13 @@ scheme_compile_expand_expr(Scheme_Object *form, Scheme_Comp_Env *env,
scheme_wrong_syntax(scheme_compile_stx_string,
orig_unbound_name, form,
"unbound identifier%s;\n"
"also, no %S syntax transformer is bound",
" also, no %S syntax transformer is bound",
phase,
SCHEME_STX_VAL(stx));
} else {
scheme_wrong_syntax(scheme_compile_stx_string, NULL, form,
"%s is not allowed;\n"
"no %S syntax transformer is bound%s",
" no %S syntax transformer is bound%s",
not_allowed,
SCHEME_STX_VAL(stx),
phase);

View File

@ -1821,8 +1821,6 @@ void scheme_contract_error(const char *name, const char *msg, ...)
nlen = strlen(name);
seplen = strlen(sep);
msg = indent_lines(msg, &mlen, 0, 1);
len += mlen + nlen + seplen + 10;
s = scheme_malloc_atomic(len);
@ -1857,7 +1855,7 @@ void scheme_wrong_chaperoned(const char *who, const char *what, Scheme_Object *o
sprintf(buf,
"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);
scheme_contract_error(who,
@ -2164,8 +2162,6 @@ static void do_wrong_syntax(const char *where,
where = scheme_symbol_val(who);
}
s = (char *)indent_lines(s, &slen, 0, 1);
if (v) {
if (dv)
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]);
st = SCHEME_BYTE_STR_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)
total += 5;
} else {
@ -2781,7 +2772,6 @@ static Scheme_Object *do_raise_mismatch_error(const char *who, int mismatch, int
} else {
s2 = SCHEME_BYTE_STR_VAL(s);
l2 = SCHEME_BYTE_STRLEN_VAL(s);
s2 = (char *)indent_lines(s2, &l2, 0, 1);
}
scheme_raise_exn(MZEXN_FAIL_CONTRACT,