feat: compile Endor await expressions through the source pipeline
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
use super::Spanned;
|
||||
use crate::Span;
|
||||
pub const AST_SCHEMA_ID: &str =
|
||||
"urn:endor:ast:sha256:ad2ac52943dd26e08395c0d2698861da98bb89c360241c4712c769de86709fd0";
|
||||
"urn:endor:ast:sha256:c7c10c6a61158810fa55044f1aa79f3558ac18ca3be59cbf7f2499b5add8df5b";
|
||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct AstDocument {
|
||||
@@ -234,6 +234,7 @@ pub enum ExprKind {
|
||||
Number(String),
|
||||
String(String),
|
||||
Symbol(Name),
|
||||
Await(Box<Expr>),
|
||||
Unary {
|
||||
operation: UnaryOp,
|
||||
operand: Box<Expr>,
|
||||
|
||||
@@ -316,6 +316,9 @@ pub fn walk_expr_kind<V: Visitor + ?Sized>(
|
||||
ExprKind::Symbol(value) => {
|
||||
visitor.visit_name(value)?;
|
||||
}
|
||||
ExprKind::Await(value) => {
|
||||
visitor.visit_expr(value)?;
|
||||
}
|
||||
ExprKind::Unary {
|
||||
operation, operand, ..
|
||||
} => {
|
||||
|
||||
@@ -146,6 +146,9 @@ peg::parser! {
|
||||
left:(@) star() right:@ { binary(left, BinaryOp::Multiply, right) }
|
||||
left:(@) slash() right:@ { binary(left, BinaryOp::Divide, right) }
|
||||
--
|
||||
start:keyword("await") operand:@ {
|
||||
Expr { span: start.through(operand.span), kind: ExprKind::Await { operand: Box::new(operand) } }
|
||||
}
|
||||
start:minus() operand:@ {
|
||||
Expr { span: start.through(operand.span), kind: ExprKind::Unary { operation: UnaryOp::Negate, operand: Box::new(operand) } }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user