changes
This commit is contained in:
parent
9bf1a6b633
commit
18fd6a35d5
|
@ -4,7 +4,7 @@
|
|||
//! 1. (Britain) To do a clumsy or inelegant job, usually as a temporary repair; mend, patch up, repair.
|
||||
//! 2. To work green wood using traditional country methods; to perform the craft of a bodger.
|
||||
//!
|
||||
//! A simple tree-walk interpreter intended for testing purposes.
|
||||
//! To be replaced by VM soon™️ :ferrisClueless:
|
||||
//! A simple silly compiler + VM intended for testing purposes.
|
||||
//! To be replaced by something better soon™️ :ferrisClueless:
|
||||
|
||||
pub mod value;
|
||||
|
|
|
@ -23,9 +23,9 @@ pub enum Value<'s> {
|
|||
Keyword(Str<'s>),
|
||||
Number(OrderedF64),
|
||||
String(Str<'s>),
|
||||
Function(Function<'s>),
|
||||
Function(Rc<Function<'s>>),
|
||||
NativeFun(fn(&'s [Value<'s>]) -> Value<'s>),
|
||||
Macro(Function<'s>),
|
||||
Macro(Rc<Function<'s>>),
|
||||
}
|
||||
|
||||
impl<'s> From<Spanned<Expr<'s>>> for Value<'s> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{fmt::Display, ops::Deref, rc::Rc};
|
||||
use std::{fmt::Display, ops::Deref, rc::Rc, hash::Hash};
|
||||
|
||||
/// A Wisp string type which can hold two variants:
|
||||
/// - Borrowed (usually a reference to source code or built-in literal)
|
||||
|
@ -40,6 +40,12 @@ impl<'a> PartialEq for Str<'a> {
|
|||
|
||||
impl<'a> Eq for Str<'a> {}
|
||||
|
||||
impl<'a> Hash for Str<'a> {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
(**self).hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Display for Str<'a> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
|
|
Loading…
Reference in a new issue