12 lines
256 B
Rust
12 lines
256 B
Rust
pub fn got_char_or_eof(got: Option<char>) -> String {
|
|
if let Some(got) = got {
|
|
expected_got_char(got)
|
|
} else {
|
|
"EOF".to_string()
|
|
}
|
|
}
|
|
|
|
pub fn expected_got_char(c: char) -> String {
|
|
format!("character {}", c.escape_debug())
|
|
}
|