split expression types
This commit is contained in:
parent
3703b65e41
commit
35ada4a21d
|
@ -35,7 +35,10 @@ pub struct Entry {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Expression {
|
pub enum Expression {
|
||||||
Code {
|
Code {
|
||||||
cfe: bool,
|
data: Box<[Expression]>,
|
||||||
|
ret: Option<Box<Expression>>,
|
||||||
|
},
|
||||||
|
CodeCfe {
|
||||||
data: Box<[Expression]>,
|
data: Box<[Expression]>,
|
||||||
ret: Option<Box<Expression>>,
|
ret: Option<Box<Expression>>,
|
||||||
},
|
},
|
||||||
|
@ -47,6 +50,10 @@ pub enum Expression {
|
||||||
obj: Box<Expression>,
|
obj: Box<Expression>,
|
||||||
args: BTreeMap<Box<[Atom]>, (Location, Expression)>,
|
args: BTreeMap<Box<[Atom]>, (Location, Expression)>,
|
||||||
},
|
},
|
||||||
|
Tag {
|
||||||
|
obj: Box<Expression>,
|
||||||
|
args: BTreeMap<Box<[Atom]>, (Location, Expression)>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -201,10 +208,16 @@ impl Expression {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(Expression::Code {
|
Ok(if cfe {
|
||||||
cfe,
|
Expression::CodeCfe {
|
||||||
data: codata.into_boxed_slice(),
|
data: codata.into_boxed_slice(),
|
||||||
ret,
|
ret,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Expression::Code {
|
||||||
|
data: codata.into_boxed_slice(),
|
||||||
|
ret,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Some(&(loc, _)) if cfe => Err(Error {
|
Some(&(loc, _)) if cfe => Err(Error {
|
||||||
|
@ -329,7 +342,7 @@ impl Module {
|
||||||
|
|
||||||
let obj = if ctx.maybe_eat_token(Token::Assign).is_some() {
|
let obj = if ctx.maybe_eat_token(Token::Assign).is_some() {
|
||||||
let obj = Expression::parse_high(ctx)?;
|
let obj = Expression::parse_high(ctx)?;
|
||||||
if let Expression::Code { cfe: true, .. } = obj {
|
if let Expression::CodeCfe { .. } = obj {
|
||||||
flags |= EntryFlags::CTRLFE;
|
flags |= EntryFlags::CTRLFE;
|
||||||
}
|
}
|
||||||
Some(obj)
|
Some(obj)
|
||||||
|
|
Loading…
Reference in a new issue