summaryrefslogtreecommitdiff
path: root/src/syntax/expr.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-17 23:07:28 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-18 15:06:00 +0100
commit84cdc85ca7494368e7ce2039fcef06ac2d3bd2ed (patch)
tree4820cfbd853fd3e98953f3a23aa398f29761ab53 /src/syntax/expr.rs
parente143fd36efaabfcfb42823fe5f7a25dd6de4a960 (diff)
Refresh parser 🌊
Diffstat (limited to 'src/syntax/expr.rs')
-rw-r--r--src/syntax/expr.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs
index d18d3404..5b37bb56 100644
--- a/src/syntax/expr.rs
+++ b/src/syntax/expr.rs
@@ -54,6 +54,17 @@ impl Expr {
Self::For(v) => v.span,
}
}
+
+ /// Whether the expression can be shorten in markup with a hashtag.
+ pub fn has_short_form(&self) -> bool {
+ matches!(self,
+ Expr::Ident(_)
+ | Expr::Call(_)
+ | Expr::Let(_)
+ | Expr::If(_)
+ | Expr::For(_)
+ )
+ }
}
/// A literal.