aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/grammar/expressions
diff options
context:
space:
mode:
authorDJMcNab <[email protected]>2018-12-19 20:02:37 +0000
committerDJMcNab <[email protected]>2018-12-19 20:12:18 +0000
commitdef0a95d357f334b7329c3ee9e7da3c30563321c (patch)
tree972b6071caf13fd608a7ac3091f2158cfbadadcf /crates/ra_syntax/src/grammar/expressions
parent4dce66ad319cbcbfae5f9e941b80c28cf546590c (diff)
Revert "Revert to f6f7c5"
This approach is correct, but it needs an addition to Restrictions too This reverts commit ad00d0c8a5f64142e6636e8b048204c8f8982f4a.
Diffstat (limited to 'crates/ra_syntax/src/grammar/expressions')
-rw-r--r--crates/ra_syntax/src/grammar/expressions/atom.rs16
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
62const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; 62const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
63 63
64pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMarker> { 64pub(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