diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-03 17:56:56 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-03 17:56:56 +0200 |
| commit | 91d14d2a221f619738e4534c1b4266633ce5789d (patch) | |
| tree | c10b288b9473153fede116204cc861c89dad71a1 /src/eval/value.rs | |
| parent | 95bae5725cf6495644e2593f8492f1cd0e5bd3c1 (diff) | |
Evaluate expressions 🧮
Diffstat (limited to 'src/eval/value.rs')
| -rw-r--r-- | src/eval/value.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs index 51bc55ab..85ac2367 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -17,6 +17,8 @@ use crate::{DynFuture, Feedback, Pass}; /// A computational value. #[derive(Clone, PartialEq)] pub enum Value { + /// The result of invalid operations. + Error, /// An identifier: `ident`. Ident(Ident), /// A boolean: `true, false`. @@ -54,6 +56,7 @@ impl Value { /// The natural-language name of this value for use in error messages. pub fn name(&self) -> &'static str { match self { + Self::Error => "error", Self::Ident(_) => "identifier", Self::Bool(_) => "bool", Self::Int(_) => "integer", @@ -111,6 +114,7 @@ impl Spanned<Value> { impl Debug for Value { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self { + Self::Error => f.pad("<error>"), Self::Ident(i) => i.fmt(f), Self::Bool(b) => b.fmt(f), Self::Int(i) => i.fmt(f), |
