Add AtomicStr

This commit is contained in:
Shunsuke Shibayama 2022-09-14 12:11:06 +09:00
parent fb36c0d633
commit fe1b0fab70
11 changed files with 300 additions and 105 deletions

View file

@ -1,10 +1,10 @@
//! defines `ParseError` and others.
//!
//! パーサーが出すエラーを定義
use erg_common::astr::AtomicStr;
use erg_common::config::Input;
use erg_common::error::{ErrorCore, ErrorDisplay, ErrorKind::*, Location, MultiErrorDisplay};
use erg_common::traits::Stream;
use erg_common::Str;
use erg_common::{impl_stream_for_wrapper, switch_lang};
#[derive(Debug)]
@ -65,20 +65,20 @@ impl LexError {
))
}
pub fn syntax_error<S: Into<Str>>(
pub fn syntax_error<S: Into<AtomicStr>>(
errno: usize,
loc: Location,
desc: S,
hint: Option<Str>,
hint: Option<AtomicStr>,
) -> Self {
Self::new(ErrorCore::new(errno, SyntaxError, loc, desc, hint))
}
pub fn syntax_warning<S: Into<Str>>(
pub fn syntax_warning<S: Into<AtomicStr>>(
errno: usize,
loc: Location,
desc: S,
hint: Option<Str>,
hint: Option<AtomicStr>,
) -> Self {
Self::new(ErrorCore::new(errno, SyntaxWarning, loc, desc, hint))
}