add in-comment test case for use_tree_list_err_recovery

This commit is contained in:
Young-Flash 2024-01-11 19:52:23 +08:00
parent afe05fe1d8
commit 45eea57115
3 changed files with 59 additions and 0 deletions

View File

@ -86,6 +86,11 @@ pub(crate) fn use_tree_list(p: &mut Parser<'_>) {
assert!(p.at(T!['{']));
let m = p.start();
// test_err use_tree_list_err_recovery
// use {a;
// use b;
// struct T;
// fn test() {}
delimited(p, T!['{'], T!['}'], T![,], USE_TREE_LIST_RECOVERY_SET, |p: &mut Parser<'_>| {
use_tree(p, false) || p.at_ts(USE_TREE_LIST_RECOVERY_SET)
});

View File

@ -0,0 +1,50 @@
SOURCE_FILE
USE
USE_KW "use"
WHITESPACE " "
USE_TREE
USE_TREE_LIST
L_CURLY "{"
USE_TREE
PATH
PATH_SEGMENT
NAME_REF
IDENT "a"
ERROR
SEMICOLON ";"
WHITESPACE "\n"
USE
USE_KW "use"
WHITESPACE " "
USE_TREE
PATH
PATH_SEGMENT
NAME_REF
IDENT "b"
SEMICOLON ";"
WHITESPACE "\n"
STRUCT
STRUCT_KW "struct"
WHITESPACE " "
NAME
IDENT "T"
SEMICOLON ";"
WHITESPACE "\n"
FN
FN_KW "fn"
WHITESPACE " "
NAME
IDENT "test"
PARAM_LIST
L_PAREN "("
R_PAREN ")"
WHITESPACE " "
BLOCK_EXPR
STMT_LIST
L_CURLY "{"
R_CURLY "}"
WHITESPACE "\n"
error 6: expected COMMA
error 6: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
error 7: expected R_CURLY
error 7: expected SEMICOLON

View File

@ -0,0 +1,4 @@
use {a;
use b;
struct T;
fn test() {}