aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-13 17:28:23 +0100
committerAleksey Kladov <[email protected]>2020-08-13 17:50:21 +0100
commitef462ed6af7ae8e0d30894baefe6ba1ff49aab8f (patch)
tree1ee2aaf3f2b3ae4901ddd03985b5d217d1521612
parent0e1cda3079eb9936dcf8acec3e47bad48c5ccc58 (diff)
Better recovery in `use foo::;`
-rw-r--r--crates/parser/src/grammar/items.rs16
-rw-r--r--crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast8
2 files changed, 17 insertions, 7 deletions
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index b2f7cc21f..8fd8f3b80 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -27,8 +27,20 @@ pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) {
27} 27}
28 28
29pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![ 29pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![
30 FN_KW, STRUCT_KW, ENUM_KW, IMPL_KW, TRAIT_KW, CONST_KW, STATIC_KW, LET_KW, MOD_KW, PUB_KW, 30 FN_KW,
31 CRATE_KW, USE_KW, MACRO_KW 31 STRUCT_KW,
32 ENUM_KW,
33 IMPL_KW,
34 TRAIT_KW,
35 CONST_KW,
36 STATIC_KW,
37 LET_KW,
38 MOD_KW,
39 PUB_KW,
40 CRATE_KW,
41 USE_KW,
42 MACRO_KW,
43 T![;],
32]; 44];
33 45
34pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool) { 46pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool) {
diff --git a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast
index 2f59d0606..e872526d9 100644
--- a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast
+++ b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast
@@ -2,14 +2,12 @@ [email protected]
2 [email protected] 2 [email protected]
3 [email protected] "use" 3 [email protected] "use"
4 [email protected] " " 4 [email protected] " "
5 [email protected]2 5 [email protected]1
6 [email protected]2 6 [email protected]1
7 [email protected] 7 [email protected]
8 [email protected] 8 [email protected]
9 [email protected] "crate" 9 [email protected] "crate"
10 [email protected] "::" 10 [email protected] "::"
11 [email protected] 11 [email protected] ";"
12 [email protected] ";"
13 [email protected] "\n" 12 [email protected] "\n"
14error 11..11: expected identifier 13error 11..11: expected identifier
15error 12..12: expected SEMICOLON