From 97e70bf50f15007f5782f7f96d19da342b7c9505 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Tue, 18 Dec 2018 22:59:34 +0000 Subject: Possibly fix #225 --- crates/ra_syntax/src/grammar/expressions/atom.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'crates/ra_syntax/src/grammar/expressions') 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![ 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