use erg_common::error::{ErrorCore, ErrorKind::*, Location, SubMessage}; use erg_common::io::Input; use erg_common::switch_lang; use crate::error::*; pub type EvalError = CompileError; pub type EvalErrors = CompileErrors; pub type EvalResult = CompileResult; pub type SingleEvalResult = SingleCompileResult; impl EvalError { pub fn not_const_expr(input: Input, errno: usize, loc: Location, caused_by: String) -> Self { Self::new( ErrorCore::new( vec![SubMessage::only_loc(loc)], switch_lang!( "japanese" => "定数式ではありません", "simplified_chinese" => "不是常量表达式", "traditional_chinese" => "不是常量表達式", "english" => "not a constant expression", ), errno, NotConstExpr, loc, ), input, caused_by, ) } pub fn invalid_literal(input: Input, errno: usize, loc: Location, caused_by: String) -> Self { Self::new( ErrorCore::new( vec![SubMessage::only_loc(loc)], switch_lang!( "japanese" => "リテラルが不正です", "simplified_chinese" => "字面量不合法", "traditional_chinese" => "字面量不合法", "english" => "invalid literal", ), errno, SyntaxError, loc, ), input, caused_by, ) } }