From fb648ef61e077ed5a8a233f620a4ddc1208a2b0b Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Wed, 29 Jun 2016 01:01:29 +0200 Subject: [PATCH] Blank function definitions (unimplemented) for the markdown link parser using nom --- Cargo.toml | 1 + src/parse/mod.rs | 1 + src/parse/nom.rs | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 src/parse/nom.rs diff --git a/Cargo.toml b/Cargo.toml index cfd41b2c..69c41abd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ clap = "2.2.1" handlebars = "0.20.0" rustc-serialize = "0.3.18" pulldown-cmark = "0.0.8" +nom = "1.2.3" # Watch feature notify = { version = "2.5.5", optional = true } diff --git a/src/parse/mod.rs b/src/parse/mod.rs index c8c8aab7..a2ddc144 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -1,3 +1,4 @@ pub use self::summary::construct_bookitems; pub mod summary; +pub mod nom; diff --git a/src/parse/nom.rs b/src/parse/nom.rs new file mode 100644 index 00000000..e151bcd2 --- /dev/null +++ b/src/parse/nom.rs @@ -0,0 +1,31 @@ +extern crate nom; + +use self::nom::IResult; + +#[derive(Debug, Clone)] +struct Link { + title: String, + destination: String, +} + +/// Parser for markdown links: `[title](destination)` +/// From the Common Mark spec: +/// +/// Brackets are allowed in the link text only if +/// (a) they are backslash-escaped or +/// (b) they appear as a matched pair of brackets, +/// with an open bracket [, a sequence of zero or more inlines, and a close bracket ]. +/// +fn link(i: &[u8]) -> IResult<&[u8], Link> { + unimplemented!(); +} + +/// Parser for parsing the title part of the link: [title](destination) +/// ^^^^^^^ +fn link_text(i: &[u8]) -> IResult<&[u8], String> { + unimplemented!(); +} + +fn link_destination(i: &[u8]) -> IResult<&[u8], String> { + unimplemented!(); +}