summaryrefslogtreecommitdiff
path: root/src/syntax/tree.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-08-04 11:46:04 +0200
committerLaurenz <laurmaedje@gmail.com>2020-08-04 11:46:04 +0200
commited4fdcb0ada909f1cc3d7436334e253f0ec14d55 (patch)
tree2b9abe7a852a060899ce4aa976391fa8dd9d293b /src/syntax/tree.rs
parentdbfb3d2ced91e56314dfabbb4df9a338926c0a7a (diff)
Par nodes 🧳
Diffstat (limited to 'src/syntax/tree.rs')
-rw-r--r--src/syntax/tree.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/syntax/tree.rs b/src/syntax/tree.rs
index 28997e7c..73734d28 100644
--- a/src/syntax/tree.rs
+++ b/src/syntax/tree.rs
@@ -14,20 +14,20 @@ pub type SyntaxTree = SpanVec<SyntaxNode>;
#[derive(Debug, Clone)]
pub enum SyntaxNode {
/// Whitespace containing less than two newlines.
- Space,
- /// Whitespace with more than two newlines.
- Parbreak,
+ Spacing,
/// A forced line break.
Linebreak,
- /// Plain text.
- Text(String),
- /// Lines of raw text.
- Raw(Vec<String>),
/// Italics were enabled / disabled.
ToggleItalic,
/// Bolder was enabled / disabled.
ToggleBolder,
- /// A dynamic node, create through function invocations in source code.
+ /// Plain text.
+ Text(String),
+ /// Lines of raw text.
+ Raw(Vec<String>),
+ /// A paragraph of child nodes.
+ Par(SyntaxTree),
+ /// A dynamic node, created through function invocations in source code.
Dyn(Box<dyn DynamicNode>),
}
@@ -35,13 +35,13 @@ impl PartialEq for SyntaxNode {
fn eq(&self, other: &SyntaxNode) -> bool {
use SyntaxNode::*;
match (self, other) {
- (Space, Space) => true,
- (Parbreak, Parbreak) => true,
+ (Spacing, Spacing) => true,
(Linebreak, Linebreak) => true,
- (Text(a), Text(b)) => a == b,
- (Raw(a), Raw(b)) => a == b,
(ToggleItalic, ToggleItalic) => true,
(ToggleBolder, ToggleBolder) => true,
+ (Text(a), Text(b)) => a == b,
+ (Raw(a), Raw(b)) => a == b,
+ (Par(a), Par(b)) => a == b,
(Dyn(a), Dyn(b)) => a == b,
_ => false,
}