(error: nom::Err<ParserError<&str>>, input: &str)
| 188 | } |
| 189 | |
| 190 | pub fn format_parse_error(error: nom::Err<ParserError<&str>>, input: &str) -> anyhow::Error { |
| 191 | match error { |
| 192 | nom::Err::Error(e) | nom::Err::Failure(e) => { |
| 193 | let mut buffer = "Parse error\n".to_string(); |
| 194 | format_error(e.0, 0, input, &mut buffer); |
| 195 | anyhow::anyhow!("{}", buffer.trim_end()) |
| 196 | } |
| 197 | nom::Err::Incomplete(needed) => anyhow::anyhow!("Incomplete input (needed: {:?})", needed), |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | pub type NomResult<'a, Ret> = IResult<&'a str, Ret, ParserError<&'a str>>; |
| 202 |
no test coverage detected