diff options
Diffstat (limited to 'crates/ra_syntax/tests/data/parser')
4 files changed, 152 insertions, 0 deletions
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0126_attr_on_expr_stmt.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0126_attr_on_expr_stmt.rs new file mode 100644 index 000000000..b28c078f9 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0126_attr_on_expr_stmt.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | fn foo() { | ||
2 | #[A] foo(); | ||
3 | #[B] bar!{} | ||
4 | #[C] #[D] {} | ||
5 | #[D] return (); | ||
6 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0126_attr_on_expr_stmt.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0126_attr_on_expr_stmt.txt new file mode 100644 index 000000000..7cd525cc7 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0126_attr_on_expr_stmt.txt | |||
@@ -0,0 +1,88 @@ | |||
1 | SOURCE_FILE@[0; 82) | ||
2 | FN_DEF@[0; 81) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) | ||
9 | R_PAREN@[7; 8) | ||
10 | WHITESPACE@[8; 9) | ||
11 | BLOCK@[9; 81) | ||
12 | L_CURLY@[9; 10) | ||
13 | WHITESPACE@[10; 15) | ||
14 | EXPR_STMT@[15; 26) | ||
15 | ATTR@[15; 19) | ||
16 | POUND@[15; 16) | ||
17 | TOKEN_TREE@[16; 19) | ||
18 | L_BRACK@[16; 17) | ||
19 | IDENT@[17; 18) "A" | ||
20 | R_BRACK@[18; 19) | ||
21 | WHITESPACE@[19; 20) | ||
22 | CALL_EXPR@[20; 25) | ||
23 | PATH_EXPR@[20; 23) | ||
24 | PATH@[20; 23) | ||
25 | PATH_SEGMENT@[20; 23) | ||
26 | NAME_REF@[20; 23) | ||
27 | IDENT@[20; 23) "foo" | ||
28 | ARG_LIST@[23; 25) | ||
29 | L_PAREN@[23; 24) | ||
30 | R_PAREN@[24; 25) | ||
31 | SEMI@[25; 26) | ||
32 | WHITESPACE@[26; 31) | ||
33 | EXPR_STMT@[31; 42) | ||
34 | ATTR@[31; 35) | ||
35 | POUND@[31; 32) | ||
36 | TOKEN_TREE@[32; 35) | ||
37 | L_BRACK@[32; 33) | ||
38 | IDENT@[33; 34) "B" | ||
39 | R_BRACK@[34; 35) | ||
40 | WHITESPACE@[35; 36) | ||
41 | MACRO_CALL@[36; 42) | ||
42 | PATH@[36; 39) | ||
43 | PATH_SEGMENT@[36; 39) | ||
44 | NAME_REF@[36; 39) | ||
45 | IDENT@[36; 39) "bar" | ||
46 | EXCL@[39; 40) | ||
47 | TOKEN_TREE@[40; 42) | ||
48 | L_CURLY@[40; 41) | ||
49 | R_CURLY@[41; 42) | ||
50 | WHITESPACE@[42; 47) | ||
51 | EXPR_STMT@[47; 59) | ||
52 | ATTR@[47; 51) | ||
53 | POUND@[47; 48) | ||
54 | TOKEN_TREE@[48; 51) | ||
55 | L_BRACK@[48; 49) | ||
56 | IDENT@[49; 50) "C" | ||
57 | R_BRACK@[50; 51) | ||
58 | WHITESPACE@[51; 52) | ||
59 | ATTR@[52; 56) | ||
60 | POUND@[52; 53) | ||
61 | TOKEN_TREE@[53; 56) | ||
62 | L_BRACK@[53; 54) | ||
63 | IDENT@[54; 55) "D" | ||
64 | R_BRACK@[55; 56) | ||
65 | WHITESPACE@[56; 57) | ||
66 | BLOCK_EXPR@[57; 59) | ||
67 | BLOCK@[57; 59) | ||
68 | L_CURLY@[57; 58) | ||
69 | R_CURLY@[58; 59) | ||
70 | WHITESPACE@[59; 64) | ||
71 | EXPR_STMT@[64; 79) | ||
72 | ATTR@[64; 68) | ||
73 | POUND@[64; 65) | ||
74 | TOKEN_TREE@[65; 68) | ||
75 | L_BRACK@[65; 66) | ||
76 | IDENT@[66; 67) "D" | ||
77 | R_BRACK@[67; 68) | ||
78 | WHITESPACE@[68; 69) | ||
79 | RETURN_EXPR@[69; 78) | ||
80 | RETURN_KW@[69; 75) | ||
81 | WHITESPACE@[75; 76) | ||
82 | TUPLE_EXPR@[76; 78) | ||
83 | L_PAREN@[76; 77) | ||
84 | R_PAREN@[77; 78) | ||
85 | SEMI@[78; 79) | ||
86 | WHITESPACE@[79; 80) | ||
87 | R_CURLY@[80; 81) | ||
88 | WHITESPACE@[81; 82) | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0127_attr_on_last_expr_in_block.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0127_attr_on_last_expr_in_block.rs new file mode 100644 index 000000000..9c5c8eb36 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0127_attr_on_last_expr_in_block.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn foo() { | ||
2 | { #[A] bar!()? } | ||
3 | #[B] &() | ||
4 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0127_attr_on_last_expr_in_block.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0127_attr_on_last_expr_in_block.txt new file mode 100644 index 000000000..4af64559c --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0127_attr_on_last_expr_in_block.txt | |||
@@ -0,0 +1,54 @@ | |||
1 | SOURCE_FILE@[0; 47) | ||
2 | FN_DEF@[0; 46) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) | ||
9 | R_PAREN@[7; 8) | ||
10 | WHITESPACE@[8; 9) | ||
11 | BLOCK@[9; 46) | ||
12 | L_CURLY@[9; 10) | ||
13 | WHITESPACE@[10; 15) | ||
14 | EXPR_STMT@[15; 31) | ||
15 | BLOCK_EXPR@[15; 31) | ||
16 | BLOCK@[15; 31) | ||
17 | L_CURLY@[15; 16) | ||
18 | WHITESPACE@[16; 17) | ||
19 | TRY_EXPR@[17; 29) | ||
20 | ATTR@[17; 21) | ||
21 | POUND@[17; 18) | ||
22 | TOKEN_TREE@[18; 21) | ||
23 | L_BRACK@[18; 19) | ||
24 | IDENT@[19; 20) "A" | ||
25 | R_BRACK@[20; 21) | ||
26 | WHITESPACE@[21; 22) | ||
27 | MACRO_CALL@[22; 28) | ||
28 | PATH@[22; 25) | ||
29 | PATH_SEGMENT@[22; 25) | ||
30 | NAME_REF@[22; 25) | ||
31 | IDENT@[22; 25) "bar" | ||
32 | EXCL@[25; 26) | ||
33 | TOKEN_TREE@[26; 28) | ||
34 | L_PAREN@[26; 27) | ||
35 | R_PAREN@[27; 28) | ||
36 | QUESTION@[28; 29) | ||
37 | WHITESPACE@[29; 30) | ||
38 | R_CURLY@[30; 31) | ||
39 | WHITESPACE@[31; 36) | ||
40 | REF_EXPR@[36; 44) | ||
41 | ATTR@[36; 40) | ||
42 | POUND@[36; 37) | ||
43 | TOKEN_TREE@[37; 40) | ||
44 | L_BRACK@[37; 38) | ||
45 | IDENT@[38; 39) "B" | ||
46 | R_BRACK@[39; 40) | ||
47 | WHITESPACE@[40; 41) | ||
48 | AMP@[41; 42) | ||
49 | TUPLE_EXPR@[42; 44) | ||
50 | L_PAREN@[42; 43) | ||
51 | R_PAREN@[43; 44) | ||
52 | WHITESPACE@[44; 45) | ||
53 | R_CURLY@[45; 46) | ||
54 | WHITESPACE@[46; 47) | ||