summaryrefslogtreecommitdiff
path: root/src/syntax/ast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax/ast.rs')
-rw-r--r--src/syntax/ast.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index 78d895ff..08def533 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -345,6 +345,20 @@ impl Expr {
_ => false,
}
}
+
+ /// Is this a literal?
+ pub fn is_literal(&self) -> bool {
+ match self {
+ Self::None(_) => true,
+ Self::Auto(_) => true,
+ Self::Bool(_) => true,
+ Self::Int(_) => true,
+ Self::Float(_) => true,
+ Self::Numeric(_) => true,
+ Self::Str(_) => true,
+ _ => false,
+ }
+ }
}
impl Default for Expr {