From 84cdc85ca7494368e7ce2039fcef06ac2d3bd2ed Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 17 Feb 2021 23:07:28 +0100 Subject: =?UTF-8?q?Refresh=20parser=20=F0=9F=8C=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/expr.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/syntax/expr.rs') 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. -- cgit v1.2.3