Revert "update: invalid convert error"

This reverts commit 1979e95901367bde9dc8ed83ecab27ab2c018c39.
This commit is contained in:
GreasySlug 2023-04-09 13:07:39 +09:00
parent 6998328516
commit d190abdb6a
2 changed files with 12 additions and 75 deletions

View file

@ -67,14 +67,9 @@ impl Parser {
Ok(sig) Ok(sig)
} }
other => { other => {
let err = ParseError::invalid_convert_error(
line!() as usize,
other.loc(),
"rhs",
"signature",
);
self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
self.errs.push(err);
Err(()) Err(())
} }
} }
@ -93,12 +88,7 @@ impl Parser {
Ok(VarSignature::new(pat, None)) Ok(VarSignature::new(pat, None))
} }
other => { other => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
line!() as usize,
other.loc(),
"accessor",
"variable signature",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
Err(()) Err(())
@ -120,12 +110,7 @@ impl Parser {
vars.push(v); vars.push(v);
} }
Signature::Subr(subr) => { Signature::Subr(subr) => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, subr.loc());
line!() as usize,
subr.loc(),
"array",
"array pattern",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
return Err(()); return Err(());
@ -236,12 +221,8 @@ impl Parser {
vars.push(var); vars.push(var);
} }
other => { other => {
let err = ParseError::invalid_convert_error( let err =
line!() as usize, ParseError::simple_syntax_error(line!() as usize, other.loc());
other.loc(),
"Tuple",
"Tuple pattern",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
return Err(()); return Err(());
@ -287,12 +268,7 @@ impl Parser {
.convert_accessor_to_ident(acc) .convert_accessor_to_ident(acc)
.map_err(|_| self.stack_dec(fn_name!()))?, .map_err(|_| self.stack_dec(fn_name!()))?,
other => { other => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
line!() as usize,
other.loc(),
"call",
"subroutine signature",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
return Err(()); return Err(());
@ -329,12 +305,7 @@ impl Parser {
(ident, bounds) (ident, bounds)
} }
other => { other => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
line!() as usize,
other.loc(),
"accessor",
"indemnifier",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
return Err(()); return Err(());
@ -385,12 +356,7 @@ impl Parser {
Ok(bound) Ok(bound)
} }
other => { other => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
line!() as usize,
other.loc(),
"type argument",
"bound",
);
self.errs.push(err); self.errs.push(err);
Err(()) Err(())
} }
@ -533,12 +499,7 @@ impl Parser {
} }
}, },
other => { other => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
line!() as usize,
other.loc(),
"right hand side",
"parameter",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
Err(()) Err(())
@ -751,12 +712,7 @@ impl Parser {
} }
}, },
other => { other => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
line!() as usize,
other.loc(),
"right hand side",
"lambda signature",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
Err(()) Err(())
@ -780,12 +736,7 @@ impl Parser {
Ok(NonDefaultParamSignature::new(pat, None)) Ok(NonDefaultParamSignature::new(pat, None))
} }
other => { other => {
let err = ParseError::invalid_convert_error( let err = ParseError::simple_syntax_error(line!() as usize, other.loc());
line!() as usize,
other.loc(),
"accessor",
"parameter signature",
);
self.errs.push(err); self.errs.push(err);
debug_exit_info!(self); debug_exit_info!(self);
Err(()) Err(())

View file

@ -219,20 +219,6 @@ impl LexError {
)) ))
} }
pub fn invalid_convert_error(errno: usize, loc: Location, from: &str, to: &str) -> ParseError {
Self::syntax_error(
errno,
loc,
switch_lang!(
"japanese" => format!("{from}から{to}に変換するのに失敗しました"),
"simplified_chinese" => format!("无法将{from}转换为{to}"),
"traditional_chinese" => format!("無法將{from}轉換為{to}"),
"english" => format!("failed to convert {from} to {to}"),
),
None,
)
}
pub fn invalid_definition_of_last_block(errno: usize, loc: Location) -> LexError { pub fn invalid_definition_of_last_block(errno: usize, loc: Location) -> LexError {
Self::syntax_error( Self::syntax_error(
errno, errno,