diff options
Diffstat (limited to 'crates/ra_syntax/src/grammar/expressions/atom.rs')
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions/atom.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 452e91485..471f398f5 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs | |||
@@ -61,12 +61,16 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = token_set_union![ | |||
61 | 61 | ||
62 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; | 62 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; |
63 | 63 | ||
64 | pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMarker> { | 64 | pub(super) fn atom_expr( |
65 | p: &mut Parser, | ||
66 | r: Restrictions, | ||
67 | ) -> (Option<CompletedMarker>, Option<BlockLike>) { | ||
65 | if let Some(m) = literal(p) { | 68 | if let Some(m) = literal(p) { |
66 | return Some(m); | 69 | return (Some(m), None); |
67 | } | 70 | } |
68 | if paths::is_path_start(p) || p.at(L_ANGLE) { | 71 | if paths::is_path_start(p) || p.at(L_ANGLE) { |
69 | return Some(path_expr(p, r)); | 72 | let path_expr = path_expr(p, r); |
73 | return (Some(path_expr.0), path_expr.1); | ||
70 | } | 74 | } |
71 | let la = p.nth(1); | 75 | let la = p.nth(1); |
72 | let done = match p.current() { | 76 | let done = match p.current() { |
@@ -94,7 +98,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMark | |||
94 | // } | 98 | // } |
95 | p.error("expected a loop"); | 99 | p.error("expected a loop"); |
96 | m.complete(p, ERROR); | 100 | m.complete(p, ERROR); |
97 | return None; | 101 | return (None, None); |
98 | } | 102 | } |
99 | } | 103 | } |
100 | } | 104 | } |
@@ -111,10 +115,10 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMark | |||
111 | BREAK_KW => break_expr(p), | 115 | BREAK_KW => break_expr(p), |
112 | _ => { | 116 | _ => { |
113 | p.err_recover("expected expression", EXPR_RECOVERY_SET); | 117 | p.err_recover("expected expression", EXPR_RECOVERY_SET); |
114 | return None; | 118 | return (None, None); |
115 | } | 119 | } |
116 | }; | 120 | }; |
117 | Some(done) | 121 | (Some(done), None) |
118 | } | 122 | } |
119 | 123 | ||
120 | // test tuple_expr | 124 | // test tuple_expr |