summaryrefslogtreecommitdiff
path: root/src/syntax/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-23 23:58:05 +0100
committerGitHub <noreply@github.com>2022-02-23 23:58:05 +0100
commit90132b0d658f1b2a5df75eb458150e6782b2c30c (patch)
treeb4c237b22b31a6f965849fd7b540c7aec364ef96 /src/syntax/mod.rs
parentf2f473a81fde9c09e0f361f1b85fb5c14337f360 (diff)
parent9fda623b02b2a0a9e9cdf806d9945d0759c8bf01 (diff)
Merge pull request #64 from typst/new-incr-parse
New Incremental Parser
Diffstat (limited to 'src/syntax/mod.rs')
-rw-r--r--src/syntax/mod.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index c702199e..85f2013c 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.
@@ -759,9 +757,8 @@ 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::Parbreak => true,
- Self::LineComment | Self::BlockComment => prev,
+ Self::Space(1 ..) => true,
+ Self::Space(_) | 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(2 ..) => "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 => {}