From 2c94c4964aa6242098f97ca3421a750a763567b4 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 23 Dec 2020 02:15:30 +0100 Subject: Parse const effect block --- crates/parser/src/grammar/expressions/atom.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/parser/src/grammar/expressions') diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index e897d5a52..c7a3556a7 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs @@ -46,6 +46,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = T![continue], T![async], T![try], + T![const], T![loop], T![for], LIFETIME_IDENT, @@ -115,6 +116,14 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar block_expr(p); m.complete(p, EFFECT_EXPR) } + // test const_block + // fn f() { const { } } + T![const] if la == T!['{'] => { + let m = p.start(); + p.bump(T![const]); + block_expr(p); + m.complete(p, EFFECT_EXPR) + } T!['{'] => { // test for_range_from // fn foo() { -- cgit v1.2.3