summaryrefslogtreecommitdiff
path: root/src/syntax
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2022-02-21 13:48:21 +0100
committerMartin Haug <mhaug@live.de>2022-02-21 13:48:21 +0100
commitaac3afcba8ee9b3692f784c78626aa0596aaf612 (patch)
tree1350fadea7f619503342b2c7a6e9a44d86e83f66 /src/syntax
parent61761604e431cbb1f0bc66671e90c20aa19f98b4 (diff)
Remove `Parbreak` as a `NodeKind`
Diffstat (limited to 'src/syntax')
-rw-r--r--src/syntax/ast.rs2
-rw-r--r--src/syntax/highlight.rs1
-rw-r--r--src/syntax/mod.rs7
3 files changed, 2 insertions, 8 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index 9d22121b..7992f9de 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -60,9 +60,9 @@ impl Markup {
/// The markup nodes.
pub fn nodes(&self) -> impl Iterator<Item = MarkupNode> + '_ {
self.0.children().filter_map(|node| match node.kind() {
+ NodeKind::Space(n) if *n > 1 => Some(MarkupNode::Parbreak),
NodeKind::Space(_) => Some(MarkupNode::Space),
NodeKind::Linebreak => Some(MarkupNode::Linebreak),
- NodeKind::Parbreak => Some(MarkupNode::Parbreak),
NodeKind::Text(s) | NodeKind::TextInLine(s) => {
Some(MarkupNode::Text(s.clone()))
}
diff --git a/src/syntax/highlight.rs b/src/syntax/highlight.rs
index af6fb0df..82f1ea0e 100644
--- a/src/syntax/highlight.rs
+++ b/src/syntax/highlight.rs
@@ -198,7 +198,6 @@ impl Category {
NodeKind::Underscore => None,
NodeKind::Markup(_) => None,
NodeKind::Space(_) => None,
- NodeKind::Parbreak => None,
NodeKind::Text(_) => None,
NodeKind::TextInLine(_) => None,
NodeKind::List => None,
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index c702199e..2211fcb6 100644
--- a/src/syntax/mod.rs
+++ b/src/syntax/mod.rs
@@ -589,8 +589,6 @@ pub enum NodeKind {
Space(usize),
/// A forced line break: `\`.
Linebreak,
- /// A paragraph break: Two or more newlines.
- Parbreak,
/// A consecutive non-markup string.
Text(EcoString),
/// A text node that cannot appear at the beginning of a source line.
@@ -760,7 +758,6 @@ impl NodeKind {
pub fn is_at_start(&self, prev: bool) -> bool {
match self {
Self::Space(n) if *n > 0 => true,
- Self::Parbreak => true,
Self::LineComment | Self::BlockComment => prev,
_ => false,
}
@@ -771,7 +768,6 @@ impl NodeKind {
match self {
Self::Markup(_)
| Self::Linebreak
- | Self::Parbreak
| Self::Text(_)
| Self::TextInLine(_)
| Self::NonBreakingSpace
@@ -862,9 +858,9 @@ impl NodeKind {
Self::Include => "keyword `include`",
Self::From => "keyword `from`",
Self::Markup(_) => "markup",
+ Self::Space(n) if *n > 1 => "paragraph break",
Self::Space(_) => "space",
Self::Linebreak => "forced linebreak",
- Self::Parbreak => "paragraph break",
Self::Text(_) | Self::TextInLine(_) => "text",
Self::NonBreakingSpace => "non-breaking space",
Self::EnDash => "en dash",
@@ -988,7 +984,6 @@ impl Hash for NodeKind {
Self::Markup(c) => c.hash(state),
Self::Space(n) => n.hash(state),
Self::Linebreak => {}
- Self::Parbreak => {}
Self::Text(s) => s.hash(state),
Self::TextInLine(s) => s.hash(state),
Self::NonBreakingSpace => {}