in rust/ccommon-backend/src/option/parse.rs [452:497]
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
use ParseErrorType::*;
let spanmsg: String = (*self.span.text)
.iter()
.copied()
.flat_map(std::ascii::escape_default)
.map(|c| c as char)
.collect();
match &self.data {
InvalidBool => write!(
fmt,
"line {}: '{}' is not a valid boolean expression, expected 'yes' or 'no'",
self.span.line, spanmsg
),
InvalidUInt => write!(
fmt,
"line {}: '{}' is not a valid integer",
self.span.line, spanmsg
),
StringWithNull => write!(
fmt,
"line {}: string literal contained nul character",
self.span.line
),
InvalidFloat => write!(
fmt,
"line {}: '{}' is not a valid floating point number",
self.span.line, spanmsg
),
InvalidKey => write!(
fmt,
"line {}: option '{}' not recognized",
self.span.line, spanmsg
),
UnknownOptionType => write!(fmt, "unknown option type"),
NoColonInLine => write!(
fmt,
"line {}: invalid formatting, expected '<key>: <value>'",
self.span.line
),
IOError(e) => write!(fmt, "IO error: {}", e),
OutOfMemory => write!(fmt, "ran out of memory while parsing file"),
}
}