diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/items/nominal.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/items/nominal.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_parser/src/grammar/items/nominal.rs b/crates/ra_parser/src/grammar/items/nominal.rs index ff9b38f9c..a3579eebd 100644 --- a/crates/ra_parser/src/grammar/items/nominal.rs +++ b/crates/ra_parser/src/grammar/items/nominal.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use super::*; | 1 | use super::*; |
2 | 2 | ||
3 | pub(super) fn struct_def(p: &mut Parser, kind: SyntaxKind) { | 3 | pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { |
4 | assert!(p.at(STRUCT_KW) || p.at_contextual_kw("union")); | 4 | assert!(p.at(STRUCT_KW) || p.at_contextual_kw("union")); |
5 | p.bump_remap(kind); | 5 | p.bump_remap(kind); |
6 | 6 | ||
@@ -12,19 +12,16 @@ pub(super) fn struct_def(p: &mut Parser, kind: SyntaxKind) { | |||
12 | match p.current() { | 12 | match p.current() { |
13 | SEMI => { | 13 | SEMI => { |
14 | p.bump(); | 14 | p.bump(); |
15 | return; | ||
16 | } | 15 | } |
17 | L_CURLY => named_field_def_list(p), | 16 | L_CURLY => named_field_def_list(p), |
18 | _ => { | 17 | _ => { |
19 | //TODO: special case `(` error message | 18 | //TODO: special case `(` error message |
20 | p.error("expected `;` or `{`"); | 19 | p.error("expected `;` or `{`"); |
21 | return; | ||
22 | } | 20 | } |
23 | } | 21 | } |
24 | } | 22 | } |
25 | SEMI if kind == STRUCT_KW => { | 23 | SEMI if kind == STRUCT_KW => { |
26 | p.bump(); | 24 | p.bump(); |
27 | return; | ||
28 | } | 25 | } |
29 | L_CURLY => named_field_def_list(p), | 26 | L_CURLY => named_field_def_list(p), |
30 | L_PAREN if kind == STRUCT_KW => { | 27 | L_PAREN if kind == STRUCT_KW => { |
@@ -37,16 +34,15 @@ pub(super) fn struct_def(p: &mut Parser, kind: SyntaxKind) { | |||
37 | } | 34 | } |
38 | _ if kind == STRUCT_KW => { | 35 | _ if kind == STRUCT_KW => { |
39 | p.error("expected `;`, `{`, or `(`"); | 36 | p.error("expected `;`, `{`, or `(`"); |
40 | return; | ||
41 | } | 37 | } |
42 | _ => { | 38 | _ => { |
43 | p.error("expected `{`"); | 39 | p.error("expected `{`"); |
44 | return; | ||
45 | } | 40 | } |
46 | } | 41 | } |
42 | m.complete(p, STRUCT_DEF); | ||
47 | } | 43 | } |
48 | 44 | ||
49 | pub(super) fn enum_def(p: &mut Parser) { | 45 | pub(super) fn enum_def(p: &mut Parser, m: Marker) { |
50 | assert!(p.at(ENUM_KW)); | 46 | assert!(p.at(ENUM_KW)); |
51 | p.bump(); | 47 | p.bump(); |
52 | name_r(p, ITEM_RECOVERY_SET); | 48 | name_r(p, ITEM_RECOVERY_SET); |
@@ -57,6 +53,7 @@ pub(super) fn enum_def(p: &mut Parser) { | |||
57 | } else { | 53 | } else { |
58 | p.error("expected `{`") | 54 | p.error("expected `{`") |
59 | } | 55 | } |
56 | m.complete(p, ENUM_DEF); | ||
60 | } | 57 | } |
61 | 58 | ||
62 | pub(crate) fn enum_variant_list(p: &mut Parser) { | 59 | pub(crate) fn enum_variant_list(p: &mut Parser) { |