From 93d0b7c6465f4ffe220b3ddada729746b11eb6ce Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 16 Aug 2022 13:04:38 +0200 Subject: Update some last docs, bnf grammars --- src/construct/partial_space_or_tab_eol.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/construct/partial_space_or_tab_eol.rs') diff --git a/src/construct/partial_space_or_tab_eol.rs b/src/construct/partial_space_or_tab_eol.rs index 427cb11..01f440e 100644 --- a/src/construct/partial_space_or_tab_eol.rs +++ b/src/construct/partial_space_or_tab_eol.rs @@ -1,8 +1,23 @@ -//! Several helpers to parse whitespace (`space_or_tab`, `space_or_tab_eol`). +//! Space or tab (eol) occurs in [destination][], [label][], and [title][]. +//! +//! ## Grammar +//! +//! Space or tab (eol) forms with the following BNF +//! (see [construct][crate::construct] for character groups): +//! +//! ```bnf +//! space_or_tab_eol ::= 1*space_or_tab | *space_or_tab eol *space_or_tab +//! ``` +//! +//! Importantly, this allows one line ending, but not blank lines. //! //! ## References //! //! * [`micromark-factory-space/index.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-factory-space/dev/index.js) +//! +//! [destination]: crate::construct::partial_destination +//! [label]: crate::construct::partial_label +//! [title]: crate::construct::partial_title use crate::construct::partial_space_or_tab::{ space_or_tab_with_options, Options as SpaceOrTabOptions, @@ -12,7 +27,7 @@ use crate::state::{Name as StateName, State}; use crate::subtokenize::link; use crate::tokenizer::Tokenizer; -/// Options to parse `space_or_tab` and one optional eol, but no blank line. +/// Configuration. #[derive(Debug)] pub struct Options { /// Connect this whitespace to the previous. @@ -21,12 +36,7 @@ pub struct Options { pub content: Option, } -/// `space_or_tab`, or optionally `space_or_tab`, one `eol`, and -/// optionally `space_or_tab`. -/// -/// ```bnf -/// space_or_tab_eol ::= 1*( ' ' '\t' ) | 0*( ' ' '\t' ) eol 0*( ' ' '\t' ) -/// ``` +/// `space_or_tab_eol` pub fn space_or_tab_eol(tokenizer: &mut Tokenizer) -> StateName { space_or_tab_eol_with_options( tokenizer, -- cgit