diff options
author | Zac Pullar-Strecker <[email protected]> | 2020-08-24 10:19:53 +0100 |
---|---|---|
committer | Zac Pullar-Strecker <[email protected]> | 2020-08-24 10:20:13 +0100 |
commit | 7bbca7a1b3f9293d2f5cc5745199bc5f8396f2f0 (patch) | |
tree | bdb47765991cb973b2cd5481a088fac636bd326c /crates/ra_parser/src/grammar/items/consts.rs | |
parent | ca464650eeaca6195891199a93f4f76cf3e7e697 (diff) | |
parent | e65d48d1fb3d4d91d9dc1148a7a836ff5c9a3c87 (diff) |
Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links
Diffstat (limited to 'crates/ra_parser/src/grammar/items/consts.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/items/consts.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/ra_parser/src/grammar/items/consts.rs deleted file mode 100644 index 35ad766dc..000000000 --- a/crates/ra_parser/src/grammar/items/consts.rs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | //! FIXME: write short doc here | ||
2 | |||
3 | use super::*; | ||
4 | |||
5 | pub(super) fn static_def(p: &mut Parser, m: Marker) { | ||
6 | const_or_static(p, m, T![static], STATIC) | ||
7 | } | ||
8 | |||
9 | pub(super) fn const_def(p: &mut Parser, m: Marker) { | ||
10 | const_or_static(p, m, T![const], CONST) | ||
11 | } | ||
12 | |||
13 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | ||
14 | assert!(p.at(kw)); | ||
15 | p.bump(kw); | ||
16 | p.eat(T![mut]); // FIXME: validator to forbid const mut | ||
17 | |||
18 | // Allow `_` in place of an identifier in a `const`. | ||
19 | let is_const_underscore = kw == T![const] && p.eat(T![_]); | ||
20 | if !is_const_underscore { | ||
21 | name(p); | ||
22 | } | ||
23 | |||
24 | // test_err static_underscore | ||
25 | // static _: i32 = 5; | ||
26 | |||
27 | types::ascription(p); | ||
28 | if p.eat(T![=]) { | ||
29 | expressions::expr(p); | ||
30 | } | ||
31 | p.expect(T![;]); | ||
32 | m.complete(p, def); | ||
33 | } | ||