DRY parser impls
[?]
Jan 13, 2021, 4:02 AM
XZ6Z2D6H7NPJASKMEWI7H6ALRJBH3GHFNHL67PAXQZM3N36W554ACDependencies
- [2]
RTDVYLFTGive gemtext parser a more uniform interface wrt other parsers - [3]
JBZGFYVOAdd nom parsers for main types - [4]
BOFUYB6IAdd documentation and implement some feedback from Discord (https://discord.com/channels/273534239310479360/354038657075904544/796256815024701480) - [*]
5II6T7YEAdd gemini library
Change contents
- replacement in gemini/src/lib.rs at line 30
use nom::{error::Error, Finish};use nom::{error::Error, Finish, IResult}; - edit in gemini/src/lib.rs at line 34
fn handle<I: ToOwned + ?Sized, O>(res: IResult<&I, O>) -> Result<O, Error<I::Owned>> {match res.finish() {Ok((_, res)) => Ok(res),Err(Error { input, code }) => Err({let input = input.to_owned();Error { input, code }}),}} - replacement in gemini/src/lib.rs at line 55
match $name::parse::$name(bytes).finish() {Ok((_, res)) => Ok(res),Err(Error { input, code }) => Err({let input = input.to_owned();Error { input, code }})}handle($name::parse::$name(bytes)) - replacement in gemini/src/lib.rs at line 76
match gemtext::parse::document(input).finish() {Ok((_, b)) => Ok(b),Err(Error { input, code }) => Err({let input = input.to_string();Error { input, code }}),}handle(gemtext::parse::document(input))