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