mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-31 15:48:23 +00:00
fix(parser): #245
This commit is contained in:
parent
8d723aed88
commit
1ff53f4669
2 changed files with 59 additions and 10 deletions
|
@ -387,6 +387,23 @@ impl LexError {
|
|||
Self::new(ErrorCore::new(vec![sub], msg, errno, SyntaxError, loc))
|
||||
}
|
||||
|
||||
pub fn invalid_colon_style(errno: usize, loc: Location) -> ParseError {
|
||||
let desc = switch_lang!(
|
||||
"japanese" => "コロンの後ろでカンマを使った区切りは使うことができません",
|
||||
"simplified_chinese" => "冒号后不能使用逗号分隔符",
|
||||
"traditional_chinese" => "冒號後不能使用逗號分隔符",
|
||||
"english" => "comma delimiters cannot be used after a colon",
|
||||
);
|
||||
let hint = switch_lang!(
|
||||
"japanese" => "カンマを削除してください",
|
||||
"simplified_chinese" => "逗号应该去掉",
|
||||
"traditional_chinese" => "逗號應該去掉",
|
||||
"english" => "comma should be removed",
|
||||
)
|
||||
.to_string();
|
||||
Self::syntax_error(errno, loc, desc, Some(hint))
|
||||
}
|
||||
|
||||
pub fn unclosed_error(errno: usize, loc: Location, closer: &str, ty: &str) -> ParseError {
|
||||
let msg = switch_lang!(
|
||||
"japanese" => format!("{ty}が{closer}で閉じられていません"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue