Change-Id: I2352d75a3f02d65a5a2d04fb2cc4daa50f11ca1e Reviewed-on: https://cl.tvl.fyi/c/depot/+/2321 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
25 lines
546 B
Rust
25 lines
546 B
Rust
#[derive(Debug)]
|
|
pub enum ErrorKind {
|
|
UnexpectedChar(char),
|
|
UnterminatedString,
|
|
UnmatchedParens,
|
|
ExpectedExpression(String),
|
|
ExpectedSemicolon,
|
|
ExpectedClosingBrace,
|
|
ExpectedVariableName,
|
|
ExpectedToken(&'static str),
|
|
TypeError(String),
|
|
UndefinedVariable(String),
|
|
InternalError(String),
|
|
InvalidAssignmentTarget(String),
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct Error {
|
|
pub line: usize,
|
|
pub kind: ErrorKind,
|
|
}
|
|
|
|
pub fn report(err: &Error) {
|
|
eprintln!("[line {}] Error: {:?}", err.line, err.kind);
|
|
}
|