aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-22 14:46:51 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-22 14:46:51 +0200
commit6fdaffb3a8b4517a3b5c1e39dc1e16649c6eb0da (patch)
tree39426778d5a150612059070196d50daadcebfb0e
parent33b69eb9189fb2fd0f731530285baf3ac20c5eb0 (diff)
downloadmarkdown-rs-6fdaffb3a8b4517a3b5c1e39dc1e16649c6eb0da.tar.gz
markdown-rs-6fdaffb3a8b4517a3b5c1e39dc1e16649c6eb0da.tar.bz2
markdown-rs-6fdaffb3a8b4517a3b5c1e39dc1e16649c6eb0da.zip
Rename `Whitespace` token to `SpaceOrTab`
-rw-r--r--readme.md2
-rw-r--r--src/compiler.rs10
-rw-r--r--src/construct/blank_line.rs2
-rw-r--r--src/construct/code_fenced.rs4
-rw-r--r--src/construct/code_indented.rs2
-rw-r--r--src/construct/definition.rs6
-rw-r--r--src/construct/heading_atx.rs6
-rw-r--r--src/construct/heading_setext.rs4
-rw-r--r--src/construct/partial_space_or_tab.rs2
-rw-r--r--src/tokenizer.rs30
10 files changed, 34 insertions, 34 deletions
diff --git a/readme.md b/readme.md
index e01e237..d79169c 100644
--- a/readme.md
+++ b/readme.md
@@ -77,7 +77,7 @@ cargo doc --document-private-items
#### Parse
-- [ ] (1) Parse initial and final whitespace of paragraphs (in text)\
+- [ ] (1) Parse initial and final space_or_tab of paragraphs (in text)\
test (`code_indented`, `hard_break_escape`, `hard_break_trailing`,
`heading_atx`, `heading_setext`, `html_flow`, `misc_soft_break`,
`misc_tabs`, `thematic_break`)
diff --git a/src/compiler.rs b/src/compiler.rs
index e6275f1..cfe749a 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -242,7 +242,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &Options) -> String {
| TokenType::HardBreakTrailingSpace
| TokenType::HeadingAtx
| TokenType::HeadingAtxSequence
- | TokenType::HeadingAtxWhitespace
+ | TokenType::HeadingAtxSpaceOrTab
| TokenType::HeadingSetext
| TokenType::HeadingSetextUnderline
| TokenType::HtmlFlowData
@@ -250,7 +250,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &Options) -> String {
| TokenType::LineEnding
| TokenType::ThematicBreak
| TokenType::ThematicBreakSequence
- | TokenType::Whitespace => {
+ | TokenType::SpaceOrTab => {
// Ignore.
}
TokenType::CodeFencedFenceInfo
@@ -321,7 +321,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &Options) -> String {
| TokenType::HardBreakTrailingSpace
| TokenType::HeadingSetext
| TokenType::ThematicBreakSequence
- | TokenType::Whitespace => {
+ | TokenType::SpaceOrTab => {
// Ignore.
}
// Just output it.
@@ -482,13 +482,13 @@ pub fn compile(events: &[Event], codes: &[Code], options: &Options) -> String {
atx_opening_sequence_size = None;
atx_heading_buffer = None;
}
- // `HeadingAtxWhitespace` is ignored after the opening sequence,
+ // `HeadingAtxSpaceOrTab` is ignored after the opening sequence,
// before the closing sequence, and after the closing sequence.
// But it is used around intermediate sequences.
// `atx_heading_buffer` is set to `Some` by the first `HeadingAtxText`.
// `HeadingAtxSequence` is ignored as the opening and closing sequence,
// but not when intermediate.
- TokenType::HeadingAtxSequence | TokenType::HeadingAtxWhitespace => {
+ TokenType::HeadingAtxSequence | TokenType::HeadingAtxSpaceOrTab => {
if let Some(buf) = atx_heading_buffer {
atx_heading_buffer = Some(
buf.to_string()
diff --git a/src/construct/blank_line.rs b/src/construct/blank_line.rs
index 1fd22fd..153a008 100644
--- a/src/construct/blank_line.rs
+++ b/src/construct/blank_line.rs
@@ -20,7 +20,7 @@
//!
//! ## Tokens
//!
-//! * [`Whitespace`][crate::tokenizer::TokenType::Whitespace]
+//! * [`SpaceOrTab`][crate::tokenizer::TokenType::SpaceOrTab]
//!
//! ## References
//!
diff --git a/src/construct/code_fenced.rs b/src/construct/code_fenced.rs
index 724a0b3..d71c01e 100644
--- a/src/construct/code_fenced.rs
+++ b/src/construct/code_fenced.rs
@@ -84,7 +84,7 @@
//! * [`CodeFencedFenceMeta`][TokenType::CodeFencedFenceMeta]
//! * [`CodeFlowChunk`][TokenType::CodeFlowChunk]
//! * [`LineEnding`][TokenType::LineEnding]
-//! * [`Whitespace`][TokenType::Whitespace]
+//! * [`SpaceOrTab`][TokenType::SpaceOrTab]
//!
//! ## References
//!
@@ -194,7 +194,7 @@ fn before_sequence_open(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult
let mut prefix = 0;
if let Some(event) = tail {
- if event.token_type == TokenType::Whitespace {
+ if event.token_type == TokenType::SpaceOrTab {
let span = from_exit_event(&tokenizer.events, tokenizer.events.len() - 1);
prefix = span.end_index - span.start_index;
}
diff --git a/src/construct/code_indented.rs b/src/construct/code_indented.rs
index a0b543a..f476965 100644
--- a/src/construct/code_indented.rs
+++ b/src/construct/code_indented.rs
@@ -31,7 +31,7 @@
//! * [`CodeIndented`][TokenType::CodeIndented]
//! * [`CodeFlowChunk`][TokenType::CodeFlowChunk]
//! * [`LineEnding`][TokenType::LineEnding]
-//! * [`Whitespace`][TokenType::Whitespace]
+//! * [`SpaceOrTab`][TokenType::SpaceOrTab]
//!
//! ## References
//!
diff --git a/src/construct/definition.rs b/src/construct/definition.rs
index 3dd1fbb..7f32858 100644
--- a/src/construct/definition.rs
+++ b/src/construct/definition.rs
@@ -57,7 +57,7 @@
//! * [`DefinitionTitleMarker`][TokenType::DefinitionTitleMarker]
//! * [`DefinitionTitleString`][TokenType::DefinitionTitleString]
//! * [`LineEnding`][TokenType::LineEnding]
-//! * [`Whitespace`][TokenType::Whitespace]
+//! * [`SpaceOrTab`][TokenType::SpaceOrTab]
//!
//! ## References
//!
@@ -179,7 +179,7 @@ fn destination_before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
let event = tokenizer.events.last().unwrap();
// Whitespace.
- if (event.token_type == TokenType::LineEnding || event.token_type == TokenType::Whitespace)
+ if (event.token_type == TokenType::LineEnding || event.token_type == TokenType::SpaceOrTab)
// Blank line not ok.
&& !matches!(
code,
@@ -291,7 +291,7 @@ fn title_before_after_optional_whitespace(tokenizer: &mut Tokenizer, code: Code)
fn title_before_marker(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
let event = tokenizer.events.last().unwrap();
- if event.token_type == TokenType::LineEnding || event.token_type == TokenType::Whitespace {
+ if event.token_type == TokenType::LineEnding || event.token_type == TokenType::SpaceOrTab {
tokenizer.go(
|t, c| {
title(
diff --git a/src/construct/heading_atx.rs b/src/construct/heading_atx.rs
index 6460235..ae16d3d 100644
--- a/src/construct/heading_atx.rs
+++ b/src/construct/heading_atx.rs
@@ -40,7 +40,7 @@
//! * [`HeadingAtx`][TokenType::HeadingAtx]
//! * [`HeadingAtxSequence`][TokenType::HeadingAtxSequence]
//! * [`HeadingAtxText`][TokenType::HeadingAtxText]
-//! * [`HeadingAtxWhitespace`][TokenType::HeadingAtxWhitespace]
+//! * [`HeadingAtxSpaceOrTab`][TokenType::HeadingAtxSpaceOrTab]
//!
//! ## References
//!
@@ -105,7 +105,7 @@ fn sequence_open(tokenizer: &mut Tokenizer, code: Code, rank: usize) -> StateFnR
_ if rank > 0 => {
tokenizer.exit(TokenType::HeadingAtxSequence);
tokenizer.go(
- space_or_tab(TokenType::HeadingAtxWhitespace, 1, usize::MAX),
+ space_or_tab(TokenType::HeadingAtxSpaceOrTab, 1, usize::MAX),
at_break,
)(tokenizer, code)
}
@@ -129,7 +129,7 @@ fn at_break(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
(State::Ok, Some(vec![code]))
}
Code::VirtualSpace | Code::Char('\t' | ' ') => tokenizer.go(
- space_or_tab(TokenType::HeadingAtxWhitespace, 1, usize::MAX),
+ space_or_tab(TokenType::HeadingAtxSpaceOrTab, 1, usize::MAX),
at_break,
)(tokenizer, code),
Code::Char('#') => {
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs
index 924f840..0cb8687 100644
--- a/src/construct/heading_setext.rs
+++ b/src/construct/heading_setext.rs
@@ -202,7 +202,7 @@ fn text_line_start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
let index = tokenizer.events.len() - 2;
// Link the whitespace, if it exists.
- if tokenizer.events[index].token_type == TokenType::Whitespace {
+ if tokenizer.events[index].token_type == TokenType::SpaceOrTab {
link(&mut tokenizer.events, index);
}
@@ -263,7 +263,7 @@ fn underline_sequence_start(tokenizer: &mut Tokenizer, code: Code) -> StateFnRes
let mut prefix = 0;
if let Some(event) = tail {
- if event.token_type == TokenType::Whitespace {
+ if event.token_type == TokenType::SpaceOrTab {
let span = from_exit_event(&tokenizer.events, tokenizer.events.len() - 1);
prefix = span.end_index - span.start_index;
}
diff --git a/src/construct/partial_space_or_tab.rs b/src/construct/partial_space_or_tab.rs
index 1c4b367..cbb2cf3 100644
--- a/src/construct/partial_space_or_tab.rs
+++ b/src/construct/partial_space_or_tab.rs
@@ -34,7 +34,7 @@ pub fn space_or_tab_opt() -> Box<StateFn> {
/// space_or_tab_min_max ::= x*y( ' ' '\t' )
/// ```
pub fn space_or_tab_min_max(min: usize, max: usize) -> Box<StateFn> {
- space_or_tab(TokenType::Whitespace, min, max)
+ space_or_tab(TokenType::SpaceOrTab, min, max)
}
/// Between `x` and `y` `space_or_tab`, with the given token type.
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 0be740c..e8bf21b 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -292,7 +292,7 @@ pub enum TokenType {
/// [`CodeFencedFence`][TokenType::CodeFencedFence],
/// [`CodeFlowChunk`][TokenType::CodeFlowChunk],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`code_fenced`][crate::construct::code_fenced]
///
@@ -317,7 +317,7 @@ pub enum TokenType {
/// [`CodeFencedFenceInfo`][TokenType::CodeFencedFenceInfo],
/// [`CodeFencedFenceMeta`][TokenType::CodeFencedFenceMeta],
/// [`CodeFencedFenceSequence`][TokenType::CodeFencedFenceSequence],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`code_fenced`][crate::construct::code_fenced]
///
@@ -428,7 +428,7 @@ pub enum TokenType {
/// * **Content model**:
/// [`CodeFlowChunk`][TokenType::CodeFlowChunk],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`code_fenced`][crate::construct::code_fenced]
///
@@ -545,7 +545,7 @@ pub enum TokenType {
/// [`DefinitionDestination`][TokenType::DefinitionDestination],
/// [`DefinitionTitle`][TokenType::DefinitionTitle],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`definition`][crate::construct::definition]
///
@@ -566,7 +566,7 @@ pub enum TokenType {
/// [`DefinitionLabelMarker`][TokenType::DefinitionLabelMarker],
/// [`DefinitionLabelString`][TokenType::DefinitionLabelString],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`partial_label`][crate::construct::partial_label]
///
@@ -738,7 +738,7 @@ pub enum TokenType {
/// [`DefinitionTitleMarker`][TokenType::DefinitionTitleMarker],
/// [`DefinitionTitleString`][TokenType::DefinitionTitleString],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`partial_title`][crate::construct::partial_title]
///
@@ -870,7 +870,7 @@ pub enum TokenType {
/// * **Content model**:
/// [`HeadingAtxSequence`][TokenType::HeadingAtxSequence],
/// [`HeadingAtxText`][TokenType::HeadingAtxText],
- /// [`HeadingAtxWhitespace`][TokenType::HeadingAtxWhitespace]
+ /// [`HeadingAtxSpaceOrTab`][TokenType::HeadingAtxSpaceOrTab]
/// * **Construct**:
/// [`heading_atx`][crate::construct::heading_atx]
///
@@ -918,7 +918,7 @@ pub enum TokenType {
/// ^^^^^
/// ```
HeadingAtxText,
- /// Heading (atx) whitespace.
+ /// Heading (atx) spaces.
///
/// ## Info
///
@@ -935,7 +935,7 @@ pub enum TokenType {
/// > | # alpha
/// ^
/// ```
- HeadingAtxWhitespace,
+ HeadingAtxSpaceOrTab,
/// Whole heading (setext).
///
/// ## Info
@@ -946,7 +946,7 @@ pub enum TokenType {
/// [`HeadingSetextText`][TokenType::HeadingSetextText],
/// [`HeadingSetextUnderline`][TokenType::HeadingSetextUnderline],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`heading_setext`][crate::construct::heading_setext]
///
@@ -1006,7 +1006,7 @@ pub enum TokenType {
/// * **Content model**:
/// [`HtmlFlowData`][TokenType::HtmlFlowData],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`html_flow`][crate::construct::html_flow]
///
@@ -1044,7 +1044,7 @@ pub enum TokenType {
/// * **Content model**:
/// [`HtmlTextData`][TokenType::HtmlTextData],
/// [`LineEnding`][TokenType::LineEnding],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`html_text`][crate::construct::html_text]
///
@@ -1120,7 +1120,7 @@ pub enum TokenType {
/// [flow content][crate::content::flow]
/// * **Content model**:
/// [`ThematicBreakSequence`][TokenType::ThematicBreakSequence],
- /// [`Whitespace`][TokenType::Whitespace]
+ /// [`SpaceOrTab`][TokenType::SpaceOrTab]
/// * **Construct**:
/// [`thematic_break`][crate::construct::thematic_break]
///
@@ -1149,7 +1149,7 @@ pub enum TokenType {
/// ^ ^ ^
/// ```
ThematicBreakSequence,
- /// Whitespace.
+ /// SpaceOrTab.
///
/// ## Info
///
@@ -1166,7 +1166,7 @@ pub enum TokenType {
/// > | ␠* * *␠
/// ^ ^ ^ ^
/// ```
- Whitespace,
+ SpaceOrTab,
/// Chunk (string).
///