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