mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 02:13:11 +00:00
feat(REPL): add err type
This commit is contained in:
parent
8e5850d943
commit
b10b57d8e3
2 changed files with 20 additions and 0 deletions
|
@ -48,6 +48,7 @@ pub enum ErrorKind {
|
||||||
VisibilityError = 20,
|
VisibilityError = 20,
|
||||||
MethodError = 21,
|
MethodError = 21,
|
||||||
DummyError = 22,
|
DummyError = 22,
|
||||||
|
ExpectNextLine = 23,
|
||||||
/* compile warnings */
|
/* compile warnings */
|
||||||
AttributeWarning = 60,
|
AttributeWarning = 60,
|
||||||
CastWarning = 61,
|
CastWarning = 61,
|
||||||
|
|
|
@ -169,6 +169,25 @@ impl LexError {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn expect_next_line_error(errno: usize, loc: Location, caused: &str) -> Self {
|
||||||
|
Self::new(ErrorCore::new(
|
||||||
|
vec![SubMessage::ambiguous_new(
|
||||||
|
loc,
|
||||||
|
vec![caused.to_string()],
|
||||||
|
None,
|
||||||
|
)],
|
||||||
|
switch_lang!(
|
||||||
|
"japanese" => "ブロックが期待されていますが、EOFが与えられました",
|
||||||
|
"simplified_chinese" => "该块是预期的,但是是 EOF",
|
||||||
|
"traditional_chinese" => "該塊是預期的,但是是 EOF",
|
||||||
|
"english" => "The block is expected, but is EOF",
|
||||||
|
),
|
||||||
|
errno,
|
||||||
|
ExpectNextLine,
|
||||||
|
loc,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn syntax_error<S: Into<String>>(
|
pub fn syntax_error<S: Into<String>>(
|
||||||
errno: usize,
|
errno: usize,
|
||||||
loc: Location,
|
loc: Location,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue