From def0a95d357f334b7329c3ee9e7da3c30563321c Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 19 Dec 2018 20:02:37 +0000 Subject: Revert "Revert to f6f7c5" This approach is correct, but it needs an addition to Restrictions too This reverts commit ad00d0c8a5f64142e6636e8b048204c8f8982f4a. --- crates/ra_syntax/src/grammar/expressions/atom.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'crates/ra_syntax/src/grammar/expressions/atom.rs') 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![ const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; -pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option { +pub(super) fn atom_expr( + p: &mut Parser, + r: Restrictions, +) -> (Option, Option) { if let Some(m) = literal(p) { - return Some(m); + return (Some(m), None); } if paths::is_path_start(p) || p.at(L_ANGLE) { - return Some(path_expr(p, r)); + let path_expr = path_expr(p, r); + return (Some(path_expr.0), path_expr.1); } let la = p.nth(1); let done = match p.current() { @@ -94,7 +98,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option Option break_expr(p), _ => { p.err_recover("expected expression", EXPR_RECOVERY_SET); - return None; + return (None, None); } }; - Some(done) + (Some(done), None) } // test tuple_expr -- cgit v1.2.3