Skip to content

Commit 45eea57

Browse files
committed
add in-comment test case for use_tree_list_err_recovery
1 parent afe05fe commit 45eea57

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

crates/parser/src/grammar/items/use_item.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ pub(crate) fn use_tree_list(p: &mut Parser<'_>) {
8686
assert!(p.at(T!['{']));
8787
let m = p.start();
8888

89+
// test_err use_tree_list_err_recovery
90+
// use {a;
91+
// use b;
92+
// struct T;
93+
// fn test() {}
8994
delimited(p, T!['{'], T!['}'], T![,], USE_TREE_LIST_RECOVERY_SET, |p: &mut Parser<'_>| {
9095
use_tree(p, false) || p.at_ts(USE_TREE_LIST_RECOVERY_SET)
9196
});
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
SOURCE_FILE
2+
USE
3+
USE_KW "use"
4+
WHITESPACE " "
5+
USE_TREE
6+
USE_TREE_LIST
7+
L_CURLY "{"
8+
USE_TREE
9+
PATH
10+
PATH_SEGMENT
11+
NAME_REF
12+
IDENT "a"
13+
ERROR
14+
SEMICOLON ";"
15+
WHITESPACE "\n"
16+
USE
17+
USE_KW "use"
18+
WHITESPACE " "
19+
USE_TREE
20+
PATH
21+
PATH_SEGMENT
22+
NAME_REF
23+
IDENT "b"
24+
SEMICOLON ";"
25+
WHITESPACE "\n"
26+
STRUCT
27+
STRUCT_KW "struct"
28+
WHITESPACE " "
29+
NAME
30+
IDENT "T"
31+
SEMICOLON ";"
32+
WHITESPACE "\n"
33+
FN
34+
FN_KW "fn"
35+
WHITESPACE " "
36+
NAME
37+
IDENT "test"
38+
PARAM_LIST
39+
L_PAREN "("
40+
R_PAREN ")"
41+
WHITESPACE " "
42+
BLOCK_EXPR
43+
STMT_LIST
44+
L_CURLY "{"
45+
R_CURLY "}"
46+
WHITESPACE "\n"
47+
error 6: expected COMMA
48+
error 6: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
49+
error 7: expected R_CURLY
50+
error 7: expected SEMICOLON
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
use {a;
2+
use b;
3+
struct T;
4+
fn test() {}

0 commit comments

Comments
 (0)