From 65dd765cceee8bdccc74c08066eec59a579a16b1 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 20 Jun 2022 17:06:00 +0200 Subject: Add improved whitespace handling * add several helpers for parsing betwen x and y `space_or_tab`s * use those helpers in a bunch of places * move initial indent parsing to flow constructs themselves --- src/compiler.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/compiler.rs') diff --git a/src/compiler.rs b/src/compiler.rs index 59fcd22..366dcd9 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -108,7 +108,6 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::AutolinkMarker | TokenType::AutolinkProtocol | TokenType::BlankLineEnding - | TokenType::BlankLineWhitespace | TokenType::CharacterEscape | TokenType::CharacterEscapeMarker | TokenType::CharacterEscapeValue @@ -118,10 +117,8 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::CharacterReferenceMarkerNumeric | TokenType::CharacterReferenceMarkerSemi | TokenType::CharacterReferenceValue - | TokenType::CodeIndentedPrefixWhitespace | TokenType::CodeFencedFence | TokenType::CodeFencedFenceSequence - | TokenType::CodeFencedFenceWhitespace | TokenType::CodeFlowChunk | TokenType::CodeTextData | TokenType::CodeTextLineEnding @@ -153,7 +150,6 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::LineEnding | TokenType::ThematicBreak | TokenType::ThematicBreakSequence - | TokenType::ThematicBreakWhitespace | TokenType::Whitespace => { // Ignore. } @@ -172,7 +168,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St TokenType::CodeFenced => { code_flow_seen_data = Some(false); line_ending_if_needed(buffers); - // Note: no `>`, which is added later. + // Note that no `>` is used, which is added later. buf_tail_mut(buffers).push("
 St
                 TokenType::Autolink
                 | TokenType::AutolinkMarker
                 | TokenType::BlankLineEnding
-                | TokenType::BlankLineWhitespace
                 | TokenType::CharacterEscape
                 | TokenType::CharacterEscapeMarker
                 | TokenType::CharacterReference
                 | TokenType::CharacterReferenceMarkerSemi
                 | TokenType::CodeFencedFenceSequence
-                | TokenType::CodeFencedFenceWhitespace
-                | TokenType::CodeIndentedPrefixWhitespace
                 | TokenType::CodeTextSequence
                 | TokenType::DefinitionLabel
                 | TokenType::DefinitionLabelMarker
@@ -228,7 +221,6 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
                 | TokenType::HardBreakTrailingSpace
                 | TokenType::HeadingSetext
                 | TokenType::ThematicBreakSequence
-                | TokenType::ThematicBreakWhitespace
                 | TokenType::Whitespace => {
                     // Ignore.
                 }
-- 
cgit