use super::*;
use std::fmt::{Display, Formatter, Result};
impl Display for Designator {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
match self {
Designator::Identifier(ref sym) => write!(f, "{}", sym),
Designator::OperatorSymbol(ref latin1) => write!(f, "\"{}\"", latin1),
Designator::Character(byte) => write!(f, "'{}'", *byte as char),
}
}
}
impl<T: Display> Display for WithRef<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
write!(f, "{}", &self.item)
}
}
impl Display for SelectedName {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
match self {
SelectedName::Selected(ref prefix, ref des) => write!(f, "{}.{}", prefix, &des),
SelectedName::Designator(ref des) => write!(f, "{}", &des),
}
}
}
impl<T: Display> Display for WithPos<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
write!(f, "{}", &self.item)
}
}