diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-03-11 12:59:55 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-03-11 23:36:06 +0100 |
| commit | 5ac7eb3860ebd3247f6486c227e816894cb8fd91 (patch) | |
| tree | a29a868c681c7de39f15f2d9d3f031db1861b90a /src/syntax/mod.rs | |
| parent | 5ce2a006b6d45d29be15e4562ae3ab4fc1b8e97c (diff) | |
Rename template to content
Diffstat (limited to 'src/syntax/mod.rs')
| -rw-r--r-- | src/syntax/mod.rs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index a3393eda..e15cfabc 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -579,9 +579,9 @@ pub enum NodeKind { From, /// The `as` keyword. As, - /// Template markup of which all lines must start in some column. + /// Markup of which all lines must start in some column. /// - /// Notably, the usize does not determine in which column the markup + /// Notably, the number does not determine in which column the markup /// started, but to the right of which column all markup elements must be, /// so it is zero except for headings and lists. Markup(usize), @@ -644,8 +644,8 @@ pub enum NodeKind { Str(EcoString), /// A code block: `{ let x = 1; x + 2 }`. CodeBlock, - /// A template block: `[*Hi* there!]`. - TemplateBlock, + /// A content block: `[*Hi* there!]`. + ContentBlock, /// A grouped expression: `(1 + 2)`. GroupExpr, /// An array expression: `(1, "hi", 12cm)`. @@ -763,8 +763,16 @@ impl NodeKind { } } + /// Whether this node has to appear at the start of a line. + pub fn only_at_start(&self) -> bool { + match self { + Self::Heading | Self::Enum | Self::List => true, + _ => false, + } + } + /// Which mode this node can appear in, in both if `None`. - pub fn mode(&self) -> Option<TokenMode> { + pub fn only_in_mode(&self) -> Option<TokenMode> { match self { Self::Markup(_) | Self::Linebreak @@ -782,7 +790,7 @@ impl NodeKind { | Self::List | Self::Raw(_) | Self::Math(_) => Some(TokenMode::Markup), - Self::TemplateBlock + Self::ContentBlock | Self::Space(_) | Self::Ident(_) | Self::CodeBlock @@ -884,7 +892,7 @@ impl NodeKind { Self::Fraction(_) => "`fr` value", Self::Str(_) => "string", Self::CodeBlock => "code block", - Self::TemplateBlock => "template block", + Self::ContentBlock => "content block", Self::GroupExpr => "group", Self::ArrayExpr => "array", Self::DictExpr => "dictionary", @@ -1008,7 +1016,7 @@ impl Hash for NodeKind { Self::Fraction(v) => v.to_bits().hash(state), Self::Str(v) => v.hash(state), Self::CodeBlock => {} - Self::TemplateBlock => {} + Self::ContentBlock => {} Self::GroupExpr => {} Self::ArrayExpr => {} Self::DictExpr => {} |
