feat: add expr_for_loop to make in syntax

This commit is contained in:
Luiz Carlos Mourão Paes de Carvalho 2021-03-09 23:54:35 -03:00
parent eea21490e0
commit 61fb16577b

View File

@ -222,6 +222,9 @@ pub fn expr_if(
};
expr_from_text(&format!("if {} {} {}", condition, then_branch, else_branch))
}
pub fn expr_for_loop(pat: ast::Pat, expr: ast::Expr, block: ast::BlockExpr) -> ast::Expr {
expr_from_text(&format!("for {} in {} {}", pat, expr, block))
}
pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
let token = token(op);
expr_from_text(&format!("{}{}", token, expr))