Commit 09fe570d authored by Jeff Smits's avatar Jeff Smits

Propagate fixed string escaping in aterm crate

parent 052ea781
......@@ -2,7 +2,7 @@
name = "strs"
version = "0.1.0"
dependencies = [
"aterm 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
"aterm 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -29,7 +29,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "aterm"
version = "0.17.1"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -307,7 +307,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
"checksum aterm 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2861a3e1dd1e752eb5f0563f4576dfb79cd046b8e121304b02e48c67375d3039"
"checksum aterm 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0f2df2694d64af77e71242cfb2e0d421f4b95c0d9c07d0d0d8a1a4c4adbfd3"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
"checksum clap 2.23.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f57e9b63057a545ad2ecd773ea61e49422ed1b1d63d74d5da5ecaee55b3396cd"
......
......@@ -13,7 +13,7 @@ version = "0.1.0"
phf_codegen = "0.7.21"
[dependencies]
aterm = "0.17.1"
aterm = "0.18.1"
fnv = "1.0.5"
linked-hash-map = "0.4.2"
phf = "0.7.21"
......
......@@ -35,7 +35,7 @@ fn main() {
let opt = Opt::from_args();
match exec(&opt.program, &opt.output) {
Err(e) => {
eprintln!("{}", e.description());
eprintln!("{} ({})", e, e.description());
process::exit(1)
},
Ok(()) => {},
......
......@@ -182,8 +182,16 @@ impl<'s, 'a> TryFrom<&'a ATermRef<'s>> for ImportModName<'s> {
impl<'s> ATermWrite for ImportModName<'s> {
fn to_ascii<W: fmt::Write>(&self, writer: &mut W) -> fmt::Result {
match *self {
ImportModName::Import(name) => write!(writer, "Import({:?})", name),
ImportModName::ImportWildcard(name) => write!(writer, "ImportWildcard({:?})", name),
ImportModName::Import(name) => {
write!(writer, "Import(")?;
name.to_ascii(writer)?;
write!(writer, ")")
},
ImportModName::ImportWildcard(name) => {
write!(writer, "ImportWildcard(")?;
name.to_ascii(writer)?;
write!(writer, ")")
},
}
}
}
......@@ -313,10 +321,20 @@ impl<'s, 'a> TryFrom<&'a ATermRef<'s>> for Sort<'s> {
impl<'s> ATermWrite for Sort<'s> {
fn to_ascii<W: fmt::Write>(&self, writer: &mut W) -> fmt::Result {
match *self {
Sort::SortVar(id) => write!(writer, "SortVar({:?})", id),
Sort::SortNoArgs(id) => write!(writer, "SortNoArgs({:?})", id),
Sort::SortVar(id) => {
write!(writer, "SortVar(")?;
id.to_ascii(writer)?;
write!(writer, ")")
},
Sort::SortNoArgs(id) => {
write!(writer, "SortNoArgs(")?;
id.to_ascii(writer)?;
write!(writer, ")")
}
Sort::Sort(id, ref args) => {
write!(writer, "Sort({:?},[", id)?;
write!(writer, "Sort(")?;
id.to_ascii(writer)?;
write!(writer, ",[")?;
args.to_ascii(writer)?;
write!(writer, "])")
}
......@@ -399,12 +417,16 @@ impl<'s> ATermWrite for OpDecl<'s> {
fn to_ascii<W: fmt::Write>(&self, writer: &mut W) -> fmt::Result {
match *self {
OpDecl::OpDecl(s, ref ty) => {
write!(writer, "OpDecl({:?},", s)?;
write!(writer, "OpDecl(")?;
s.to_ascii(writer)?;
write!(writer, ",")?;
ty.to_ascii(writer)?;
write!(writer, ")")
}
OpDecl::OpDeclQ(s, ref ty) => {
write!(writer, "OpDeclQ({:?},", s)?;
write!(writer, "OpDeclQ(")?;
s.to_ascii(writer)?;
write!(writer, ",")?;
ty.to_ascii(writer)?;
write!(writer, ")")
}
......@@ -414,12 +436,16 @@ impl<'s> ATermWrite for OpDecl<'s> {
write!(writer, ")")
}
OpDecl::ExtOpDecl(s, ref ty) => {
write!(writer, "ExtOpDecl({:?},", s)?;
write!(writer, "ExtOpDecl(")?;
s.to_ascii(writer)?;
write!(writer, ",")?;
ty.to_ascii(writer)?;
write!(writer, ")")
}
OpDecl::ExtOpDeclQ(s, ref ty) => {
write!(writer, "ExtOpDeclQ({:?},", s)?;
write!(writer, "ExtOpDeclQ(")?;
s.to_ascii(writer)?;
write!(writer, ",")?;
ty.to_ascii(writer)?;
write!(writer, ")")
}
......@@ -862,7 +888,9 @@ impl<'s, 'a> TryFrom<&'a ATermRef<'s>> for VarDec<'s> {
impl<'s> ATermWrite for VarDec<'s> {
fn to_ascii<W: fmt::Write>(&self, writer: &mut W) -> fmt::Result {
write!(writer, "VarDec({:?},", self.0)?;
write!(writer, "VarDec(")?;
self.0.to_ascii(writer)?;
write!(writer, ",")?;
self.1.to_ascii(writer)?;
write!(writer, ")")
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment