From aac3afcba8ee9b3692f784c78626aa0596aaf612 Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Mon, 21 Feb 2022 13:48:21 +0100 Subject: Remove `Parbreak` as a `NodeKind` --- src/syntax/mod.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/syntax/mod.rs') 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 => {} -- cgit v1.2.3 From 4c8634c600ad0bba03ccdf884b32f234ecbff30c Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Wed, 23 Feb 2022 13:57:15 +0100 Subject: Early stop for falling indents. Fix code edits and at_start handling. Also fix dedenting for multi-byte chars in raw blocks. --- src/syntax/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/syntax/mod.rs') diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 2211fcb6..fc98bb34 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -758,7 +758,7 @@ impl NodeKind { pub fn is_at_start(&self, prev: bool) -> bool { match self { Self::Space(n) if *n > 0 => true, - Self::LineComment | Self::BlockComment => prev, + Self::Space(_) | Self::LineComment | Self::BlockComment => prev, _ => false, } } -- cgit v1.2.3 From 9fda623b02b2a0a9e9cdf806d9945d0759c8bf01 Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Wed, 23 Feb 2022 20:06:48 +0100 Subject: Code Review: That's just like your struct, man. --- src/syntax/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/syntax/mod.rs') diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index fc98bb34..85f2013c 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -757,7 +757,7 @@ impl NodeKind { /// Whether this node is `at_start` given the previous value of the property. pub fn is_at_start(&self, prev: bool) -> bool { match self { - Self::Space(n) if *n > 0 => true, + Self::Space(1 ..) => true, Self::Space(_) | Self::LineComment | Self::BlockComment => prev, _ => false, } @@ -858,7 +858,7 @@ impl NodeKind { Self::Include => "keyword `include`", Self::From => "keyword `from`", Self::Markup(_) => "markup", - Self::Space(n) if *n > 1 => "paragraph break", + Self::Space(2 ..) => "paragraph break", Self::Space(_) => "space", Self::Linebreak => "forced linebreak", Self::Text(_) | Self::TextInLine(_) => "text", -- cgit v1.2.3