From 4798a89a12f40af17174a160f6d6a2f1c53db8d6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Sep 2018 15:10:06 +0300 Subject: Complete params --- crates/libsyntax2/src/grammar/patterns.rs | 2 +- crates/libsyntax2/src/grammar/types.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/libsyntax2/src/grammar') diff --git a/crates/libsyntax2/src/grammar/patterns.rs b/crates/libsyntax2/src/grammar/patterns.rs index 065570b99..aa20ae8e4 100644 --- a/crates/libsyntax2/src/grammar/patterns.rs +++ b/crates/libsyntax2/src/grammar/patterns.rs @@ -23,7 +23,7 @@ pub(super) fn pattern(p: &mut Parser) { } const PAT_RECOVERY_SET: TokenSet = - token_set![LET_KW, IF_KW, WHILE_KW, LOOP_KW, MATCH_KW]; + token_set![LET_KW, IF_KW, WHILE_KW, LOOP_KW, MATCH_KW, R_PAREN, COMMA]; fn atom_pat(p: &mut Parser) -> Option { diff --git a/crates/libsyntax2/src/grammar/types.rs b/crates/libsyntax2/src/grammar/types.rs index 89030e66c..a52355b50 100644 --- a/crates/libsyntax2/src/grammar/types.rs +++ b/crates/libsyntax2/src/grammar/types.rs @@ -8,6 +8,9 @@ pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST, ]; +const TYPE_RECOVERY_SET: TokenSet = + token_set![R_PAREN, COMMA]; + pub(super) fn type_(p: &mut Parser) { match p.current() { L_PAREN => paren_or_tuple_type(p), @@ -23,7 +26,7 @@ pub(super) fn type_(p: &mut Parser) { L_ANGLE => path_type(p), _ if paths::is_path_start(p) => path_type(p), _ => { - p.err_and_bump("expected type"); + p.err_recover("expected type", TYPE_RECOVERY_SET); } } } -- cgit v1.2.3