Fix ', add if and = along with bools
This commit is contained in:
@@ -1,15 +1,23 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum Form {
|
||||
Nil,
|
||||
Int(i32),
|
||||
Bool(bool),
|
||||
Symbol(String),
|
||||
Pair(Rc<Form>,Rc<Form>),
|
||||
DeriComb { se: Rc<Form>, de: Option<String>, params: Rc<Form>, body: Rc<Form> },
|
||||
PrimComb(String, fn(Rc<Form>, Rc<Form>) -> Rc<Form>),
|
||||
Nil,
|
||||
DeriComb { se: Rc<Form>, de: Option<String>, params: Rc<Form>, body: Rc<Form> },
|
||||
}
|
||||
impl Form {
|
||||
pub fn truthy(&self) -> bool {
|
||||
match self {
|
||||
Form::Bool(b) => *b,
|
||||
Form::Nil => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
pub fn int(&self) -> Option<i32> {
|
||||
match self {
|
||||
Form::Int(i) => Some(*i),
|
||||
|
||||
Reference in New Issue
Block a user