diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-16 13:04:38 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-16 13:04:38 +0200 |
commit | 93d0b7c6465f4ffe220b3ddada729746b11eb6ce (patch) | |
tree | e7907fb89a6660c5546d2ca128b2d48ec87539ae /src/construct/partial_space_or_tab_eol.rs | |
parent | 2379c2749916483be68dbf816a4c56cd59ced958 (diff) | |
download | markdown-rs-93d0b7c6465f4ffe220b3ddada729746b11eb6ce.tar.gz markdown-rs-93d0b7c6465f4ffe220b3ddada729746b11eb6ce.tar.bz2 markdown-rs-93d0b7c6465f4ffe220b3ddada729746b11eb6ce.zip |
Update some last docs, bnf grammars
Diffstat (limited to 'src/construct/partial_space_or_tab_eol.rs')
-rw-r--r-- | src/construct/partial_space_or_tab_eol.rs | 26 |
1 files changed, 18 insertions, 8 deletions
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 +//! (<small>see [construct][crate::construct] for character groups</small>): +//! +//! ```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<Content>, } -/// `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, |