Starting work on more complicated call expressions
Probably won't build yet
This commit is contained in:
parent
e9fd20bfe5
commit
fa1257e2cd
@ -125,7 +125,7 @@ pub enum ExpressionKind {
|
|||||||
},
|
},
|
||||||
Call {
|
Call {
|
||||||
f: Box<Meta<Expression>>,
|
f: Box<Meta<Expression>>,
|
||||||
arguments: Vec<Meta<Expression>>,
|
arguments: Vec<Meta<InvocationArgument>>,
|
||||||
},
|
},
|
||||||
Index {
|
Index {
|
||||||
indexee: Box<Meta<Expression>>,
|
indexee: Box<Meta<Expression>>,
|
||||||
@ -151,6 +151,16 @@ pub enum ExpressionKind {
|
|||||||
ListLiteral(Vec<Meta<Expression>>),
|
ListLiteral(Vec<Meta<Expression>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
|
pub enum InvocationArgument {
|
||||||
|
Positional(Expression),
|
||||||
|
Keyword {
|
||||||
|
name: Rc<String>,
|
||||||
|
expr: Expression,
|
||||||
|
},
|
||||||
|
Ignored
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum Discriminator {
|
pub enum Discriminator {
|
||||||
Simple(Expression),
|
Simple(Expression),
|
||||||
|
@ -69,8 +69,9 @@
|
|||||||
//! precedence_expr := prefix_expr
|
//! precedence_expr := prefix_expr
|
||||||
//! prefix_expr := prefix_op call_expr
|
//! prefix_expr := prefix_op call_expr
|
||||||
//! prefix_op := "+" | "-" | "!" | "~"
|
//! prefix_op := "+" | "-" | "!" | "~"
|
||||||
//! call_expr := index_expr ( "(" expr_list ")" )* | ε
|
//! call_expr := index_expr ( "(" invocation_list ")" )* | ε
|
||||||
//! expr_list := expression ("," expression)* | ε
|
//! invocation_list := invocation_argument ("," invocation_argument)* | ε
|
||||||
|
//! invocation_argument := expression | IDENTIFIER "=" expression | "_"
|
||||||
//! index_expr := primary ( "[" (expression ("," (expression)* | ε) "]" )*
|
//! index_expr := primary ( "[" (expression ("," (expression)* | ε) "]" )*
|
||||||
//! primary := literal | paren_expr | if_expr | for_expr | while_expr | identifier_expr | lambda_expr | anonymous_struct | list_expr
|
//! primary := literal | paren_expr | if_expr | for_expr | while_expr | identifier_expr | lambda_expr | anonymous_struct | list_expr
|
||||||
//! expr_or_block := "{" (statement delimiter)* "}" | expr
|
//! expr_or_block := "{" (statement delimiter)* "}" | expr
|
||||||
@ -627,6 +628,11 @@ impl Parser {
|
|||||||
Ok(expr)
|
Ok(expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[recursive_descent_method]
|
||||||
|
fn invocation_argument(&mut self) -> ParseResult<InvocationExpression> {
|
||||||
|
panic!()
|
||||||
|
}
|
||||||
|
|
||||||
#[recursive_descent_method]
|
#[recursive_descent_method]
|
||||||
fn index_expr(&mut self) -> ParseResult<Expression> {
|
fn index_expr(&mut self) -> ParseResult<Expression> {
|
||||||
let primary = self.primary()?;
|
let primary = self.primary()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user