parse calls

This commit is contained in:
nora 2021-11-02 23:01:20 +01:00
parent 7cba55578a
commit 031217f6c6
2 changed files with 52 additions and 4 deletions

View file

@ -93,6 +93,7 @@ pub enum Expr {
Literal(Literal),
UnaryOp(Box<UnaryOp>),
BinaryOp(Box<BinaryOp>),
Call(Box<Call>),
}
impl Expr {
@ -102,6 +103,7 @@ impl Expr {
Expr::UnaryOp(unary) => unary.span,
Expr::BinaryOp(binary) => binary.span,
Expr::Ident(Ident { span, .. }) => *span,
Expr::Call(call) => call.span,
}
}
}
@ -166,3 +168,16 @@ pub enum BinaryOpKind {
Div,
Mod,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Call {
pub callee: Expr,
pub span: Span,
pub kind: CallKind,
}
#[derive(Debug, Clone, PartialEq)]
pub enum CallKind {
Field(Ident),
Fn(Vec<Expr>),
}