Better recovery in use foo::;

This commit is contained in:
Aleksey Kladov 2020-08-13 18:28:23 +02:00
parent 0e1cda3079
commit ef462ed6af
2 changed files with 17 additions and 7 deletions

View file

@ -27,8 +27,20 @@ pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) {
} }
pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![ pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![
FN_KW, STRUCT_KW, ENUM_KW, IMPL_KW, TRAIT_KW, CONST_KW, STATIC_KW, LET_KW, MOD_KW, PUB_KW, FN_KW,
CRATE_KW, USE_KW, MACRO_KW STRUCT_KW,
ENUM_KW,
IMPL_KW,
TRAIT_KW,
CONST_KW,
STATIC_KW,
LET_KW,
MOD_KW,
PUB_KW,
CRATE_KW,
USE_KW,
MACRO_KW,
T![;],
]; ];
pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool) { pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool) {

View file

@ -2,14 +2,12 @@ SOURCE_FILE@0..13
USE@0..12 USE@0..12
USE_KW@0..3 "use" USE_KW@0..3 "use"
WHITESPACE@3..4 " " WHITESPACE@3..4 " "
USE_TREE@4..12 USE_TREE@4..11
PATH@4..12 PATH@4..11
PATH@4..9 PATH@4..9
PATH_SEGMENT@4..9 PATH_SEGMENT@4..9
CRATE_KW@4..9 "crate" CRATE_KW@4..9 "crate"
COLON2@9..11 "::" COLON2@9..11 "::"
ERROR@11..12
SEMICOLON@11..12 ";" SEMICOLON@11..12 ";"
WHITESPACE@12..13 "\n" WHITESPACE@12..13 "\n"
error 11..11: expected identifier error 11..11: expected identifier
error 12..12: expected SEMICOLON