summaryrefslogtreecommitdiff
path: root/src/syntax/ast.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-01-28 23:36:27 +0100
committerLaurenz <laurmaedje@gmail.com>2023-01-28 23:38:03 +0100
commit1e97d5c8cbeb96d35e5a34a8340c4ec1860fa1b6 (patch)
treeaa4a341af10dc0729132a42cdb1cacb1e1d21518 /src/syntax/ast.rs
parent76048a8ef45ac5892235f2e69cb7cb6c35a037e4 (diff)
Better analysis for literals
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 {