aboutsummaryrefslogtreecommitdiff
path: root/crates/parser/src/grammar
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2020-12-20 20:01:36 +0000
committerLukas Wirth <[email protected]>2020-12-20 20:01:36 +0000
commit64caa027b884b3458997318a01e99812e6bb6fca (patch)
tree01ddecdadffd74dae1e2f8f786ea246eb1d730da /crates/parser/src/grammar
parent4be9ed675ed2550e8cb10031fd4c4cfb01d2a2ed (diff)
Parse attributes in tuple expressions
Diffstat (limited to 'crates/parser/src/grammar')
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 18b63feb7..e897d5a52 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -156,11 +156,13 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker {
156 let mut saw_expr = false; 156 let mut saw_expr = false;
157 while !p.at(EOF) && !p.at(T![')']) { 157 while !p.at(EOF) && !p.at(T![')']) {
158 saw_expr = true; 158 saw_expr = true;
159 if !p.at_ts(EXPR_FIRST) { 159
160 p.error("expected expression"); 160 // test tuple_attrs
161 // const A: (i64, i64) = (1, #[cfg(test)] 2);
162 if !expr_with_attrs(p) {
161 break; 163 break;
162 } 164 }
163 expr(p); 165
164 if !p.at(T![')']) { 166 if !p.at(T![')']) {
165 saw_comma = true; 167 saw_comma = true;
166 p.expect(T![,]); 168 p.expect(T![,]);