in sgx_demangle/src/v0.rs [803:897]
fn print_path(&mut self, in_value: bool) -> fmt::Result {
parse!(self, push_depth);
let tag = parse!(self, next);
match tag {
b'C' => {
let dis = parse!(self, disambiguator);
let name = parse!(self, ident);
self.print(name)?;
if let Some(out) = &mut self.out {
if !out.alternate() {
out.write_str("[")?;
fmt::LowerHex::fmt(&dis, out)?;
out.write_str("]")?;
}
}
}
b'N' => {
let ns = parse!(self, namespace);
self.print_path(in_value)?;
// HACK(eddyb) if the parser is already marked as having errored,
// `parse!` below will print a `?` without its preceding `::`
// (because printing the `::` is skipped in certain conditions,
// i.e. a lowercase namespace with an empty identifier),
// so in order to get `::?`, the `::` has to be printed here.
if self.parser.is_err() {
self.print("::")?;
}
let dis = parse!(self, disambiguator);
let name = parse!(self, ident);
match ns {
// Special namespaces, like closures and shims.
Some(ns) => {
self.print("::{")?;
match ns {
'C' => self.print("closure")?,
'S' => self.print("shim")?,
_ => self.print(ns)?,
}
if !name.ascii.is_empty() || !name.punycode.is_empty() {
self.print(":")?;
self.print(name)?;
}
self.print("#")?;
self.print(dis)?;
self.print("}")?;
}
// Implementation-specific/unspecified namespaces.
None => {
if !name.ascii.is_empty() || !name.punycode.is_empty() {
self.print("::")?;
self.print(name)?;
}
}
}
}
b'M' | b'X' | b'Y' => {
if tag != b'Y' {
// Ignore the `impl`'s own path.
parse!(self, disambiguator);
self.skipping_printing(|this| this.print_path(false));
}
self.print("<")?;
self.print_type()?;
if tag != b'M' {
self.print(" as ")?;
self.print_path(false)?;
}
self.print(">")?;
}
b'I' => {
self.print_path(in_value)?;
if in_value {
self.print("::")?;
}
self.print("<")?;
self.print_sep_list(Self::print_generic_arg, ", ")?;
self.print(">")?;
}
b'B' => {
self.print_backref(|this| this.print_path(in_value))?;
}
_ => invalid!(self),
}
self.pop_depth();
Ok(())
}