diff options
author | DJMcNab <[email protected]> | 2018-12-18 22:59:34 +0000 |
---|---|---|
committer | DJMcNab <[email protected]> | 2018-12-19 20:12:18 +0000 |
commit | 97e70bf50f15007f5782f7f96d19da342b7c9505 (patch) | |
tree | 081f401eb9fb1d5a9d2563f9ffca5e6871edd69a /crates/ra_syntax/src/grammar/expressions | |
parent | 29bf389034db9a0de4ec2dbd7492c1f75caf4a60 (diff) |
Possibly fix #225
Diffstat (limited to 'crates/ra_syntax/src/grammar/expressions')
-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 04087fd60..e86a33090 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 |