Bring path and tools up to date

This commit is contained in:
Tony Garnock-Jones 2022-10-29 11:47:27 +02:00
parent 0a20c76eb0
commit 0ffb44e8cb
3 changed files with 8 additions and 11 deletions

View File

@ -209,8 +209,7 @@ fn parse_comparison(
impl path::Selector {
pub fn from_str(env: &Env, s: &str) -> Result<Self, CompilationError> {
parse_selector(env, &(BytesBinarySource::new(s.as_bytes())
.text_iovalues()
.configured(false)
.text().iovalues().read_annotations(false)
.collect::<Result<Vec<_>, _>>()?))
}
}

View File

@ -220,8 +220,10 @@ impl Step for AxisStep {
_ => self.step.accept(ctxt, &IOValue::new(0)),
},
path::Axis::Annotations =>
for c in value.annotations().slice() {
self.step.accept(ctxt, &c)
if let Some(anns) = value.annotations() {
for c in anns.iter() {
self.step.accept(ctxt, &c)
}
},
path::Axis::Embedded => if let Some(d) = value.value().as_embedded() {
self.step.accept(ctxt, d)

View File

@ -7,18 +7,16 @@ use clap::Clap;
use clap::IntoApp;
use clap_generate::{generate, generators};
use preserves::value::BinarySource;
use preserves::value::IOBinarySource;
use preserves::value::IOValue;
use preserves::value::IOValueDomainCodec;
use preserves::value::NestedValue;
use preserves::value::PackedReader;
use preserves::value::PackedWriter;
use preserves::value::Reader;
use preserves::value::Set;
use preserves::value::TextReader;
use preserves::value::TextWriter;
use preserves::value::Value;
use preserves::value::ViaCodec;
use preserves::value::Writer;
use preserves::value::text::writer::CommaStyle;
@ -352,16 +350,14 @@ impl<R: io::Read> ValueStream<R> {
InputFormat::Binary => return Err(io::Error::new(
io::ErrorKind::InvalidData, "Expected binary input, saw text input")),
}
TextReader::new(&mut self.source, ViaCodec::new(IOValueDomainCodec))
.next(self.read_annotations)?
self.source.text().next(self.read_annotations)?
} else {
match self.input_format {
InputFormat::AutoDetect | InputFormat::Binary => (),
InputFormat::Text => return Err(io::Error::new(
io::ErrorKind::InvalidData, "Expected text input, saw binary input")),
}
PackedReader::new(&mut self.source, IOValueDomainCodec)
.next(self.read_annotations)?
self.source.packed().next(self.read_annotations)?
};
match maybe_value {