1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// SPDX-License-Identifier: MPL-2.0
// (c) Hare authors <https://harelang.org>
use common;
use fmt;
use vNEXT::lex;
// All possible error types.
export type error = !common::error;
// Convert an error into a human-friendly string. The result may be statically
// allocated.
export fn strerror(err: error) const str = common::strerror(err: common::error);
fn syntaxerr(
loc: common::location,
fmt: str,
args: fmt::field...
) common::error = {
static let buf: [4096]u8 = [0...];
let why = fmt::bsprintf(buf, fmt, args...)!;
return lex::syntaxerr(loc, why);
};
|