diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-23 10:37:30 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-23 10:37:30 +0000 |
commit | fd1fcf2c2e90ab04103a6aa9d033ec64dcc8d555 (patch) | |
tree | 31b5facb6a7a24a113e32fd6afa76f326ab8e3a2 /crates/parser/src/grammar/expressions | |
parent | b0d81d98dbc4cea6920793c7e2952a0d38ec543e (diff) | |
parent | bdd8c0b68f097c7d1a65a5b85b94f0a79affa506 (diff) |
Merge #7010
7010: Update ungrammar for const block patterns r=matklad a=Veykril
Fixes #6848
Adds const blocks and const block patterns to the AST and parses them.
Blocked on https://github.com/rust-analyzer/ungrammar/pull/17/, will merge that PR there once this one gets the OK so I can remove the local ungrammar dependency path and fix the Cargo.lock.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/parser/src/grammar/expressions')
-rw-r--r-- | crates/parser/src/grammar/expressions/atom.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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 = | |||
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() { |