summaryrefslogtreecommitdiff
path: root/src/syntax/ast.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-17 16:24:29 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-17 16:24:29 +0100
commit35b16e545b4fce299edbc00c9a9754179fa51634 (patch)
treeeb1081e55187e59ff6482abc1ac2f1932606ef59 /src/syntax/ast.rs
parentb6202b646a0d5ecced301d9bac8bfcaf977d7ee4 (diff)
Document parameters in comment
Diffstat (limited to 'src/syntax/ast.rs')
-rw-r--r--src/syntax/ast.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index 56d4415e..abbca5ec 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -295,7 +295,7 @@ impl Raw {
self.get().lang.as_ref()
}
- /// Whether the raw block is block-level.
+ /// Whether the raw text should be displayed in a separate block.
pub fn block(&self) -> bool {
self.get().block
}
@@ -425,8 +425,8 @@ impl Math {
self.0.children().filter_map(SyntaxNode::cast)
}
- /// Whether this is a display-level math formula.
- pub fn display(&self) -> bool {
+ /// Whether the formula should be displayed as a separate block.
+ pub fn block(&self) -> bool {
matches!(self.children().next(), Some(MathNode::Space(_)))
&& matches!(self.children().last(), Some(MathNode::Space(_)))
}
@@ -564,8 +564,13 @@ node! {
impl AlignPoint {
/// The number of ampersands.
- pub fn count(&self) -> usize {
- self.0.children().filter(|n| n.kind() == &SyntaxKind::Amp).count()
+ pub fn count(&self) -> NonZeroUsize {
+ self.0
+ .children()
+ .filter(|n| n.kind() == &SyntaxKind::Amp)
+ .count()
+ .try_into()
+ .expect("alignment point is missing ampersand sign")
}
}