Added Param object to Value enum
This commit is contained in:
parent
60527bba91
commit
518ce7b3ad
|
@ -39,13 +39,13 @@ pub struct FunDefinition<'a> {
|
|||
name: &'a str,
|
||||
params: Vec<FunParamDef<'a>>,
|
||||
contents: Vec<Expr<'a>>,
|
||||
return_value: &'a Expr<'a>,
|
||||
return_value: Value<'a>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FunParamDef<'a> {
|
||||
name: &'a str,
|
||||
number: u8,
|
||||
number: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -66,15 +66,25 @@ pub struct VarReference<'a> {
|
|||
pub name: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ParamReference<'a> {
|
||||
pub param_number: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum Value<'a> {
|
||||
Var(VarReference<'a>),
|
||||
Param(ParamReference<'a>),
|
||||
Number(u64),
|
||||
}
|
||||
|
||||
impl<'a> Value<'a> {
|
||||
pub fn unwrap(&self) -> String {
|
||||
match self {
|
||||
Value::Param(e) => {
|
||||
|
||||
},
|
||||
|
||||
Value::Number(e) => {
|
||||
return e.to_string();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue