aboutsummaryrefslogtreecommitdiff
path: root/crates/parser/src/grammar/expressions/atom.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/parser/src/grammar/expressions/atom.rs')
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 18b63feb7..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 =
46 T![continue], 46 T![continue],
47 T![async], 47 T![async],
48 T![try], 48 T![try],
49 T![const],
49 T![loop], 50 T![loop],
50 T![for], 51 T![for],
51 LIFETIME_IDENT, 52 LIFETIME_IDENT,
@@ -115,6 +116,14 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
115 block_expr(p); 116 block_expr(p);
116 m.complete(p, EFFECT_EXPR) 117 m.complete(p, EFFECT_EXPR)
117 } 118 }
119 // test const_block
120 // fn f() { const { } }
121 T![const] if la == T!['{'] => {
122 let m = p.start();
123 p.bump(T![const]);
124 block_expr(p);
125 m.complete(p, EFFECT_EXPR)
126 }
118 T!['{'] => { 127 T!['{'] => {
119 // test for_range_from 128 // test for_range_from
120 // fn foo() { 129 // fn foo() {
@@ -156,11 +165,13 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker {
156 let mut saw_expr = false; 165 let mut saw_expr = false;
157 while !p.at(EOF) && !p.at(T![')']) { 166 while !p.at(EOF) && !p.at(T![')']) {
158 saw_expr = true; 167 saw_expr = true;
159 if !p.at_ts(EXPR_FIRST) { 168
160 p.error("expected expression"); 169 // test tuple_attrs
170 // const A: (i64, i64) = (1, #[cfg(test)] 2);
171 if !expr_with_attrs(p) {
161 break; 172 break;
162 } 173 }
163 expr(p); 174
164 if !p.at(T![')']) { 175 if !p.at(T![')']) {
165 saw_comma = true; 176 saw_comma = true;
166 p.expect(T![,]); 177 p.expect(T![,]);