mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-15 18:05:03 +01:00
parse calls
This commit is contained in:
parent
7cba55578a
commit
031217f6c6
2 changed files with 52 additions and 4 deletions
15
src/ast.rs
15
src/ast.rs
|
|
@ -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>),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue