update chumsky, lose ariadne, update parser to conform to new chumsky
This commit is contained in:
parent
de6cb5380d
commit
c62b5c903d
|
@ -9,8 +9,7 @@ edition = "2021"
|
|||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
ariadne = { git = "https://github.com/zesterer/ariadne" }
|
||||
chumsky = { git = "https://github.com/zesterer/chumsky", features = ["label"] }
|
||||
chumsky = "0.10.1"
|
||||
imbl = "3.0.0"
|
||||
ran = "2.0.1"
|
||||
num-derive = "0.4.2"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// use crate::process::{LErr, Trace};
|
||||
use crate::validator::VErr;
|
||||
use ariadne::{sources, Color, Label, Report, ReportKind};
|
||||
|
||||
// pub fn report_panic(err: LErr) {
|
||||
// let mut srcs = HashSet::new();
|
||||
|
@ -42,11 +41,12 @@ use ariadne::{sources, Color, Label, Report, ReportKind};
|
|||
|
||||
pub fn report_invalidation(errs: Vec<VErr>) {
|
||||
for err in errs {
|
||||
Report::build(ReportKind::Error, (err.input, err.span.into_range()))
|
||||
.with_message(err.msg.to_string())
|
||||
.with_label(Label::new((err.input, err.span.into_range())).with_color(Color::Cyan))
|
||||
.finish()
|
||||
.print(sources(vec![(err.input, err.src)]))
|
||||
.unwrap();
|
||||
// Report::build(ReportKind::Error, (err.input, err.span.into_range()))
|
||||
// .with_message(err.msg.to_string())
|
||||
// .with_label(Label::new((err.input, err.span.into_range())).with_color(Color::Cyan))
|
||||
// .finish()
|
||||
// .print(sources(vec![(err.input, err.src)]))
|
||||
// .unwrap();
|
||||
println!("{}", err.msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ fn parse_string(s: &'static str, span: SimpleSpan) -> Result<Vec<Spanned<StringP
|
|||
if !current_part.is_empty() {
|
||||
parts.push((
|
||||
StringPart::Data(current_part),
|
||||
SimpleSpan::new(start, start + i),
|
||||
SimpleSpan::new(span.context(), start..start + i),
|
||||
));
|
||||
};
|
||||
current_part = String::new();
|
||||
|
@ -80,7 +80,7 @@ fn parse_string(s: &'static str, span: SimpleSpan) -> Result<Vec<Spanned<StringP
|
|||
if is_word {
|
||||
parts.push((
|
||||
StringPart::Word(current_part.clone()),
|
||||
SimpleSpan::new(start, start + i),
|
||||
SimpleSpan::new(span.context(), start..start + i),
|
||||
));
|
||||
current_part = String::new();
|
||||
start = i;
|
||||
|
@ -109,13 +109,13 @@ fn parse_string(s: &'static str, span: SimpleSpan) -> Result<Vec<Spanned<StringP
|
|||
if current_part == s {
|
||||
parts.push((
|
||||
StringPart::Inline(current_part),
|
||||
SimpleSpan::new(start, span.end),
|
||||
SimpleSpan::new(span.context(), start..span.end),
|
||||
))
|
||||
} else if !current_part.is_empty() {
|
||||
let part_len = current_part.len();
|
||||
parts.push((
|
||||
StringPart::Data(current_part),
|
||||
SimpleSpan::new(start, part_len),
|
||||
SimpleSpan::new(span.context(), start..part_len),
|
||||
))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user