Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
module errors
import v3.token
import term
pub enum Kind {
warning
notice
error
}
pub fn (e Kind) str() string {
return match e {
.warning { 'warning' }
.notice { 'notice' }
.error { 'error' }
}
}
pub fn (e Kind) color(s string) string {
return match e {
.warning { term.yellow(s) }
.notice { term.blue(s) }
.error { term.red(s) }
}
}
pub fn error(msg string, details string, kind Kind, pos token.Position) {
eprintln(pos.str() + ' -> ' + term.bold(kind.color(kind.str())) + ': ' + msg)
if details.len > 0 {
eprintln(details)
}
}