diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-24 10:51:25 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-24 10:51:25 +0100 |
commit | 0194adb651257b69fdf04423b22c69db09fc489c (patch) | |
tree | 2353f8f068962313d0b2748aab58b71c4ca456d2 /crates/ra_syntax/test_data/parser/err | |
parent | bf3030404ef8a161334326bad706f60ee8838f63 (diff) | |
parent | 459241f272748ff2e57b2c7e84f5a04f78d67edb (diff) |
Merge #1585
1585: move syntax tests to unit tests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/err')
65 files changed, 3196 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rs b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rs new file mode 100644 index 000000000..fe5030d89 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | struct S { | ||
2 | a: u32 | ||
3 | b: u32 | ||
4 | } \ No newline at end of file | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.txt b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.txt new file mode 100644 index 000000000..0dbbfe853 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | SOURCE_FILE@[0; 34) | ||
2 | STRUCT_DEF@[0; 34) | ||
3 | STRUCT_KW@[0; 6) "struct" | ||
4 | WHITESPACE@[6; 7) " " | ||
5 | NAME@[7; 8) | ||
6 | IDENT@[7; 8) "S" | ||
7 | WHITESPACE@[8; 9) " " | ||
8 | NAMED_FIELD_DEF_LIST@[9; 34) | ||
9 | L_CURLY@[9; 10) "{" | ||
10 | WHITESPACE@[10; 15) "\n " | ||
11 | NAMED_FIELD_DEF@[15; 21) | ||
12 | NAME@[15; 16) | ||
13 | IDENT@[15; 16) "a" | ||
14 | COLON@[16; 17) ":" | ||
15 | WHITESPACE@[17; 18) " " | ||
16 | PATH_TYPE@[18; 21) | ||
17 | PATH@[18; 21) | ||
18 | PATH_SEGMENT@[18; 21) | ||
19 | NAME_REF@[18; 21) | ||
20 | IDENT@[18; 21) "u32" | ||
21 | WHITESPACE@[21; 26) "\n " | ||
22 | NAMED_FIELD_DEF@[26; 32) | ||
23 | NAME@[26; 27) | ||
24 | IDENT@[26; 27) "b" | ||
25 | COLON@[27; 28) ":" | ||
26 | WHITESPACE@[28; 29) " " | ||
27 | PATH_TYPE@[29; 32) | ||
28 | PATH@[29; 32) | ||
29 | PATH_SEGMENT@[29; 32) | ||
30 | NAME_REF@[29; 32) | ||
31 | IDENT@[29; 32) "u32" | ||
32 | WHITESPACE@[32; 33) "\n" | ||
33 | R_CURLY@[33; 34) "}" | ||
34 | error 21: expected COMMA | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rs b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rs new file mode 100644 index 000000000..98f23de1f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | if match | ||
2 | |||
3 | struct S {} \ No newline at end of file | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.txt b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.txt new file mode 100644 index 000000000..7cfb54ef8 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.txt | |||
@@ -0,0 +1,18 @@ | |||
1 | SOURCE_FILE@[0; 21) | ||
2 | ERROR@[0; 2) | ||
3 | IF_KW@[0; 2) "if" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | ERROR@[3; 8) | ||
6 | MATCH_KW@[3; 8) "match" | ||
7 | WHITESPACE@[8; 10) "\n\n" | ||
8 | STRUCT_DEF@[10; 21) | ||
9 | STRUCT_KW@[10; 16) "struct" | ||
10 | WHITESPACE@[16; 17) " " | ||
11 | NAME@[17; 18) | ||
12 | IDENT@[17; 18) "S" | ||
13 | WHITESPACE@[18; 19) " " | ||
14 | NAMED_FIELD_DEF_LIST@[19; 21) | ||
15 | L_CURLY@[19; 20) "{" | ||
16 | R_CURLY@[20; 21) "}" | ||
17 | error 0: expected an item | ||
18 | error 3: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rs b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rs new file mode 100644 index 000000000..48a3a3980 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/use/bin/env rusti | ||
2 | #!/use/bin/env rusti | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.txt b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.txt new file mode 100644 index 000000000..84867026f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | SOURCE_FILE@[0; 42) | ||
2 | SHEBANG@[0; 20) "#!/use/bin/env rusti" | ||
3 | WHITESPACE@[20; 21) "\n" | ||
4 | ATTR@[21; 23) | ||
5 | POUND@[21; 22) "#" | ||
6 | EXCL@[22; 23) "!" | ||
7 | ERROR@[23; 24) | ||
8 | SLASH@[23; 24) "/" | ||
9 | USE_ITEM@[24; 28) | ||
10 | USE_KW@[24; 27) "use" | ||
11 | ERROR@[27; 28) | ||
12 | SLASH@[27; 28) "/" | ||
13 | MACRO_CALL@[28; 31) | ||
14 | PATH@[28; 31) | ||
15 | PATH_SEGMENT@[28; 31) | ||
16 | NAME_REF@[28; 31) | ||
17 | IDENT@[28; 31) "bin" | ||
18 | ERROR@[31; 32) | ||
19 | SLASH@[31; 32) "/" | ||
20 | MACRO_CALL@[32; 41) | ||
21 | PATH@[32; 35) | ||
22 | PATH_SEGMENT@[32; 35) | ||
23 | NAME_REF@[32; 35) | ||
24 | IDENT@[32; 35) "env" | ||
25 | WHITESPACE@[35; 36) " " | ||
26 | NAME@[36; 41) | ||
27 | IDENT@[36; 41) "rusti" | ||
28 | WHITESPACE@[41; 42) "\n" | ||
29 | error 23: expected `[` | ||
30 | error 23: expected an item | ||
31 | error 27: expected one of `*`, `::`, `{`, `self`, `super` or an indentifier | ||
32 | error 28: expected SEMI | ||
33 | error 31: expected EXCL | ||
34 | error 31: expected `{`, `[`, `(` | ||
35 | error 31: expected SEMI | ||
36 | error 31: expected an item | ||
37 | error 35: expected EXCL | ||
38 | error 41: expected `{`, `[`, `(` | ||
39 | error 41: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rs b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rs new file mode 100644 index 000000000..009312270 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | struct S { | ||
2 | a: i32, | ||
3 | b: String, | ||
4 | }; \ No newline at end of file | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.txt b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.txt new file mode 100644 index 000000000..857826037 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | SOURCE_FILE@[0; 40) | ||
2 | STRUCT_DEF@[0; 39) | ||
3 | STRUCT_KW@[0; 6) "struct" | ||
4 | WHITESPACE@[6; 7) " " | ||
5 | NAME@[7; 8) | ||
6 | IDENT@[7; 8) "S" | ||
7 | WHITESPACE@[8; 9) " " | ||
8 | NAMED_FIELD_DEF_LIST@[9; 39) | ||
9 | L_CURLY@[9; 10) "{" | ||
10 | WHITESPACE@[10; 15) "\n " | ||
11 | NAMED_FIELD_DEF@[15; 21) | ||
12 | NAME@[15; 16) | ||
13 | IDENT@[15; 16) "a" | ||
14 | COLON@[16; 17) ":" | ||
15 | WHITESPACE@[17; 18) " " | ||
16 | PATH_TYPE@[18; 21) | ||
17 | PATH@[18; 21) | ||
18 | PATH_SEGMENT@[18; 21) | ||
19 | NAME_REF@[18; 21) | ||
20 | IDENT@[18; 21) "i32" | ||
21 | COMMA@[21; 22) "," | ||
22 | WHITESPACE@[22; 27) "\n " | ||
23 | NAMED_FIELD_DEF@[27; 36) | ||
24 | NAME@[27; 28) | ||
25 | IDENT@[27; 28) "b" | ||
26 | COLON@[28; 29) ":" | ||
27 | WHITESPACE@[29; 30) " " | ||
28 | PATH_TYPE@[30; 36) | ||
29 | PATH@[30; 36) | ||
30 | PATH_SEGMENT@[30; 36) | ||
31 | NAME_REF@[30; 36) | ||
32 | IDENT@[30; 36) "String" | ||
33 | COMMA@[36; 37) "," | ||
34 | WHITESPACE@[37; 38) "\n" | ||
35 | R_CURLY@[38; 39) "}" | ||
36 | ERROR@[39; 40) | ||
37 | SEMI@[39; 40) ";" | ||
38 | error 39: expected item, found `;` | ||
39 | consider removing this semicolon | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rs b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rs new file mode 100644 index 000000000..060e65d06 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rs | |||
@@ -0,0 +1 @@ | |||
use foo::92; \ No newline at end of file | |||
diff --git a/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.txt b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.txt new file mode 100644 index 000000000..5210a884d --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.txt | |||
@@ -0,0 +1,16 @@ | |||
1 | SOURCE_FILE@[0; 12) | ||
2 | USE_ITEM@[0; 12) | ||
3 | USE_KW@[0; 3) "use" | ||
4 | WHITESPACE@[3; 4) " " | ||
5 | USE_TREE@[4; 11) | ||
6 | PATH@[4; 11) | ||
7 | PATH@[4; 7) | ||
8 | PATH_SEGMENT@[4; 7) | ||
9 | NAME_REF@[4; 7) | ||
10 | IDENT@[4; 7) "foo" | ||
11 | COLONCOLON@[7; 9) "::" | ||
12 | PATH_SEGMENT@[9; 11) | ||
13 | ERROR@[9; 11) | ||
14 | INT_NUMBER@[9; 11) "92" | ||
15 | SEMI@[11; 12) ";" | ||
16 | error 9: expected identifier | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rs b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rs new file mode 100644 index 000000000..de7f81628 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rs | |||
@@ -0,0 +1,8 @@ | |||
1 | #[foo(foo, +, 92)] | ||
2 | fn foo() { | ||
3 | } | ||
4 | |||
5 | |||
6 | #[foo( | ||
7 | fn foo() { | ||
8 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.txt b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.txt new file mode 100644 index 000000000..6d5199a56 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.txt | |||
@@ -0,0 +1,55 @@ | |||
1 | SOURCE_FILE@[0; 54) | ||
2 | FN_DEF@[0; 31) | ||
3 | ATTR@[0; 18) | ||
4 | POUND@[0; 1) "#" | ||
5 | TOKEN_TREE@[1; 18) | ||
6 | L_BRACK@[1; 2) "[" | ||
7 | IDENT@[2; 5) "foo" | ||
8 | TOKEN_TREE@[5; 17) | ||
9 | L_PAREN@[5; 6) "(" | ||
10 | IDENT@[6; 9) "foo" | ||
11 | COMMA@[9; 10) "," | ||
12 | WHITESPACE@[10; 11) " " | ||
13 | PLUS@[11; 12) "+" | ||
14 | COMMA@[12; 13) "," | ||
15 | WHITESPACE@[13; 14) " " | ||
16 | INT_NUMBER@[14; 16) "92" | ||
17 | R_PAREN@[16; 17) ")" | ||
18 | R_BRACK@[17; 18) "]" | ||
19 | WHITESPACE@[18; 19) "\n" | ||
20 | FN_KW@[19; 21) "fn" | ||
21 | WHITESPACE@[21; 22) " " | ||
22 | NAME@[22; 25) | ||
23 | IDENT@[22; 25) "foo" | ||
24 | PARAM_LIST@[25; 27) | ||
25 | L_PAREN@[25; 26) "(" | ||
26 | R_PAREN@[26; 27) ")" | ||
27 | WHITESPACE@[27; 28) " " | ||
28 | BLOCK@[28; 31) | ||
29 | L_CURLY@[28; 29) "{" | ||
30 | WHITESPACE@[29; 30) "\n" | ||
31 | R_CURLY@[30; 31) "}" | ||
32 | WHITESPACE@[31; 34) "\n\n\n" | ||
33 | ATTR@[34; 53) | ||
34 | POUND@[34; 35) "#" | ||
35 | TOKEN_TREE@[35; 53) | ||
36 | L_BRACK@[35; 36) "[" | ||
37 | IDENT@[36; 39) "foo" | ||
38 | TOKEN_TREE@[39; 53) | ||
39 | L_PAREN@[39; 40) "(" | ||
40 | WHITESPACE@[40; 41) "\n" | ||
41 | FN_KW@[41; 43) "fn" | ||
42 | WHITESPACE@[43; 44) " " | ||
43 | IDENT@[44; 47) "foo" | ||
44 | TOKEN_TREE@[47; 49) | ||
45 | L_PAREN@[47; 48) "(" | ||
46 | R_PAREN@[48; 49) ")" | ||
47 | WHITESPACE@[49; 50) " " | ||
48 | TOKEN_TREE@[50; 53) | ||
49 | L_CURLY@[50; 51) "{" | ||
50 | WHITESPACE@[51; 52) "\n" | ||
51 | R_CURLY@[52; 53) "}" | ||
52 | WHITESPACE@[53; 54) "\n" | ||
53 | error 53: expected R_PAREN | ||
54 | error 53: expected R_BRACK | ||
55 | error 53: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rs b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rs new file mode 100644 index 000000000..8069c111b --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | struct S { | ||
2 | f: u32, | ||
3 | pub 92 | ||
4 | + - * | ||
5 | pub x: u32, | ||
6 | z: f64, | ||
7 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.txt b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.txt new file mode 100644 index 000000000..6143e68f1 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.txt | |||
@@ -0,0 +1,74 @@ | |||
1 | SOURCE_FILE@[0; 74) | ||
2 | STRUCT_DEF@[0; 73) | ||
3 | STRUCT_KW@[0; 6) "struct" | ||
4 | WHITESPACE@[6; 7) " " | ||
5 | NAME@[7; 8) | ||
6 | IDENT@[7; 8) "S" | ||
7 | WHITESPACE@[8; 9) " " | ||
8 | NAMED_FIELD_DEF_LIST@[9; 73) | ||
9 | L_CURLY@[9; 10) "{" | ||
10 | WHITESPACE@[10; 15) "\n " | ||
11 | NAMED_FIELD_DEF@[15; 21) | ||
12 | NAME@[15; 16) | ||
13 | IDENT@[15; 16) "f" | ||
14 | COLON@[16; 17) ":" | ||
15 | WHITESPACE@[17; 18) " " | ||
16 | PATH_TYPE@[18; 21) | ||
17 | PATH@[18; 21) | ||
18 | PATH_SEGMENT@[18; 21) | ||
19 | NAME_REF@[18; 21) | ||
20 | IDENT@[18; 21) "u32" | ||
21 | COMMA@[21; 22) "," | ||
22 | WHITESPACE@[22; 27) "\n " | ||
23 | VISIBILITY@[27; 30) | ||
24 | PUB_KW@[27; 30) "pub" | ||
25 | WHITESPACE@[30; 31) " " | ||
26 | ERROR@[31; 33) | ||
27 | INT_NUMBER@[31; 33) "92" | ||
28 | WHITESPACE@[33; 38) "\n " | ||
29 | ERROR@[38; 39) | ||
30 | PLUS@[38; 39) "+" | ||
31 | WHITESPACE@[39; 40) " " | ||
32 | ERROR@[40; 41) | ||
33 | MINUS@[40; 41) "-" | ||
34 | WHITESPACE@[41; 42) " " | ||
35 | ERROR@[42; 43) | ||
36 | STAR@[42; 43) "*" | ||
37 | WHITESPACE@[43; 48) "\n " | ||
38 | NAMED_FIELD_DEF@[48; 58) | ||
39 | VISIBILITY@[48; 51) | ||
40 | PUB_KW@[48; 51) "pub" | ||
41 | WHITESPACE@[51; 52) " " | ||
42 | NAME@[52; 53) | ||
43 | IDENT@[52; 53) "x" | ||
44 | COLON@[53; 54) ":" | ||
45 | WHITESPACE@[54; 55) " " | ||
46 | PATH_TYPE@[55; 58) | ||
47 | PATH@[55; 58) | ||
48 | PATH_SEGMENT@[55; 58) | ||
49 | NAME_REF@[55; 58) | ||
50 | IDENT@[55; 58) "u32" | ||
51 | COMMA@[58; 59) "," | ||
52 | WHITESPACE@[59; 64) "\n " | ||
53 | NAMED_FIELD_DEF@[64; 70) | ||
54 | NAME@[64; 65) | ||
55 | IDENT@[64; 65) "z" | ||
56 | COLON@[65; 66) ":" | ||
57 | WHITESPACE@[66; 67) " " | ||
58 | PATH_TYPE@[67; 70) | ||
59 | PATH@[67; 70) | ||
60 | PATH_SEGMENT@[67; 70) | ||
61 | NAME_REF@[67; 70) | ||
62 | IDENT@[67; 70) "f64" | ||
63 | COMMA@[70; 71) "," | ||
64 | WHITESPACE@[71; 72) "\n" | ||
65 | R_CURLY@[72; 73) "}" | ||
66 | WHITESPACE@[73; 74) "\n" | ||
67 | error 31: expected field declaration | ||
68 | error 33: expected COMMA | ||
69 | error 38: expected field declaration | ||
70 | error 39: expected COMMA | ||
71 | error 40: expected field declaration | ||
72 | error 41: expected COMMA | ||
73 | error 42: expected field declaration | ||
74 | error 43: expected COMMA | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rs b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rs new file mode 100644 index 000000000..dc869fb78 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | } | ||
2 | |||
3 | struct S; | ||
4 | |||
5 | } | ||
6 | |||
7 | fn foo(){} | ||
8 | |||
9 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.txt b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.txt new file mode 100644 index 000000000..b79e01238 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | SOURCE_FILE@[0; 31) | ||
2 | ERROR@[0; 1) | ||
3 | R_CURLY@[0; 1) "}" | ||
4 | WHITESPACE@[1; 3) "\n\n" | ||
5 | STRUCT_DEF@[3; 12) | ||
6 | STRUCT_KW@[3; 9) "struct" | ||
7 | WHITESPACE@[9; 10) " " | ||
8 | NAME@[10; 11) | ||
9 | IDENT@[10; 11) "S" | ||
10 | SEMI@[11; 12) ";" | ||
11 | WHITESPACE@[12; 14) "\n\n" | ||
12 | ERROR@[14; 15) | ||
13 | R_CURLY@[14; 15) "}" | ||
14 | WHITESPACE@[15; 17) "\n\n" | ||
15 | FN_DEF@[17; 27) | ||
16 | FN_KW@[17; 19) "fn" | ||
17 | WHITESPACE@[19; 20) " " | ||
18 | NAME@[20; 23) | ||
19 | IDENT@[20; 23) "foo" | ||
20 | PARAM_LIST@[23; 25) | ||
21 | L_PAREN@[23; 24) "(" | ||
22 | R_PAREN@[24; 25) ")" | ||
23 | BLOCK@[25; 27) | ||
24 | L_CURLY@[25; 26) "{" | ||
25 | R_CURLY@[26; 27) "}" | ||
26 | WHITESPACE@[27; 29) "\n\n" | ||
27 | ERROR@[29; 30) | ||
28 | R_CURLY@[29; 30) "}" | ||
29 | WHITESPACE@[30; 31) "\n" | ||
30 | error 0: unmatched `}` | ||
31 | error 14: unmatched `}` | ||
32 | error 29: unmatched `}` | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rs b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rs new file mode 100644 index 000000000..9fcac19b5 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rs | |||
@@ -0,0 +1,13 @@ | |||
1 | fn foo() { | ||
2 | } | ||
3 | |||
4 | bar() { | ||
5 | if true { | ||
6 | 1 | ||
7 | } else { | ||
8 | 2 + 3 | ||
9 | } | ||
10 | } | ||
11 | |||
12 | fn baz() { | ||
13 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.txt b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.txt new file mode 100644 index 000000000..9a8871579 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.txt | |||
@@ -0,0 +1,77 @@ | |||
1 | SOURCE_FILE@[0; 95) | ||
2 | FN_DEF@[0; 12) | ||
3 | FN_KW@[0; 2) "fn" | ||
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; 12) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 11) "\n" | ||
14 | R_CURLY@[11; 12) "}" | ||
15 | WHITESPACE@[12; 14) "\n\n" | ||
16 | MACRO_CALL@[14; 19) | ||
17 | PATH@[14; 17) | ||
18 | PATH_SEGMENT@[14; 17) | ||
19 | NAME_REF@[14; 17) | ||
20 | IDENT@[14; 17) "bar" | ||
21 | TOKEN_TREE@[17; 19) | ||
22 | L_PAREN@[17; 18) "(" | ||
23 | R_PAREN@[18; 19) ")" | ||
24 | WHITESPACE@[19; 20) " " | ||
25 | ERROR@[20; 80) | ||
26 | L_CURLY@[20; 21) "{" | ||
27 | WHITESPACE@[21; 26) "\n " | ||
28 | IF_EXPR@[26; 78) | ||
29 | IF_KW@[26; 28) "if" | ||
30 | WHITESPACE@[28; 29) " " | ||
31 | CONDITION@[29; 33) | ||
32 | LITERAL@[29; 33) | ||
33 | TRUE_KW@[29; 33) "true" | ||
34 | WHITESPACE@[33; 34) " " | ||
35 | BLOCK@[34; 51) | ||
36 | L_CURLY@[34; 35) "{" | ||
37 | WHITESPACE@[35; 44) "\n " | ||
38 | LITERAL@[44; 45) | ||
39 | INT_NUMBER@[44; 45) "1" | ||
40 | WHITESPACE@[45; 50) "\n " | ||
41 | R_CURLY@[50; 51) "}" | ||
42 | WHITESPACE@[51; 52) " " | ||
43 | ELSE_KW@[52; 56) "else" | ||
44 | WHITESPACE@[56; 57) " " | ||
45 | BLOCK@[57; 78) | ||
46 | L_CURLY@[57; 58) "{" | ||
47 | WHITESPACE@[58; 67) "\n " | ||
48 | BIN_EXPR@[67; 72) | ||
49 | LITERAL@[67; 68) | ||
50 | INT_NUMBER@[67; 68) "2" | ||
51 | WHITESPACE@[68; 69) " " | ||
52 | PLUS@[69; 70) "+" | ||
53 | WHITESPACE@[70; 71) " " | ||
54 | LITERAL@[71; 72) | ||
55 | INT_NUMBER@[71; 72) "3" | ||
56 | WHITESPACE@[72; 77) "\n " | ||
57 | R_CURLY@[77; 78) "}" | ||
58 | WHITESPACE@[78; 79) "\n" | ||
59 | R_CURLY@[79; 80) "}" | ||
60 | WHITESPACE@[80; 82) "\n\n" | ||
61 | FN_DEF@[82; 94) | ||
62 | FN_KW@[82; 84) "fn" | ||
63 | WHITESPACE@[84; 85) " " | ||
64 | NAME@[85; 88) | ||
65 | IDENT@[85; 88) "baz" | ||
66 | PARAM_LIST@[88; 90) | ||
67 | L_PAREN@[88; 89) "(" | ||
68 | R_PAREN@[89; 90) ")" | ||
69 | WHITESPACE@[90; 91) " " | ||
70 | BLOCK@[91; 94) | ||
71 | L_CURLY@[91; 92) "{" | ||
72 | WHITESPACE@[92; 93) "\n" | ||
73 | R_CURLY@[93; 94) "}" | ||
74 | WHITESPACE@[94; 95) "\n" | ||
75 | error 17: expected EXCL | ||
76 | error 19: expected SEMI | ||
77 | error 20: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs new file mode 100644 index 000000000..0dd30d0bd --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | struct S<90 + 2> { | ||
2 | f: u32 | ||
3 | } | ||
4 | |||
5 | struct T; | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.txt b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.txt new file mode 100644 index 000000000..e147d6424 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.txt | |||
@@ -0,0 +1,58 @@ | |||
1 | SOURCE_FILE@[0; 43) | ||
2 | STRUCT_DEF@[0; 11) | ||
3 | STRUCT_KW@[0; 6) "struct" | ||
4 | WHITESPACE@[6; 7) " " | ||
5 | NAME@[7; 8) | ||
6 | IDENT@[7; 8) "S" | ||
7 | TYPE_PARAM_LIST@[8; 11) | ||
8 | L_ANGLE@[8; 9) "<" | ||
9 | ERROR@[9; 11) | ||
10 | INT_NUMBER@[9; 11) "90" | ||
11 | WHITESPACE@[11; 12) " " | ||
12 | ERROR@[12; 13) | ||
13 | PLUS@[12; 13) "+" | ||
14 | WHITESPACE@[13; 14) " " | ||
15 | ERROR@[14; 15) | ||
16 | INT_NUMBER@[14; 15) "2" | ||
17 | ERROR@[15; 16) | ||
18 | R_ANGLE@[15; 16) ">" | ||
19 | WHITESPACE@[16; 17) " " | ||
20 | ERROR@[17; 31) | ||
21 | L_CURLY@[17; 18) "{" | ||
22 | WHITESPACE@[18; 23) "\n " | ||
23 | EXPR_STMT@[23; 24) | ||
24 | PATH_EXPR@[23; 24) | ||
25 | PATH@[23; 24) | ||
26 | PATH_SEGMENT@[23; 24) | ||
27 | NAME_REF@[23; 24) | ||
28 | IDENT@[23; 24) "f" | ||
29 | EXPR_STMT@[24; 25) | ||
30 | ERROR@[24; 25) | ||
31 | COLON@[24; 25) ":" | ||
32 | WHITESPACE@[25; 26) " " | ||
33 | PATH_EXPR@[26; 29) | ||
34 | PATH@[26; 29) | ||
35 | PATH_SEGMENT@[26; 29) | ||
36 | NAME_REF@[26; 29) | ||
37 | IDENT@[26; 29) "u32" | ||
38 | WHITESPACE@[29; 30) "\n" | ||
39 | R_CURLY@[30; 31) "}" | ||
40 | WHITESPACE@[31; 33) "\n\n" | ||
41 | STRUCT_DEF@[33; 42) | ||
42 | STRUCT_KW@[33; 39) "struct" | ||
43 | WHITESPACE@[39; 40) " " | ||
44 | NAME@[40; 41) | ||
45 | IDENT@[40; 41) "T" | ||
46 | SEMI@[41; 42) ";" | ||
47 | WHITESPACE@[42; 43) "\n" | ||
48 | error 9: expected type parameter | ||
49 | error 11: expected COMMA | ||
50 | error 11: expected R_ANGLE | ||
51 | error 11: expected `;`, `{`, or `(` | ||
52 | error 12: expected an item | ||
53 | error 14: expected an item | ||
54 | error 15: expected an item | ||
55 | error 17: expected an item | ||
56 | error 24: expected SEMI | ||
57 | error 24: expected expression | ||
58 | error 25: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rs b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rs new file mode 100644 index 000000000..985775282 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | || -> () unsafe { () }; | ||
3 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.txt b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.txt new file mode 100644 index 000000000..c46809f81 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | SOURCE_FILE@[0; 42) | ||
2 | FN_DEF@[0; 41) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK@[10; 41) | ||
12 | L_CURLY@[10; 11) "{" | ||
13 | WHITESPACE@[11; 16) "\n " | ||
14 | EXPR_STMT@[16; 39) | ||
15 | LAMBDA_EXPR@[16; 38) | ||
16 | PARAM_LIST@[16; 18) | ||
17 | PIPE@[16; 17) "|" | ||
18 | PIPE@[17; 18) "|" | ||
19 | WHITESPACE@[18; 19) " " | ||
20 | RET_TYPE@[19; 24) | ||
21 | THIN_ARROW@[19; 21) "->" | ||
22 | WHITESPACE@[21; 22) " " | ||
23 | TUPLE_TYPE@[22; 24) | ||
24 | L_PAREN@[22; 23) "(" | ||
25 | R_PAREN@[23; 24) ")" | ||
26 | WHITESPACE@[24; 25) " " | ||
27 | BLOCK_EXPR@[25; 38) | ||
28 | UNSAFE_KW@[25; 31) "unsafe" | ||
29 | WHITESPACE@[31; 32) " " | ||
30 | BLOCK@[32; 38) | ||
31 | L_CURLY@[32; 33) "{" | ||
32 | WHITESPACE@[33; 34) " " | ||
33 | TUPLE_EXPR@[34; 36) | ||
34 | L_PAREN@[34; 35) "(" | ||
35 | R_PAREN@[35; 36) ")" | ||
36 | WHITESPACE@[36; 37) " " | ||
37 | R_CURLY@[37; 38) "}" | ||
38 | SEMI@[38; 39) ";" | ||
39 | WHITESPACE@[39; 40) "\n" | ||
40 | R_CURLY@[40; 41) "}" | ||
41 | WHITESPACE@[41; 42) "\n" | ||
42 | error 24: expected `{` | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rs b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rs new file mode 100644 index 000000000..c1bd0a2d1 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rs | |||
@@ -0,0 +1 @@ | |||
extern struct Foo; | |||
diff --git a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.txt b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.txt new file mode 100644 index 000000000..381147dc0 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | SOURCE_FILE@[0; 19) | ||
2 | ERROR@[0; 6) | ||
3 | ABI@[0; 6) | ||
4 | EXTERN_KW@[0; 6) "extern" | ||
5 | WHITESPACE@[6; 7) " " | ||
6 | STRUCT_DEF@[7; 18) | ||
7 | STRUCT_KW@[7; 13) "struct" | ||
8 | WHITESPACE@[13; 14) " " | ||
9 | NAME@[14; 17) | ||
10 | IDENT@[14; 17) "Foo" | ||
11 | SEMI@[17; 18) ";" | ||
12 | WHITESPACE@[18; 19) "\n" | ||
13 | error 6: expected existential, fn, trait or impl | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.txt b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.txt new file mode 100644 index 000000000..12ebc2a3a --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.txt | |||
@@ -0,0 +1,387 @@ | |||
1 | SOURCE_FILE@[0; 389) | ||
2 | FN_DEF@[0; 389) | ||
3 | VISIBILITY@[0; 10) | ||
4 | PUB_KW@[0; 3) | ||
5 | L_PAREN@[3; 4) | ||
6 | SUPER_KW@[4; 9) | ||
7 | R_PAREN@[9; 10) | ||
8 | WHITESPACE@[10; 11) | ||
9 | FN_KW@[11; 13) | ||
10 | WHITESPACE@[13; 14) | ||
11 | NAME@[14; 21) | ||
12 | IDENT@[14; 21) "process" | ||
13 | TYPE_PARAM_LIST@[21; 38) | ||
14 | L_ANGLE@[21; 22) | ||
15 | LIFETIME_PARAM@[22; 24) | ||
16 | LIFETIME@[22; 24) "'a" | ||
17 | COMMA@[24; 25) | ||
18 | WHITESPACE@[25; 26) | ||
19 | TYPE_PARAM@[26; 37) | ||
20 | NAME@[26; 27) | ||
21 | IDENT@[26; 27) "S" | ||
22 | COLON@[27; 28) | ||
23 | WHITESPACE@[28; 29) | ||
24 | PATH@[29; 37) | ||
25 | PATH_SEGMENT@[29; 37) | ||
26 | NAME_REF@[29; 33) | ||
27 | IDENT@[29; 33) "Sink" | ||
28 | TYPE_ARG_LIST@[33; 37) | ||
29 | L_ANGLE@[33; 34) | ||
30 | LIFETIME_ARG@[34; 36) | ||
31 | LIFETIME@[34; 36) "'a" | ||
32 | R_ANGLE@[36; 37) | ||
33 | R_ANGLE@[37; 38) | ||
34 | PARAM_LIST@[38; 93) | ||
35 | L_PAREN@[38; 39) | ||
36 | PARAM@[39; 54) | ||
37 | BIND_PAT@[39; 46) | ||
38 | NAME@[39; 46) | ||
39 | IDENT@[39; 46) "builder" | ||
40 | COLON@[46; 47) | ||
41 | WHITESPACE@[47; 48) | ||
42 | REFERENCE_TYPE@[48; 54) | ||
43 | AMP@[48; 49) | ||
44 | MUT_KW@[49; 52) | ||
45 | WHITESPACE@[52; 53) | ||
46 | PATH_TYPE@[53; 54) | ||
47 | PATH@[53; 54) | ||
48 | PATH_SEGMENT@[53; 54) | ||
49 | NAME_REF@[53; 54) | ||
50 | IDENT@[53; 54) "S" | ||
51 | COMMA@[54; 55) | ||
52 | WHITESPACE@[55; 56) | ||
53 | PARAM@[56; 72) | ||
54 | BIND_PAT@[56; 62) | ||
55 | NAME@[56; 62) | ||
56 | IDENT@[56; 62) "tokens" | ||
57 | COLON@[62; 63) | ||
58 | WHITESPACE@[63; 64) | ||
59 | REFERENCE_TYPE@[64; 72) | ||
60 | AMP@[64; 65) | ||
61 | SLICE_TYPE@[65; 72) | ||
62 | L_BRACK@[65; 66) | ||
63 | PATH_TYPE@[66; 71) | ||
64 | PATH@[66; 71) | ||
65 | PATH_SEGMENT@[66; 71) | ||
66 | NAME_REF@[66; 71) | ||
67 | IDENT@[66; 71) "Token" | ||
68 | R_BRACK@[71; 72) | ||
69 | COMMA@[72; 73) | ||
70 | WHITESPACE@[73; 74) | ||
71 | PARAM@[74; 92) | ||
72 | BIND_PAT@[74; 80) | ||
73 | NAME@[74; 80) | ||
74 | IDENT@[74; 80) "events" | ||
75 | COLON@[80; 81) | ||
76 | WHITESPACE@[81; 82) | ||
77 | PATH_TYPE@[82; 92) | ||
78 | PATH@[82; 92) | ||
79 | PATH_SEGMENT@[82; 92) | ||
80 | NAME_REF@[82; 85) | ||
81 | IDENT@[82; 85) "Vec" | ||
82 | TYPE_ARG_LIST@[85; 92) | ||
83 | L_ANGLE@[85; 86) | ||
84 | TYPE_ARG@[86; 91) | ||
85 | PATH_TYPE@[86; 91) | ||
86 | PATH@[86; 91) | ||
87 | PATH_SEGMENT@[86; 91) | ||
88 | NAME_REF@[86; 91) | ||
89 | IDENT@[86; 91) "Event" | ||
90 | R_ANGLE@[91; 92) | ||
91 | R_PAREN@[92; 93) | ||
92 | WHITESPACE@[93; 94) | ||
93 | BLOCK_EXPR@[94; 389) | ||
94 | L_CURLY@[94; 95) | ||
95 | WHITESPACE@[95; 100) | ||
96 | LET_STMT@[100; 125) | ||
97 | LET_KW@[100; 103) | ||
98 | WHITESPACE@[103; 104) | ||
99 | BIND_PAT@[104; 120) | ||
100 | MUT_KW@[104; 107) | ||
101 | WHITESPACE@[107; 108) | ||
102 | NAME@[108; 120) | ||
103 | IDENT@[108; 120) "next_tok_idx" | ||
104 | WHITESPACE@[120; 121) | ||
105 | EQ@[121; 122) | ||
106 | WHITESPACE@[122; 123) | ||
107 | LITERAL@[123; 124) | ||
108 | INT_NUMBER@[123; 124) "0" | ||
109 | SEMI@[124; 125) | ||
110 | WHITESPACE@[125; 130) | ||
111 | LET_STMT@[130; 389) | ||
112 | LET_KW@[130; 133) | ||
113 | WHITESPACE@[133; 134) | ||
114 | BIND_PAT@[134; 140) | ||
115 | NAME@[134; 140) | ||
116 | IDENT@[134; 140) "eat_ws" | ||
117 | WHITESPACE@[140; 141) | ||
118 | EQ@[141; 142) | ||
119 | WHITESPACE@[142; 143) | ||
120 | LAMBDA_EXPR@[143; 389) | ||
121 | PARAM_LIST@[143; 388) | ||
122 | PIPE@[143; 144) | ||
123 | PARAM@[144; 159) | ||
124 | BIND_PAT@[144; 147) | ||
125 | NAME@[144; 147) | ||
126 | IDENT@[144; 147) "idx" | ||
127 | COLON@[147; 148) | ||
128 | WHITESPACE@[148; 149) | ||
129 | REFERENCE_TYPE@[149; 159) | ||
130 | AMP@[149; 150) | ||
131 | MUT_KW@[150; 153) | ||
132 | WHITESPACE@[153; 154) | ||
133 | PATH_TYPE@[154; 159) | ||
134 | PATH@[154; 159) | ||
135 | PATH_SEGMENT@[154; 159) | ||
136 | NAME_REF@[154; 159) | ||
137 | IDENT@[154; 159) "usize" | ||
138 | COMMA@[159; 160) | ||
139 | WHITESPACE@[160; 161) | ||
140 | PARAM@[161; 167) | ||
141 | REF_PAT@[161; 167) | ||
142 | AMP@[161; 162) | ||
143 | MUT_KW@[162; 165) | ||
144 | WHITESPACE@[165; 166) | ||
145 | err: `expected pattern` | ||
146 | ERROR@[166; 167) | ||
147 | PIPE@[166; 167) | ||
148 | err: `expected COMMA` | ||
149 | WHITESPACE@[167; 168) | ||
150 | err: `expected pattern` | ||
151 | PARAM@[168; 169) | ||
152 | ERROR@[168; 169) | ||
153 | L_CURLY@[168; 169) | ||
154 | err: `expected COMMA` | ||
155 | WHITESPACE@[169; 178) | ||
156 | err: `expected pattern` | ||
157 | PARAM@[178; 183) | ||
158 | ERROR@[178; 183) | ||
159 | WHILE_KW@[178; 183) | ||
160 | err: `expected COMMA` | ||
161 | WHITESPACE@[183; 184) | ||
162 | err: `expected pattern` | ||
163 | PARAM@[184; 187) | ||
164 | ERROR@[184; 187) | ||
165 | LET_KW@[184; 187) | ||
166 | err: `expected COMMA` | ||
167 | WHITESPACE@[187; 188) | ||
168 | PARAM@[188; 199) | ||
169 | TUPLE_STRUCT_PAT@[188; 199) | ||
170 | PATH@[188; 192) | ||
171 | PATH_SEGMENT@[188; 192) | ||
172 | NAME_REF@[188; 192) | ||
173 | IDENT@[188; 192) "Some" | ||
174 | L_PAREN@[192; 193) | ||
175 | BIND_PAT@[193; 198) | ||
176 | NAME@[193; 198) | ||
177 | IDENT@[193; 198) "token" | ||
178 | R_PAREN@[198; 199) | ||
179 | err: `expected COMMA` | ||
180 | WHITESPACE@[199; 200) | ||
181 | err: `expected pattern` | ||
182 | PARAM@[200; 201) | ||
183 | ERROR@[200; 201) | ||
184 | EQ@[200; 201) | ||
185 | err: `expected COMMA` | ||
186 | WHITESPACE@[201; 202) | ||
187 | PARAM@[202; 208) | ||
188 | BIND_PAT@[202; 208) | ||
189 | NAME@[202; 208) | ||
190 | IDENT@[202; 208) "tokens" | ||
191 | err: `expected COMMA` | ||
192 | err: `expected pattern` | ||
193 | PARAM@[208; 209) | ||
194 | ERROR@[208; 209) | ||
195 | DOT@[208; 209) | ||
196 | err: `expected COMMA` | ||
197 | PARAM@[209; 218) | ||
198 | TUPLE_STRUCT_PAT@[209; 218) | ||
199 | PATH@[209; 212) | ||
200 | PATH_SEGMENT@[209; 212) | ||
201 | NAME_REF@[209; 212) | ||
202 | IDENT@[209; 212) "get" | ||
203 | L_PAREN@[212; 213) | ||
204 | err: `expected pattern` | ||
205 | ERROR@[213; 214) | ||
206 | STAR@[213; 214) | ||
207 | err: `expected COMMA` | ||
208 | BIND_PAT@[214; 217) | ||
209 | NAME@[214; 217) | ||
210 | IDENT@[214; 217) "idx" | ||
211 | R_PAREN@[217; 218) | ||
212 | err: `expected COMMA` | ||
213 | WHITESPACE@[218; 219) | ||
214 | err: `expected pattern` | ||
215 | PARAM@[219; 220) | ||
216 | ERROR@[219; 220) | ||
217 | L_CURLY@[219; 220) | ||
218 | err: `expected COMMA` | ||
219 | WHITESPACE@[220; 233) | ||
220 | err: `expected pattern` | ||
221 | PARAM@[233; 235) | ||
222 | ERROR@[233; 235) | ||
223 | IF_KW@[233; 235) | ||
224 | err: `expected COMMA` | ||
225 | WHITESPACE@[235; 236) | ||
226 | err: `expected pattern` | ||
227 | PARAM@[236; 237) | ||
228 | ERROR@[236; 237) | ||
229 | EXCL@[236; 237) | ||
230 | err: `expected COMMA` | ||
231 | PARAM@[237; 242) | ||
232 | BIND_PAT@[237; 242) | ||
233 | NAME@[237; 242) | ||
234 | IDENT@[237; 242) "token" | ||
235 | err: `expected COMMA` | ||
236 | err: `expected pattern` | ||
237 | PARAM@[242; 243) | ||
238 | ERROR@[242; 243) | ||
239 | DOT@[242; 243) | ||
240 | err: `expected COMMA` | ||
241 | PARAM@[243; 247) | ||
242 | BIND_PAT@[243; 247) | ||
243 | NAME@[243; 247) | ||
244 | IDENT@[243; 247) "kind" | ||
245 | err: `expected COMMA` | ||
246 | err: `expected pattern` | ||
247 | PARAM@[247; 248) | ||
248 | ERROR@[247; 248) | ||
249 | DOT@[247; 248) | ||
250 | err: `expected COMMA` | ||
251 | PARAM@[248; 259) | ||
252 | TUPLE_STRUCT_PAT@[248; 259) | ||
253 | PATH@[248; 257) | ||
254 | PATH_SEGMENT@[248; 257) | ||
255 | NAME_REF@[248; 257) | ||
256 | IDENT@[248; 257) "is_trivia" | ||
257 | L_PAREN@[257; 258) | ||
258 | R_PAREN@[258; 259) | ||
259 | err: `expected COMMA` | ||
260 | WHITESPACE@[259; 260) | ||
261 | err: `expected pattern` | ||
262 | PARAM@[260; 261) | ||
263 | ERROR@[260; 261) | ||
264 | L_CURLY@[260; 261) | ||
265 | err: `expected COMMA` | ||
266 | WHITESPACE@[261; 278) | ||
267 | PARAM@[278; 283) | ||
268 | BIND_PAT@[278; 283) | ||
269 | NAME@[278; 283) | ||
270 | IDENT@[278; 283) "break" | ||
271 | err: `expected COMMA` | ||
272 | err: `expected pattern` | ||
273 | PARAM@[283; 284) | ||
274 | ERROR@[283; 284) | ||
275 | SEMI@[283; 284) | ||
276 | err: `expected COMMA` | ||
277 | WHITESPACE@[284; 297) | ||
278 | err: `expected pattern` | ||
279 | PARAM@[297; 298) | ||
280 | ERROR@[297; 298) | ||
281 | R_CURLY@[297; 298) | ||
282 | err: `expected COMMA` | ||
283 | WHITESPACE@[298; 311) | ||
284 | PARAM@[311; 318) | ||
285 | BIND_PAT@[311; 318) | ||
286 | NAME@[311; 318) | ||
287 | IDENT@[311; 318) "builder" | ||
288 | err: `expected COMMA` | ||
289 | err: `expected pattern` | ||
290 | PARAM@[318; 319) | ||
291 | ERROR@[318; 319) | ||
292 | DOT@[318; 319) | ||
293 | err: `expected COMMA` | ||
294 | PARAM@[319; 346) | ||
295 | TUPLE_STRUCT_PAT@[319; 346) | ||
296 | PATH@[319; 323) | ||
297 | PATH_SEGMENT@[319; 323) | ||
298 | NAME_REF@[319; 323) | ||
299 | IDENT@[319; 323) "leaf" | ||
300 | L_PAREN@[323; 324) | ||
301 | BIND_PAT@[324; 329) | ||
302 | NAME@[324; 329) | ||
303 | IDENT@[324; 329) "token" | ||
304 | err: `expected COMMA` | ||
305 | err: `expected pattern` | ||
306 | ERROR@[329; 330) | ||
307 | DOT@[329; 330) | ||
308 | err: `expected COMMA` | ||
309 | BIND_PAT@[330; 334) | ||
310 | NAME@[330; 334) | ||
311 | IDENT@[330; 334) "kind" | ||
312 | COMMA@[334; 335) | ||
313 | WHITESPACE@[335; 336) | ||
314 | BIND_PAT@[336; 341) | ||
315 | NAME@[336; 341) | ||
316 | IDENT@[336; 341) "token" | ||
317 | err: `expected COMMA` | ||
318 | err: `expected pattern` | ||
319 | ERROR@[341; 342) | ||
320 | DOT@[341; 342) | ||
321 | err: `expected COMMA` | ||
322 | BIND_PAT@[342; 345) | ||
323 | NAME@[342; 345) | ||
324 | IDENT@[342; 345) "len" | ||
325 | R_PAREN@[345; 346) | ||
326 | err: `expected COMMA` | ||
327 | err: `expected pattern` | ||
328 | PARAM@[346; 347) | ||
329 | ERROR@[346; 347) | ||
330 | SEMI@[346; 347) | ||
331 | err: `expected COMMA` | ||
332 | WHITESPACE@[347; 360) | ||
333 | err: `expected pattern` | ||
334 | PARAM@[360; 361) | ||
335 | ERROR@[360; 361) | ||
336 | STAR@[360; 361) | ||
337 | err: `expected COMMA` | ||
338 | PARAM@[361; 364) | ||
339 | BIND_PAT@[361; 364) | ||
340 | NAME@[361; 364) | ||
341 | IDENT@[361; 364) "idx" | ||
342 | err: `expected COMMA` | ||
343 | WHITESPACE@[364; 365) | ||
344 | err: `expected pattern` | ||
345 | PARAM@[365; 366) | ||
346 | ERROR@[365; 366) | ||
347 | PLUS@[365; 366) | ||
348 | err: `expected COMMA` | ||
349 | err: `expected pattern` | ||
350 | PARAM@[366; 367) | ||
351 | ERROR@[366; 367) | ||
352 | EQ@[366; 367) | ||
353 | err: `expected COMMA` | ||
354 | WHITESPACE@[367; 368) | ||
355 | PARAM@[368; 369) | ||
356 | LITERAL@[368; 369) | ||
357 | INT_NUMBER@[368; 369) "1" | ||
358 | err: `expected COMMA` | ||
359 | WHITESPACE@[369; 378) | ||
360 | err: `expected pattern` | ||
361 | PARAM@[378; 379) | ||
362 | ERROR@[378; 379) | ||
363 | R_CURLY@[378; 379) | ||
364 | err: `expected COMMA` | ||
365 | WHITESPACE@[379; 384) | ||
366 | err: `expected pattern` | ||
367 | PARAM@[384; 385) | ||
368 | ERROR@[384; 385) | ||
369 | R_CURLY@[384; 385) | ||
370 | err: `expected COMMA` | ||
371 | err: `expected pattern` | ||
372 | PARAM@[385; 386) | ||
373 | ERROR@[385; 386) | ||
374 | SEMI@[385; 386) | ||
375 | err: `expected COMMA` | ||
376 | WHITESPACE@[386; 387) | ||
377 | err: `expected pattern` | ||
378 | PARAM@[387; 388) | ||
379 | ERROR@[387; 388) | ||
380 | R_CURLY@[387; 388) | ||
381 | err: `expected COMMA` | ||
382 | err: `expected PIPE` | ||
383 | WHITESPACE@[388; 389) | ||
384 | err: `expected expression` | ||
385 | err: `expected SEMI` | ||
386 | err: `expected R_CURLY` | ||
387 | ERROR@[389; 389) | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rs b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rs new file mode 100644 index 000000000..20dde3bc3 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | pub struct Cache( | ||
2 | RefCell<HashMap< | ||
3 | TypeId, | ||
4 | Box<@ Any>, | ||
5 | >> | ||
6 | ); | ||
7 | |||
diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.txt b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.txt new file mode 100644 index 000000000..bef286b37 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.txt | |||
@@ -0,0 +1,89 @@ | |||
1 | SOURCE_FILE@[0; 86) | ||
2 | STRUCT_DEF@[0; 72) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) "pub" | ||
5 | WHITESPACE@[3; 4) " " | ||
6 | STRUCT_KW@[4; 10) "struct" | ||
7 | WHITESPACE@[10; 11) " " | ||
8 | NAME@[11; 16) | ||
9 | IDENT@[11; 16) "Cache" | ||
10 | POS_FIELD_DEF_LIST@[16; 72) | ||
11 | L_PAREN@[16; 17) "(" | ||
12 | WHITESPACE@[17; 22) "\n " | ||
13 | POS_FIELD_DEF@[22; 68) | ||
14 | PATH_TYPE@[22; 68) | ||
15 | PATH@[22; 68) | ||
16 | PATH_SEGMENT@[22; 68) | ||
17 | NAME_REF@[22; 29) | ||
18 | IDENT@[22; 29) "RefCell" | ||
19 | TYPE_ARG_LIST@[29; 68) | ||
20 | L_ANGLE@[29; 30) "<" | ||
21 | TYPE_ARG@[30; 68) | ||
22 | PATH_TYPE@[30; 68) | ||
23 | PATH@[30; 68) | ||
24 | PATH_SEGMENT@[30; 68) | ||
25 | NAME_REF@[30; 37) | ||
26 | IDENT@[30; 37) "HashMap" | ||
27 | TYPE_ARG_LIST@[37; 68) | ||
28 | L_ANGLE@[37; 38) "<" | ||
29 | WHITESPACE@[38; 47) "\n " | ||
30 | TYPE_ARG@[47; 53) | ||
31 | PATH_TYPE@[47; 53) | ||
32 | PATH@[47; 53) | ||
33 | PATH_SEGMENT@[47; 53) | ||
34 | NAME_REF@[47; 53) | ||
35 | IDENT@[47; 53) "TypeId" | ||
36 | COMMA@[53; 54) "," | ||
37 | WHITESPACE@[54; 63) "\n " | ||
38 | TYPE_ARG@[63; 68) | ||
39 | PATH_TYPE@[63; 68) | ||
40 | PATH@[63; 68) | ||
41 | PATH_SEGMENT@[63; 68) | ||
42 | NAME_REF@[63; 66) | ||
43 | IDENT@[63; 66) "Box" | ||
44 | TYPE_ARG_LIST@[66; 68) | ||
45 | L_ANGLE@[66; 67) "<" | ||
46 | TYPE_ARG@[67; 68) | ||
47 | ERROR@[67; 68) | ||
48 | AT@[67; 68) "@" | ||
49 | WHITESPACE@[68; 69) " " | ||
50 | POS_FIELD_DEF@[69; 72) | ||
51 | PATH_TYPE@[69; 72) | ||
52 | PATH@[69; 72) | ||
53 | PATH_SEGMENT@[69; 72) | ||
54 | NAME_REF@[69; 72) | ||
55 | IDENT@[69; 72) "Any" | ||
56 | ERROR@[72; 72) | ||
57 | ERROR@[72; 73) | ||
58 | R_ANGLE@[72; 73) ">" | ||
59 | ERROR@[73; 74) | ||
60 | COMMA@[73; 74) "," | ||
61 | WHITESPACE@[74; 79) "\n " | ||
62 | ERROR@[79; 80) | ||
63 | R_ANGLE@[79; 80) ">" | ||
64 | ERROR@[80; 81) | ||
65 | R_ANGLE@[80; 81) ">" | ||
66 | WHITESPACE@[81; 82) "\n" | ||
67 | ERROR@[82; 83) | ||
68 | R_PAREN@[82; 83) ")" | ||
69 | ERROR@[83; 84) | ||
70 | SEMI@[83; 84) ";" | ||
71 | WHITESPACE@[84; 86) "\n\n" | ||
72 | error 67: expected type | ||
73 | error 68: expected COMMA | ||
74 | error 68: expected R_ANGLE | ||
75 | error 68: expected COMMA | ||
76 | error 68: expected R_ANGLE | ||
77 | error 68: expected COMMA | ||
78 | error 68: expected R_ANGLE | ||
79 | error 68: expected COMMA | ||
80 | error 72: expected COMMA | ||
81 | error 72: expected a type | ||
82 | error 72: expected R_PAREN | ||
83 | error 72: expected SEMI | ||
84 | error 72: expected an item | ||
85 | error 73: expected an item | ||
86 | error 79: expected an item | ||
87 | error 80: expected an item | ||
88 | error 82: expected an item | ||
89 | error 83: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rs b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rs new file mode 100644 index 000000000..75c1d2f98 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rs | |||
@@ -0,0 +1 @@ | |||
fn foo<T>() where T {} | |||
diff --git a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.txt b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.txt new file mode 100644 index 000000000..2f0878572 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.txt | |||
@@ -0,0 +1,31 @@ | |||
1 | SOURCE_FILE@[0; 23) | ||
2 | FN_DEF@[0; 22) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | TYPE_PARAM_LIST@[6; 9) | ||
8 | L_ANGLE@[6; 7) "<" | ||
9 | TYPE_PARAM@[7; 8) | ||
10 | NAME@[7; 8) | ||
11 | IDENT@[7; 8) "T" | ||
12 | R_ANGLE@[8; 9) ">" | ||
13 | PARAM_LIST@[9; 11) | ||
14 | L_PAREN@[9; 10) "(" | ||
15 | R_PAREN@[10; 11) ")" | ||
16 | WHITESPACE@[11; 12) " " | ||
17 | WHERE_CLAUSE@[12; 19) | ||
18 | WHERE_KW@[12; 17) "where" | ||
19 | WHITESPACE@[17; 18) " " | ||
20 | WHERE_PRED@[18; 19) | ||
21 | PATH_TYPE@[18; 19) | ||
22 | PATH@[18; 19) | ||
23 | PATH_SEGMENT@[18; 19) | ||
24 | NAME_REF@[18; 19) | ||
25 | IDENT@[18; 19) "T" | ||
26 | WHITESPACE@[19; 20) " " | ||
27 | BLOCK@[20; 22) | ||
28 | L_CURLY@[20; 21) "{" | ||
29 | R_CURLY@[21; 22) "}" | ||
30 | WHITESPACE@[22; 23) "\n" | ||
31 | error 19: expected colon | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rs b/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rs new file mode 100644 index 000000000..156e70251 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | fn foo(}) { | ||
2 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.txt b/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.txt new file mode 100644 index 000000000..23ca0c446 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.txt | |||
@@ -0,0 +1,24 @@ | |||
1 | SOURCE_FILE@[0; 14) | ||
2 | FN_DEF@[0; 7) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 7) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | ERROR@[7; 8) | ||
10 | R_CURLY@[7; 8) "}" | ||
11 | ERROR@[8; 9) | ||
12 | R_PAREN@[8; 9) ")" | ||
13 | WHITESPACE@[9; 10) " " | ||
14 | ERROR@[10; 13) | ||
15 | L_CURLY@[10; 11) "{" | ||
16 | WHITESPACE@[11; 12) "\n" | ||
17 | R_CURLY@[12; 13) "}" | ||
18 | WHITESPACE@[13; 14) "\n" | ||
19 | error 7: expected value parameter | ||
20 | error 7: expected R_PAREN | ||
21 | error 7: expected a block | ||
22 | error 7: unmatched `}` | ||
23 | error 8: expected an item | ||
24 | error 10: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rs b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rs new file mode 100644 index 000000000..9ae857686 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | fn foo() { | ||
2 | foo( | ||
3 | 1, 2 | ||
4 | ) | ||
5 | return 92; | ||
6 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.txt b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.txt new file mode 100644 index 000000000..97e64dea9 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | SOURCE_FILE@[0; 56) | ||
2 | FN_DEF@[0; 55) | ||
3 | FN_KW@[0; 2) "fn" | ||
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; 55) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 15) "\n " | ||
14 | EXPR_STMT@[15; 38) | ||
15 | CALL_EXPR@[15; 38) | ||
16 | PATH_EXPR@[15; 18) | ||
17 | PATH@[15; 18) | ||
18 | PATH_SEGMENT@[15; 18) | ||
19 | NAME_REF@[15; 18) | ||
20 | IDENT@[15; 18) "foo" | ||
21 | ARG_LIST@[18; 38) | ||
22 | L_PAREN@[18; 19) "(" | ||
23 | WHITESPACE@[19; 28) "\n " | ||
24 | LITERAL@[28; 29) | ||
25 | INT_NUMBER@[28; 29) "1" | ||
26 | COMMA@[29; 30) "," | ||
27 | WHITESPACE@[30; 31) " " | ||
28 | LITERAL@[31; 32) | ||
29 | INT_NUMBER@[31; 32) "2" | ||
30 | WHITESPACE@[32; 37) "\n " | ||
31 | R_PAREN@[37; 38) ")" | ||
32 | WHITESPACE@[38; 43) "\n " | ||
33 | EXPR_STMT@[43; 53) | ||
34 | RETURN_EXPR@[43; 52) | ||
35 | RETURN_KW@[43; 49) "return" | ||
36 | WHITESPACE@[49; 50) " " | ||
37 | LITERAL@[50; 52) | ||
38 | INT_NUMBER@[50; 52) "92" | ||
39 | SEMI@[52; 53) ";" | ||
40 | WHITESPACE@[53; 54) "\n" | ||
41 | R_CURLY@[54; 55) "}" | ||
42 | WHITESPACE@[55; 56) "\n" | ||
43 | error 38: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rs b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rs new file mode 100644 index 000000000..17bd49777 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn foo(foo: i32) { | ||
2 | let bar = 92; | ||
3 | 1 + | ||
4 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.txt b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.txt new file mode 100644 index 000000000..c18e20900 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.txt | |||
@@ -0,0 +1,46 @@ | |||
1 | SOURCE_FILE@[0; 47) | ||
2 | FN_DEF@[0; 46) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 16) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | PARAM@[7; 15) | ||
10 | BIND_PAT@[7; 10) | ||
11 | NAME@[7; 10) | ||
12 | IDENT@[7; 10) "foo" | ||
13 | COLON@[10; 11) ":" | ||
14 | WHITESPACE@[11; 12) " " | ||
15 | PATH_TYPE@[12; 15) | ||
16 | PATH@[12; 15) | ||
17 | PATH_SEGMENT@[12; 15) | ||
18 | NAME_REF@[12; 15) | ||
19 | IDENT@[12; 15) "i32" | ||
20 | R_PAREN@[15; 16) ")" | ||
21 | WHITESPACE@[16; 17) " " | ||
22 | BLOCK@[17; 46) | ||
23 | L_CURLY@[17; 18) "{" | ||
24 | WHITESPACE@[18; 23) "\n " | ||
25 | LET_STMT@[23; 36) | ||
26 | LET_KW@[23; 26) "let" | ||
27 | WHITESPACE@[26; 27) " " | ||
28 | BIND_PAT@[27; 30) | ||
29 | NAME@[27; 30) | ||
30 | IDENT@[27; 30) "bar" | ||
31 | WHITESPACE@[30; 31) " " | ||
32 | EQ@[31; 32) "=" | ||
33 | WHITESPACE@[32; 33) " " | ||
34 | LITERAL@[33; 35) | ||
35 | INT_NUMBER@[33; 35) "92" | ||
36 | SEMI@[35; 36) ";" | ||
37 | WHITESPACE@[36; 41) "\n " | ||
38 | BIN_EXPR@[41; 44) | ||
39 | LITERAL@[41; 42) | ||
40 | INT_NUMBER@[41; 42) "1" | ||
41 | WHITESPACE@[42; 43) " " | ||
42 | PLUS@[43; 44) "+" | ||
43 | WHITESPACE@[44; 45) "\n" | ||
44 | R_CURLY@[45; 46) "}" | ||
45 | WHITESPACE@[46; 47) "\n" | ||
46 | error 44: expected expression | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rs b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rs new file mode 100644 index 000000000..fe604006c --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rs | |||
@@ -0,0 +1,8 @@ | |||
1 | impl FnScopes { | ||
2 | fn new_scope(&) -> ScopeId { | ||
3 | let res = self.scopes.len(); | ||
4 | self.scopes.push(ScopeData { parent: None, entries: vec![] }) | ||
5 | } | ||
6 | |||
7 | fn set_parent | ||
8 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt new file mode 100644 index 000000000..51def2d8f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt | |||
@@ -0,0 +1,131 @@ | |||
1 | SOURCE_FILE@[0; 183) | ||
2 | IMPL_BLOCK@[0; 182) | ||
3 | IMPL_KW@[0; 4) "impl" | ||
4 | WHITESPACE@[4; 5) " " | ||
5 | PATH_TYPE@[5; 13) | ||
6 | PATH@[5; 13) | ||
7 | PATH_SEGMENT@[5; 13) | ||
8 | NAME_REF@[5; 13) | ||
9 | IDENT@[5; 13) "FnScopes" | ||
10 | WHITESPACE@[13; 14) " " | ||
11 | ITEM_LIST@[14; 182) | ||
12 | L_CURLY@[14; 15) "{" | ||
13 | WHITESPACE@[15; 20) "\n " | ||
14 | FN_DEF@[20; 161) | ||
15 | FN_KW@[20; 22) "fn" | ||
16 | WHITESPACE@[22; 23) " " | ||
17 | NAME@[23; 32) | ||
18 | IDENT@[23; 32) "new_scope" | ||
19 | PARAM_LIST@[32; 35) | ||
20 | L_PAREN@[32; 33) "(" | ||
21 | PARAM@[33; 34) | ||
22 | REF_PAT@[33; 34) | ||
23 | AMP@[33; 34) "&" | ||
24 | R_PAREN@[34; 35) ")" | ||
25 | WHITESPACE@[35; 36) " " | ||
26 | RET_TYPE@[36; 46) | ||
27 | THIN_ARROW@[36; 38) "->" | ||
28 | WHITESPACE@[38; 39) " " | ||
29 | PATH_TYPE@[39; 46) | ||
30 | PATH@[39; 46) | ||
31 | PATH_SEGMENT@[39; 46) | ||
32 | NAME_REF@[39; 46) | ||
33 | IDENT@[39; 46) "ScopeId" | ||
34 | WHITESPACE@[46; 47) " " | ||
35 | BLOCK@[47; 161) | ||
36 | L_CURLY@[47; 48) "{" | ||
37 | WHITESPACE@[48; 57) "\n " | ||
38 | LET_STMT@[57; 85) | ||
39 | LET_KW@[57; 60) "let" | ||
40 | WHITESPACE@[60; 61) " " | ||
41 | BIND_PAT@[61; 64) | ||
42 | NAME@[61; 64) | ||
43 | IDENT@[61; 64) "res" | ||
44 | WHITESPACE@[64; 65) " " | ||
45 | EQ@[65; 66) "=" | ||
46 | WHITESPACE@[66; 67) " " | ||
47 | METHOD_CALL_EXPR@[67; 84) | ||
48 | FIELD_EXPR@[67; 78) | ||
49 | PATH_EXPR@[67; 71) | ||
50 | PATH@[67; 71) | ||
51 | PATH_SEGMENT@[67; 71) | ||
52 | SELF_KW@[67; 71) "self" | ||
53 | DOT@[71; 72) "." | ||
54 | NAME_REF@[72; 78) | ||
55 | IDENT@[72; 78) "scopes" | ||
56 | DOT@[78; 79) "." | ||
57 | NAME_REF@[79; 82) | ||
58 | IDENT@[79; 82) "len" | ||
59 | ARG_LIST@[82; 84) | ||
60 | L_PAREN@[82; 83) "(" | ||
61 | R_PAREN@[83; 84) ")" | ||
62 | SEMI@[84; 85) ";" | ||
63 | WHITESPACE@[85; 94) "\n " | ||
64 | METHOD_CALL_EXPR@[94; 155) | ||
65 | FIELD_EXPR@[94; 105) | ||
66 | PATH_EXPR@[94; 98) | ||
67 | PATH@[94; 98) | ||
68 | PATH_SEGMENT@[94; 98) | ||
69 | SELF_KW@[94; 98) "self" | ||
70 | DOT@[98; 99) "." | ||
71 | NAME_REF@[99; 105) | ||
72 | IDENT@[99; 105) "scopes" | ||
73 | DOT@[105; 106) "." | ||
74 | NAME_REF@[106; 110) | ||
75 | IDENT@[106; 110) "push" | ||
76 | ARG_LIST@[110; 155) | ||
77 | L_PAREN@[110; 111) "(" | ||
78 | STRUCT_LIT@[111; 154) | ||
79 | PATH@[111; 120) | ||
80 | PATH_SEGMENT@[111; 120) | ||
81 | NAME_REF@[111; 120) | ||
82 | IDENT@[111; 120) "ScopeData" | ||
83 | WHITESPACE@[120; 121) " " | ||
84 | NAMED_FIELD_LIST@[121; 154) | ||
85 | L_CURLY@[121; 122) "{" | ||
86 | WHITESPACE@[122; 123) " " | ||
87 | NAMED_FIELD@[123; 135) | ||
88 | NAME_REF@[123; 129) | ||
89 | IDENT@[123; 129) "parent" | ||
90 | COLON@[129; 130) ":" | ||
91 | WHITESPACE@[130; 131) " " | ||
92 | PATH_EXPR@[131; 135) | ||
93 | PATH@[131; 135) | ||
94 | PATH_SEGMENT@[131; 135) | ||
95 | NAME_REF@[131; 135) | ||
96 | IDENT@[131; 135) "None" | ||
97 | COMMA@[135; 136) "," | ||
98 | WHITESPACE@[136; 137) " " | ||
99 | NAMED_FIELD@[137; 152) | ||
100 | NAME_REF@[137; 144) | ||
101 | IDENT@[137; 144) "entries" | ||
102 | COLON@[144; 145) ":" | ||
103 | WHITESPACE@[145; 146) " " | ||
104 | MACRO_CALL@[146; 152) | ||
105 | PATH@[146; 149) | ||
106 | PATH_SEGMENT@[146; 149) | ||
107 | NAME_REF@[146; 149) | ||
108 | IDENT@[146; 149) "vec" | ||
109 | EXCL@[149; 150) "!" | ||
110 | TOKEN_TREE@[150; 152) | ||
111 | L_BRACK@[150; 151) "[" | ||
112 | R_BRACK@[151; 152) "]" | ||
113 | WHITESPACE@[152; 153) " " | ||
114 | R_CURLY@[153; 154) "}" | ||
115 | R_PAREN@[154; 155) ")" | ||
116 | WHITESPACE@[155; 160) "\n " | ||
117 | R_CURLY@[160; 161) "}" | ||
118 | WHITESPACE@[161; 167) "\n\n " | ||
119 | FN_DEF@[167; 180) | ||
120 | FN_KW@[167; 169) "fn" | ||
121 | WHITESPACE@[169; 170) " " | ||
122 | NAME@[170; 180) | ||
123 | IDENT@[170; 180) "set_parent" | ||
124 | WHITESPACE@[180; 181) "\n" | ||
125 | R_CURLY@[181; 182) "}" | ||
126 | WHITESPACE@[182; 183) "\n" | ||
127 | error 34: expected pattern | ||
128 | error 34: expected COLON | ||
129 | error 34: expected type | ||
130 | error 180: expected function arguments | ||
131 | error 180: expected a block | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rs b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rs new file mode 100644 index 000000000..48bf3d68b --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rs | |||
@@ -0,0 +1,12 @@ | |||
1 | fn foo() { | ||
2 | let foo = | ||
3 | let bar = 1; | ||
4 | let | ||
5 | let baz = 92; | ||
6 | let | ||
7 | if true {} | ||
8 | let | ||
9 | while true {} | ||
10 | let | ||
11 | loop {} | ||
12 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0019_let_recover.txt b/crates/ra_syntax/test_data/parser/err/0019_let_recover.txt new file mode 100644 index 000000000..b6710241e --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0019_let_recover.txt | |||
@@ -0,0 +1,103 @@ | |||
1 | SOURCE_FILE@[0; 139) | ||
2 | FN_DEF@[0; 138) | ||
3 | FN_KW@[0; 2) "fn" | ||
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; 138) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 15) "\n " | ||
14 | LET_STMT@[15; 24) | ||
15 | LET_KW@[15; 18) "let" | ||
16 | WHITESPACE@[18; 19) " " | ||
17 | BIND_PAT@[19; 22) | ||
18 | NAME@[19; 22) | ||
19 | IDENT@[19; 22) "foo" | ||
20 | WHITESPACE@[22; 23) " " | ||
21 | EQ@[23; 24) "=" | ||
22 | WHITESPACE@[24; 29) "\n " | ||
23 | LET_STMT@[29; 41) | ||
24 | LET_KW@[29; 32) "let" | ||
25 | WHITESPACE@[32; 33) " " | ||
26 | BIND_PAT@[33; 36) | ||
27 | NAME@[33; 36) | ||
28 | IDENT@[33; 36) "bar" | ||
29 | WHITESPACE@[36; 37) " " | ||
30 | EQ@[37; 38) "=" | ||
31 | WHITESPACE@[38; 39) " " | ||
32 | LITERAL@[39; 40) | ||
33 | INT_NUMBER@[39; 40) "1" | ||
34 | SEMI@[40; 41) ";" | ||
35 | WHITESPACE@[41; 46) "\n " | ||
36 | LET_STMT@[46; 49) | ||
37 | LET_KW@[46; 49) "let" | ||
38 | WHITESPACE@[49; 54) "\n " | ||
39 | LET_STMT@[54; 67) | ||
40 | LET_KW@[54; 57) "let" | ||
41 | WHITESPACE@[57; 58) " " | ||
42 | BIND_PAT@[58; 61) | ||
43 | NAME@[58; 61) | ||
44 | IDENT@[58; 61) "baz" | ||
45 | WHITESPACE@[61; 62) " " | ||
46 | EQ@[62; 63) "=" | ||
47 | WHITESPACE@[63; 64) " " | ||
48 | LITERAL@[64; 66) | ||
49 | INT_NUMBER@[64; 66) "92" | ||
50 | SEMI@[66; 67) ";" | ||
51 | WHITESPACE@[67; 72) "\n " | ||
52 | LET_STMT@[72; 75) | ||
53 | LET_KW@[72; 75) "let" | ||
54 | WHITESPACE@[75; 80) "\n " | ||
55 | EXPR_STMT@[80; 90) | ||
56 | IF_EXPR@[80; 90) | ||
57 | IF_KW@[80; 82) "if" | ||
58 | WHITESPACE@[82; 83) " " | ||
59 | CONDITION@[83; 87) | ||
60 | LITERAL@[83; 87) | ||
61 | TRUE_KW@[83; 87) "true" | ||
62 | WHITESPACE@[87; 88) " " | ||
63 | BLOCK@[88; 90) | ||
64 | L_CURLY@[88; 89) "{" | ||
65 | R_CURLY@[89; 90) "}" | ||
66 | WHITESPACE@[90; 95) "\n " | ||
67 | LET_STMT@[95; 98) | ||
68 | LET_KW@[95; 98) "let" | ||
69 | WHITESPACE@[98; 103) "\n " | ||
70 | EXPR_STMT@[103; 116) | ||
71 | WHILE_EXPR@[103; 116) | ||
72 | WHILE_KW@[103; 108) "while" | ||
73 | WHITESPACE@[108; 109) " " | ||
74 | CONDITION@[109; 113) | ||
75 | LITERAL@[109; 113) | ||
76 | TRUE_KW@[109; 113) "true" | ||
77 | WHITESPACE@[113; 114) " " | ||
78 | BLOCK@[114; 116) | ||
79 | L_CURLY@[114; 115) "{" | ||
80 | R_CURLY@[115; 116) "}" | ||
81 | WHITESPACE@[116; 121) "\n " | ||
82 | LET_STMT@[121; 124) | ||
83 | LET_KW@[121; 124) "let" | ||
84 | WHITESPACE@[124; 129) "\n " | ||
85 | LOOP_EXPR@[129; 136) | ||
86 | LOOP_KW@[129; 133) "loop" | ||
87 | WHITESPACE@[133; 134) " " | ||
88 | BLOCK@[134; 136) | ||
89 | L_CURLY@[134; 135) "{" | ||
90 | R_CURLY@[135; 136) "}" | ||
91 | WHITESPACE@[136; 137) "\n" | ||
92 | R_CURLY@[137; 138) "}" | ||
93 | WHITESPACE@[138; 139) "\n" | ||
94 | error 24: expected expression | ||
95 | error 24: expected SEMI | ||
96 | error 49: expected pattern | ||
97 | error 49: expected SEMI | ||
98 | error 75: expected pattern | ||
99 | error 75: expected SEMI | ||
100 | error 98: expected pattern | ||
101 | error 98: expected SEMI | ||
102 | error 124: expected pattern | ||
103 | error 124: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rs b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rs new file mode 100644 index 000000000..3393b668b --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn | ||
2 | |||
3 | fn foo() {} | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0020_fn_recover.txt b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.txt new file mode 100644 index 000000000..71c014028 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.txt | |||
@@ -0,0 +1,20 @@ | |||
1 | SOURCE_FILE@[0; 16) | ||
2 | FN_DEF@[0; 2) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 4) "\n\n" | ||
5 | FN_DEF@[4; 15) | ||
6 | FN_KW@[4; 6) "fn" | ||
7 | WHITESPACE@[6; 7) " " | ||
8 | NAME@[7; 10) | ||
9 | IDENT@[7; 10) "foo" | ||
10 | PARAM_LIST@[10; 12) | ||
11 | L_PAREN@[10; 11) "(" | ||
12 | R_PAREN@[11; 12) ")" | ||
13 | WHITESPACE@[12; 13) " " | ||
14 | BLOCK@[13; 15) | ||
15 | L_CURLY@[13; 14) "{" | ||
16 | R_CURLY@[14; 15) "}" | ||
17 | WHITESPACE@[15; 16) "\n" | ||
18 | error 2: expected a name | ||
19 | error 2: expected function arguments | ||
20 | error 2: expected a block | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rs b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rs new file mode 100644 index 000000000..7a6c264f6 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | fn foo(x: i32, y) { | ||
2 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.txt b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.txt new file mode 100644 index 000000000..c125a0bc9 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | SOURCE_FILE@[0; 22) | ||
2 | FN_DEF@[0; 21) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 17) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | PARAM@[7; 13) | ||
10 | BIND_PAT@[7; 8) | ||
11 | NAME@[7; 8) | ||
12 | IDENT@[7; 8) "x" | ||
13 | COLON@[8; 9) ":" | ||
14 | WHITESPACE@[9; 10) " " | ||
15 | PATH_TYPE@[10; 13) | ||
16 | PATH@[10; 13) | ||
17 | PATH_SEGMENT@[10; 13) | ||
18 | NAME_REF@[10; 13) | ||
19 | IDENT@[10; 13) "i32" | ||
20 | COMMA@[13; 14) "," | ||
21 | WHITESPACE@[14; 15) " " | ||
22 | PARAM@[15; 16) | ||
23 | BIND_PAT@[15; 16) | ||
24 | NAME@[15; 16) | ||
25 | IDENT@[15; 16) "y" | ||
26 | R_PAREN@[16; 17) ")" | ||
27 | WHITESPACE@[17; 18) " " | ||
28 | BLOCK@[18; 21) | ||
29 | L_CURLY@[18; 19) "{" | ||
30 | WHITESPACE@[19; 20) "\n" | ||
31 | R_CURLY@[20; 21) "}" | ||
32 | WHITESPACE@[21; 22) "\n" | ||
33 | error 16: expected COLON | ||
34 | error 16: expected type | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rs b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rs new file mode 100644 index 000000000..cd2d493a1 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn a() { [1, 2, @, struct, let] } | ||
2 | fn b() { foo(1, 2, @, impl, let) } | ||
3 | fn c() { foo.bar(1, 2, @, ], trait, let) } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt new file mode 100644 index 000000000..32b53bba7 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt | |||
@@ -0,0 +1,189 @@ | |||
1 | SOURCE_FILE@[0; 112) | ||
2 | FN_DEF@[0; 33) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 4) | ||
6 | IDENT@[3; 4) "a" | ||
7 | PARAM_LIST@[4; 6) | ||
8 | L_PAREN@[4; 5) "(" | ||
9 | R_PAREN@[5; 6) ")" | ||
10 | WHITESPACE@[6; 7) " " | ||
11 | BLOCK@[7; 33) | ||
12 | L_CURLY@[7; 8) "{" | ||
13 | WHITESPACE@[8; 9) " " | ||
14 | EXPR_STMT@[9; 15) | ||
15 | ARRAY_EXPR@[9; 15) | ||
16 | L_BRACK@[9; 10) "[" | ||
17 | LITERAL@[10; 11) | ||
18 | INT_NUMBER@[10; 11) "1" | ||
19 | COMMA@[11; 12) "," | ||
20 | WHITESPACE@[12; 13) " " | ||
21 | LITERAL@[13; 14) | ||
22 | INT_NUMBER@[13; 14) "2" | ||
23 | COMMA@[14; 15) "," | ||
24 | WHITESPACE@[15; 16) " " | ||
25 | EXPR_STMT@[16; 17) | ||
26 | ERROR@[16; 17) | ||
27 | AT@[16; 17) "@" | ||
28 | EXPR_STMT@[17; 18) | ||
29 | ERROR@[17; 18) | ||
30 | COMMA@[17; 18) "," | ||
31 | WHITESPACE@[18; 19) " " | ||
32 | STRUCT_DEF@[19; 26) | ||
33 | STRUCT_KW@[19; 25) "struct" | ||
34 | ERROR@[25; 26) | ||
35 | COMMA@[25; 26) "," | ||
36 | WHITESPACE@[26; 27) " " | ||
37 | LET_STMT@[27; 31) | ||
38 | LET_KW@[27; 30) "let" | ||
39 | ERROR@[30; 31) | ||
40 | R_BRACK@[30; 31) "]" | ||
41 | WHITESPACE@[31; 32) " " | ||
42 | R_CURLY@[32; 33) "}" | ||
43 | WHITESPACE@[33; 34) "\n" | ||
44 | FN_DEF@[34; 68) | ||
45 | FN_KW@[34; 36) "fn" | ||
46 | WHITESPACE@[36; 37) " " | ||
47 | NAME@[37; 38) | ||
48 | IDENT@[37; 38) "b" | ||
49 | PARAM_LIST@[38; 40) | ||
50 | L_PAREN@[38; 39) "(" | ||
51 | R_PAREN@[39; 40) ")" | ||
52 | WHITESPACE@[40; 41) " " | ||
53 | BLOCK@[41; 68) | ||
54 | L_CURLY@[41; 42) "{" | ||
55 | WHITESPACE@[42; 43) " " | ||
56 | EXPR_STMT@[43; 52) | ||
57 | CALL_EXPR@[43; 52) | ||
58 | PATH_EXPR@[43; 46) | ||
59 | PATH@[43; 46) | ||
60 | PATH_SEGMENT@[43; 46) | ||
61 | NAME_REF@[43; 46) | ||
62 | IDENT@[43; 46) "foo" | ||
63 | ARG_LIST@[46; 52) | ||
64 | L_PAREN@[46; 47) "(" | ||
65 | LITERAL@[47; 48) | ||
66 | INT_NUMBER@[47; 48) "1" | ||
67 | COMMA@[48; 49) "," | ||
68 | WHITESPACE@[49; 50) " " | ||
69 | LITERAL@[50; 51) | ||
70 | INT_NUMBER@[50; 51) "2" | ||
71 | COMMA@[51; 52) "," | ||
72 | WHITESPACE@[52; 53) " " | ||
73 | EXPR_STMT@[53; 54) | ||
74 | ERROR@[53; 54) | ||
75 | AT@[53; 54) "@" | ||
76 | EXPR_STMT@[54; 55) | ||
77 | ERROR@[54; 55) | ||
78 | COMMA@[54; 55) "," | ||
79 | WHITESPACE@[55; 56) " " | ||
80 | IMPL_BLOCK@[56; 60) | ||
81 | IMPL_KW@[56; 60) "impl" | ||
82 | EXPR_STMT@[60; 61) | ||
83 | ERROR@[60; 61) | ||
84 | COMMA@[60; 61) "," | ||
85 | WHITESPACE@[61; 62) " " | ||
86 | LET_STMT@[62; 65) | ||
87 | LET_KW@[62; 65) "let" | ||
88 | ERROR@[65; 66) | ||
89 | R_PAREN@[65; 66) ")" | ||
90 | WHITESPACE@[66; 67) " " | ||
91 | R_CURLY@[67; 68) "}" | ||
92 | WHITESPACE@[68; 69) "\n" | ||
93 | FN_DEF@[69; 111) | ||
94 | FN_KW@[69; 71) "fn" | ||
95 | WHITESPACE@[71; 72) " " | ||
96 | NAME@[72; 73) | ||
97 | IDENT@[72; 73) "c" | ||
98 | PARAM_LIST@[73; 75) | ||
99 | L_PAREN@[73; 74) "(" | ||
100 | R_PAREN@[74; 75) ")" | ||
101 | WHITESPACE@[75; 76) " " | ||
102 | BLOCK@[76; 111) | ||
103 | L_CURLY@[76; 77) "{" | ||
104 | WHITESPACE@[77; 78) " " | ||
105 | EXPR_STMT@[78; 91) | ||
106 | METHOD_CALL_EXPR@[78; 91) | ||
107 | PATH_EXPR@[78; 81) | ||
108 | PATH@[78; 81) | ||
109 | PATH_SEGMENT@[78; 81) | ||
110 | NAME_REF@[78; 81) | ||
111 | IDENT@[78; 81) "foo" | ||
112 | DOT@[81; 82) "." | ||
113 | NAME_REF@[82; 85) | ||
114 | IDENT@[82; 85) "bar" | ||
115 | ARG_LIST@[85; 91) | ||
116 | L_PAREN@[85; 86) "(" | ||
117 | LITERAL@[86; 87) | ||
118 | INT_NUMBER@[86; 87) "1" | ||
119 | COMMA@[87; 88) "," | ||
120 | WHITESPACE@[88; 89) " " | ||
121 | LITERAL@[89; 90) | ||
122 | INT_NUMBER@[89; 90) "2" | ||
123 | COMMA@[90; 91) "," | ||
124 | WHITESPACE@[91; 92) " " | ||
125 | EXPR_STMT@[92; 93) | ||
126 | ERROR@[92; 93) | ||
127 | AT@[92; 93) "@" | ||
128 | EXPR_STMT@[93; 94) | ||
129 | ERROR@[93; 94) | ||
130 | COMMA@[93; 94) "," | ||
131 | WHITESPACE@[94; 95) " " | ||
132 | EXPR_STMT@[95; 96) | ||
133 | ERROR@[95; 96) | ||
134 | R_BRACK@[95; 96) "]" | ||
135 | EXPR_STMT@[96; 97) | ||
136 | ERROR@[96; 97) | ||
137 | COMMA@[96; 97) "," | ||
138 | WHITESPACE@[97; 98) " " | ||
139 | TRAIT_DEF@[98; 104) | ||
140 | TRAIT_KW@[98; 103) "trait" | ||
141 | ERROR@[103; 104) | ||
142 | COMMA@[103; 104) "," | ||
143 | WHITESPACE@[104; 105) " " | ||
144 | LET_STMT@[105; 108) | ||
145 | LET_KW@[105; 108) "let" | ||
146 | ERROR@[108; 109) | ||
147 | R_PAREN@[108; 109) ")" | ||
148 | WHITESPACE@[109; 110) " " | ||
149 | R_CURLY@[110; 111) "}" | ||
150 | WHITESPACE@[111; 112) "\n" | ||
151 | error 15: expected expression | ||
152 | error 15: expected R_BRACK | ||
153 | error 15: expected SEMI | ||
154 | error 16: expected expression | ||
155 | error 17: expected SEMI | ||
156 | error 17: expected expression | ||
157 | error 18: expected SEMI | ||
158 | error 25: expected a name | ||
159 | error 26: expected `;`, `{`, or `(` | ||
160 | error 30: expected pattern | ||
161 | error 31: expected SEMI | ||
162 | error 52: expected expression | ||
163 | error 52: expected SEMI | ||
164 | error 53: expected expression | ||
165 | error 54: expected SEMI | ||
166 | error 54: expected expression | ||
167 | error 55: expected SEMI | ||
168 | error 60: expected type | ||
169 | error 60: expected `{` | ||
170 | error 60: expected expression | ||
171 | error 61: expected SEMI | ||
172 | error 65: expected pattern | ||
173 | error 65: expected SEMI | ||
174 | error 65: expected expression | ||
175 | error 91: expected expression | ||
176 | error 91: expected SEMI | ||
177 | error 92: expected expression | ||
178 | error 93: expected SEMI | ||
179 | error 93: expected expression | ||
180 | error 94: expected SEMI | ||
181 | error 95: expected expression | ||
182 | error 96: expected SEMI | ||
183 | error 96: expected expression | ||
184 | error 97: expected SEMI | ||
185 | error 103: expected a name | ||
186 | error 104: expected `{` | ||
187 | error 108: expected pattern | ||
188 | error 108: expected SEMI | ||
189 | error 108: expected expression | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rs b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rs new file mode 100644 index 000000000..0206d563e --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn main() { | ||
2 | foo! ( | ||
3 | bar, "baz", 1, 2.0 | ||
4 | } //~ ERROR incorrect close delimiter | ||
5 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.txt b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.txt new file mode 100644 index 000000000..f2515faa7 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | SOURCE_FILE@[0; 94) | ||
2 | FN_DEF@[0; 55) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK@[10; 55) | ||
12 | L_CURLY@[10; 11) "{" | ||
13 | WHITESPACE@[11; 16) "\n " | ||
14 | MACRO_CALL@[16; 49) | ||
15 | PATH@[16; 19) | ||
16 | PATH_SEGMENT@[16; 19) | ||
17 | NAME_REF@[16; 19) | ||
18 | IDENT@[16; 19) "foo" | ||
19 | EXCL@[19; 20) "!" | ||
20 | WHITESPACE@[20; 21) " " | ||
21 | TOKEN_TREE@[21; 49) | ||
22 | L_PAREN@[21; 22) "(" | ||
23 | WHITESPACE@[22; 31) "\n " | ||
24 | IDENT@[31; 34) "bar" | ||
25 | COMMA@[34; 35) "," | ||
26 | WHITESPACE@[35; 36) " " | ||
27 | STRING@[36; 41) "\"baz\"" | ||
28 | COMMA@[41; 42) "," | ||
29 | WHITESPACE@[42; 43) " " | ||
30 | INT_NUMBER@[43; 44) "1" | ||
31 | COMMA@[44; 45) "," | ||
32 | WHITESPACE@[45; 46) " " | ||
33 | FLOAT_NUMBER@[46; 49) "2.0" | ||
34 | WHITESPACE@[49; 54) "\n " | ||
35 | R_CURLY@[54; 55) "}" | ||
36 | WHITESPACE@[55; 56) " " | ||
37 | COMMENT@[56; 91) "//~ ERROR incorrect c ..." | ||
38 | WHITESPACE@[91; 92) "\n" | ||
39 | ERROR@[92; 93) | ||
40 | R_CURLY@[92; 93) "}" | ||
41 | WHITESPACE@[93; 94) "\n" | ||
42 | error 49: unmatched `}` | ||
43 | error 92: unmatched `}` | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rs b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rs new file mode 100644 index 000000000..6c2e95c02 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | fn f<T: (Copy) + (?Sized) + (for<'a> Trait<'a>)>() {} | ||
2 | |||
3 | fn main() { | ||
4 | let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>; | ||
5 | let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Copy)>; | ||
6 | let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>; | ||
7 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.txt b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.txt new file mode 100644 index 000000000..faf0fe462 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.txt | |||
@@ -0,0 +1,324 @@ | |||
1 | SOURCE_FILE@[0; 240) | ||
2 | FN_DEF@[0; 53) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 4) | ||
6 | IDENT@[3; 4) "f" | ||
7 | TYPE_PARAM_LIST@[4; 48) | ||
8 | L_ANGLE@[4; 5) "<" | ||
9 | TYPE_PARAM@[5; 47) | ||
10 | NAME@[5; 6) | ||
11 | IDENT@[5; 6) "T" | ||
12 | COLON@[6; 7) ":" | ||
13 | WHITESPACE@[7; 8) " " | ||
14 | TYPE_BOUND_LIST@[8; 47) | ||
15 | TYPE_BOUND@[8; 14) | ||
16 | L_PAREN@[8; 9) "(" | ||
17 | PATH_TYPE@[9; 13) | ||
18 | PATH@[9; 13) | ||
19 | PATH_SEGMENT@[9; 13) | ||
20 | NAME_REF@[9; 13) | ||
21 | IDENT@[9; 13) "Copy" | ||
22 | R_PAREN@[13; 14) ")" | ||
23 | WHITESPACE@[14; 15) " " | ||
24 | PLUS@[15; 16) "+" | ||
25 | WHITESPACE@[16; 17) " " | ||
26 | TYPE_BOUND@[17; 25) | ||
27 | L_PAREN@[17; 18) "(" | ||
28 | QUESTION@[18; 19) "?" | ||
29 | PATH_TYPE@[19; 24) | ||
30 | PATH@[19; 24) | ||
31 | PATH_SEGMENT@[19; 24) | ||
32 | NAME_REF@[19; 24) | ||
33 | IDENT@[19; 24) "Sized" | ||
34 | R_PAREN@[24; 25) ")" | ||
35 | WHITESPACE@[25; 26) " " | ||
36 | PLUS@[26; 27) "+" | ||
37 | WHITESPACE@[27; 28) " " | ||
38 | TYPE_BOUND@[28; 47) | ||
39 | L_PAREN@[28; 29) "(" | ||
40 | FOR_TYPE@[29; 46) | ||
41 | FOR_KW@[29; 32) "for" | ||
42 | TYPE_PARAM_LIST@[32; 36) | ||
43 | L_ANGLE@[32; 33) "<" | ||
44 | LIFETIME_PARAM@[33; 35) | ||
45 | LIFETIME@[33; 35) "\'a" | ||
46 | R_ANGLE@[35; 36) ">" | ||
47 | WHITESPACE@[36; 37) " " | ||
48 | PATH_TYPE@[37; 46) | ||
49 | PATH@[37; 46) | ||
50 | PATH_SEGMENT@[37; 46) | ||
51 | NAME_REF@[37; 42) | ||
52 | IDENT@[37; 42) "Trait" | ||
53 | TYPE_ARG_LIST@[42; 46) | ||
54 | L_ANGLE@[42; 43) "<" | ||
55 | LIFETIME_ARG@[43; 45) | ||
56 | LIFETIME@[43; 45) "\'a" | ||
57 | R_ANGLE@[45; 46) ">" | ||
58 | R_PAREN@[46; 47) ")" | ||
59 | R_ANGLE@[47; 48) ">" | ||
60 | PARAM_LIST@[48; 50) | ||
61 | L_PAREN@[48; 49) "(" | ||
62 | R_PAREN@[49; 50) ")" | ||
63 | WHITESPACE@[50; 51) " " | ||
64 | BLOCK@[51; 53) | ||
65 | L_CURLY@[51; 52) "{" | ||
66 | R_CURLY@[52; 53) "}" | ||
67 | WHITESPACE@[53; 55) "\n\n" | ||
68 | FN_DEF@[55; 239) | ||
69 | FN_KW@[55; 57) "fn" | ||
70 | WHITESPACE@[57; 58) " " | ||
71 | NAME@[58; 62) | ||
72 | IDENT@[58; 62) "main" | ||
73 | PARAM_LIST@[62; 64) | ||
74 | L_PAREN@[62; 63) "(" | ||
75 | R_PAREN@[63; 64) ")" | ||
76 | WHITESPACE@[64; 65) " " | ||
77 | BLOCK@[65; 239) | ||
78 | L_CURLY@[65; 66) "{" | ||
79 | WHITESPACE@[66; 71) "\n " | ||
80 | LET_STMT@[71; 121) | ||
81 | LET_KW@[71; 74) "let" | ||
82 | WHITESPACE@[74; 75) " " | ||
83 | PLACEHOLDER_PAT@[75; 76) | ||
84 | UNDERSCORE@[75; 76) "_" | ||
85 | COLON@[76; 77) ":" | ||
86 | WHITESPACE@[77; 78) " " | ||
87 | DYN_TRAIT_TYPE@[78; 121) | ||
88 | TYPE_BOUND_LIST@[78; 121) | ||
89 | TYPE_BOUND@[78; 88) | ||
90 | PATH_TYPE@[78; 88) | ||
91 | PATH@[78; 88) | ||
92 | PATH_SEGMENT@[78; 88) | ||
93 | NAME_REF@[78; 81) | ||
94 | IDENT@[78; 81) "Box" | ||
95 | TYPE_ARG_LIST@[81; 88) | ||
96 | L_ANGLE@[81; 82) "<" | ||
97 | TYPE_ARG@[82; 88) | ||
98 | PAREN_TYPE@[82; 88) | ||
99 | L_PAREN@[82; 83) "(" | ||
100 | PATH_TYPE@[83; 87) | ||
101 | PATH@[83; 87) | ||
102 | PATH_SEGMENT@[83; 87) | ||
103 | NAME_REF@[83; 87) | ||
104 | IDENT@[83; 87) "Copy" | ||
105 | R_PAREN@[87; 88) ")" | ||
106 | WHITESPACE@[88; 89) " " | ||
107 | PLUS@[89; 90) "+" | ||
108 | WHITESPACE@[90; 91) " " | ||
109 | TYPE_BOUND@[91; 99) | ||
110 | L_PAREN@[91; 92) "(" | ||
111 | QUESTION@[92; 93) "?" | ||
112 | PATH_TYPE@[93; 98) | ||
113 | PATH@[93; 98) | ||
114 | PATH_SEGMENT@[93; 98) | ||
115 | NAME_REF@[93; 98) | ||
116 | IDENT@[93; 98) "Sized" | ||
117 | R_PAREN@[98; 99) ")" | ||
118 | WHITESPACE@[99; 100) " " | ||
119 | PLUS@[100; 101) "+" | ||
120 | WHITESPACE@[101; 102) " " | ||
121 | TYPE_BOUND@[102; 121) | ||
122 | L_PAREN@[102; 103) "(" | ||
123 | FOR_TYPE@[103; 120) | ||
124 | FOR_KW@[103; 106) "for" | ||
125 | TYPE_PARAM_LIST@[106; 110) | ||
126 | L_ANGLE@[106; 107) "<" | ||
127 | LIFETIME_PARAM@[107; 109) | ||
128 | LIFETIME@[107; 109) "\'a" | ||
129 | R_ANGLE@[109; 110) ">" | ||
130 | WHITESPACE@[110; 111) " " | ||
131 | PATH_TYPE@[111; 120) | ||
132 | PATH@[111; 120) | ||
133 | PATH_SEGMENT@[111; 120) | ||
134 | NAME_REF@[111; 116) | ||
135 | IDENT@[111; 116) "Trait" | ||
136 | TYPE_ARG_LIST@[116; 120) | ||
137 | L_ANGLE@[116; 117) "<" | ||
138 | LIFETIME_ARG@[117; 119) | ||
139 | LIFETIME@[117; 119) "\'a" | ||
140 | R_ANGLE@[119; 120) ">" | ||
141 | R_PAREN@[120; 121) ")" | ||
142 | EXPR_STMT@[121; 123) | ||
143 | ERROR@[121; 122) | ||
144 | R_ANGLE@[121; 122) ">" | ||
145 | SEMI@[122; 123) ";" | ||
146 | WHITESPACE@[123; 128) "\n " | ||
147 | LET_STMT@[128; 141) | ||
148 | LET_KW@[128; 131) "let" | ||
149 | WHITESPACE@[131; 132) " " | ||
150 | PLACEHOLDER_PAT@[132; 133) | ||
151 | UNDERSCORE@[132; 133) "_" | ||
152 | COLON@[133; 134) ":" | ||
153 | WHITESPACE@[134; 135) " " | ||
154 | PATH_TYPE@[135; 141) | ||
155 | PATH@[135; 141) | ||
156 | PATH_SEGMENT@[135; 141) | ||
157 | NAME_REF@[135; 138) | ||
158 | IDENT@[135; 138) "Box" | ||
159 | TYPE_ARG_LIST@[138; 141) | ||
160 | L_ANGLE@[138; 139) "<" | ||
161 | TYPE_ARG@[139; 141) | ||
162 | PAREN_TYPE@[139; 141) | ||
163 | L_PAREN@[139; 140) "(" | ||
164 | ERROR@[140; 141) | ||
165 | QUESTION@[140; 141) "?" | ||
166 | EXPR_STMT@[141; 146) | ||
167 | PATH_EXPR@[141; 146) | ||
168 | PATH@[141; 146) | ||
169 | PATH_SEGMENT@[141; 146) | ||
170 | NAME_REF@[141; 146) | ||
171 | IDENT@[141; 146) "Sized" | ||
172 | EXPR_STMT@[146; 147) | ||
173 | ERROR@[146; 147) | ||
174 | R_PAREN@[146; 147) ")" | ||
175 | WHITESPACE@[147; 148) " " | ||
176 | EXPR_STMT@[148; 149) | ||
177 | ERROR@[148; 149) | ||
178 | PLUS@[148; 149) "+" | ||
179 | WHITESPACE@[149; 150) " " | ||
180 | EXPR_STMT@[150; 151) | ||
181 | PAREN_EXPR@[150; 151) | ||
182 | L_PAREN@[150; 151) "(" | ||
183 | EXPR_STMT@[151; 157) | ||
184 | FOR_EXPR@[151; 157) | ||
185 | FOR_KW@[151; 154) "for" | ||
186 | ERROR@[154; 155) | ||
187 | L_ANGLE@[154; 155) "<" | ||
188 | ERROR@[155; 157) | ||
189 | LIFETIME@[155; 157) "\'a" | ||
190 | EXPR_STMT@[157; 158) | ||
191 | ERROR@[157; 158) | ||
192 | R_ANGLE@[157; 158) ">" | ||
193 | WHITESPACE@[158; 159) " " | ||
194 | EXPR_STMT@[159; 180) | ||
195 | BIN_EXPR@[159; 180) | ||
196 | BIN_EXPR@[159; 178) | ||
197 | BIN_EXPR@[159; 169) | ||
198 | BIN_EXPR@[159; 167) | ||
199 | PATH_EXPR@[159; 164) | ||
200 | PATH@[159; 164) | ||
201 | PATH_SEGMENT@[159; 164) | ||
202 | NAME_REF@[159; 164) | ||
203 | IDENT@[159; 164) "Trait" | ||
204 | L_ANGLE@[164; 165) "<" | ||
205 | ERROR@[165; 167) | ||
206 | LIFETIME@[165; 167) "\'a" | ||
207 | R_ANGLE@[167; 168) ">" | ||
208 | ERROR@[168; 169) | ||
209 | R_PAREN@[168; 169) ")" | ||
210 | WHITESPACE@[169; 170) " " | ||
211 | PLUS@[170; 171) "+" | ||
212 | WHITESPACE@[171; 172) " " | ||
213 | PAREN_EXPR@[172; 178) | ||
214 | L_PAREN@[172; 173) "(" | ||
215 | PATH_EXPR@[173; 177) | ||
216 | PATH@[173; 177) | ||
217 | PATH_SEGMENT@[173; 177) | ||
218 | NAME_REF@[173; 177) | ||
219 | IDENT@[173; 177) "Copy" | ||
220 | R_PAREN@[177; 178) ")" | ||
221 | R_ANGLE@[178; 179) ">" | ||
222 | ERROR@[179; 180) | ||
223 | SEMI@[179; 180) ";" | ||
224 | WHITESPACE@[180; 185) "\n " | ||
225 | LET_STMT@[185; 235) | ||
226 | LET_KW@[185; 188) "let" | ||
227 | WHITESPACE@[188; 189) " " | ||
228 | PLACEHOLDER_PAT@[189; 190) | ||
229 | UNDERSCORE@[189; 190) "_" | ||
230 | COLON@[190; 191) ":" | ||
231 | WHITESPACE@[191; 192) " " | ||
232 | DYN_TRAIT_TYPE@[192; 235) | ||
233 | TYPE_BOUND_LIST@[192; 235) | ||
234 | TYPE_BOUND@[192; 215) | ||
235 | PATH_TYPE@[192; 215) | ||
236 | PATH@[192; 215) | ||
237 | PATH_SEGMENT@[192; 215) | ||
238 | NAME_REF@[192; 195) | ||
239 | IDENT@[192; 195) "Box" | ||
240 | TYPE_ARG_LIST@[195; 215) | ||
241 | L_ANGLE@[195; 196) "<" | ||
242 | TYPE_ARG@[196; 215) | ||
243 | PAREN_TYPE@[196; 215) | ||
244 | L_PAREN@[196; 197) "(" | ||
245 | FOR_TYPE@[197; 214) | ||
246 | FOR_KW@[197; 200) "for" | ||
247 | TYPE_PARAM_LIST@[200; 204) | ||
248 | L_ANGLE@[200; 201) "<" | ||
249 | LIFETIME_PARAM@[201; 203) | ||
250 | LIFETIME@[201; 203) "\'a" | ||
251 | R_ANGLE@[203; 204) ">" | ||
252 | WHITESPACE@[204; 205) " " | ||
253 | PATH_TYPE@[205; 214) | ||
254 | PATH@[205; 214) | ||
255 | PATH_SEGMENT@[205; 214) | ||
256 | NAME_REF@[205; 210) | ||
257 | IDENT@[205; 210) "Trait" | ||
258 | TYPE_ARG_LIST@[210; 214) | ||
259 | L_ANGLE@[210; 211) "<" | ||
260 | LIFETIME_ARG@[211; 213) | ||
261 | LIFETIME@[211; 213) "\'a" | ||
262 | R_ANGLE@[213; 214) ">" | ||
263 | R_PAREN@[214; 215) ")" | ||
264 | WHITESPACE@[215; 216) " " | ||
265 | PLUS@[216; 217) "+" | ||
266 | WHITESPACE@[217; 218) " " | ||
267 | TYPE_BOUND@[218; 224) | ||
268 | L_PAREN@[218; 219) "(" | ||
269 | PATH_TYPE@[219; 223) | ||
270 | PATH@[219; 223) | ||
271 | PATH_SEGMENT@[219; 223) | ||
272 | NAME_REF@[219; 223) | ||
273 | IDENT@[219; 223) "Copy" | ||
274 | R_PAREN@[223; 224) ")" | ||
275 | WHITESPACE@[224; 225) " " | ||
276 | PLUS@[225; 226) "+" | ||
277 | WHITESPACE@[226; 227) " " | ||
278 | TYPE_BOUND@[227; 235) | ||
279 | L_PAREN@[227; 228) "(" | ||
280 | QUESTION@[228; 229) "?" | ||
281 | PATH_TYPE@[229; 234) | ||
282 | PATH@[229; 234) | ||
283 | PATH_SEGMENT@[229; 234) | ||
284 | NAME_REF@[229; 234) | ||
285 | IDENT@[229; 234) "Sized" | ||
286 | R_PAREN@[234; 235) ")" | ||
287 | EXPR_STMT@[235; 237) | ||
288 | ERROR@[235; 236) | ||
289 | R_ANGLE@[235; 236) ">" | ||
290 | SEMI@[236; 237) ";" | ||
291 | WHITESPACE@[237; 238) "\n" | ||
292 | R_CURLY@[238; 239) "}" | ||
293 | WHITESPACE@[239; 240) "\n" | ||
294 | error 88: expected COMMA | ||
295 | error 88: expected R_ANGLE | ||
296 | error 121: expected SEMI | ||
297 | error 121: expected expression | ||
298 | error 140: expected type | ||
299 | error 141: expected R_PAREN | ||
300 | error 141: expected COMMA | ||
301 | error 141: expected R_ANGLE | ||
302 | error 141: expected SEMI | ||
303 | error 146: expected SEMI | ||
304 | error 146: expected expression | ||
305 | error 147: expected SEMI | ||
306 | error 148: expected expression | ||
307 | error 149: expected SEMI | ||
308 | error 151: expected expression | ||
309 | error 151: expected R_PAREN | ||
310 | error 151: expected SEMI | ||
311 | error 154: expected pattern | ||
312 | error 155: expected IN_KW | ||
313 | error 155: expected expression | ||
314 | error 157: expected a block | ||
315 | error 157: expected expression | ||
316 | error 158: expected SEMI | ||
317 | error 165: expected expression | ||
318 | error 168: expected expression | ||
319 | error 179: expected expression | ||
320 | error 180: expected SEMI | ||
321 | error 215: expected COMMA | ||
322 | error 215: expected R_ANGLE | ||
323 | error 235: expected SEMI | ||
324 | error 235: expected expression | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rs b/crates/ra_syntax/test_data/parser/err/0025_nope.rs new file mode 100644 index 000000000..28726ed51 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rs | |||
@@ -0,0 +1,31 @@ | |||
1 | fn main() { | ||
2 | enum Test { | ||
3 | Var1, | ||
4 | Var2(String), | ||
5 | Var3 { | ||
6 | abc: {}, //~ ERROR: expected type, found `{` | ||
7 | }, | ||
8 | } | ||
9 | |||
10 | // recover... | ||
11 | let a = 1; | ||
12 | enum Test2 { | ||
13 | Fine, | ||
14 | } | ||
15 | |||
16 | enum Test3 { | ||
17 | StillFine { | ||
18 | def: i32, | ||
19 | }, | ||
20 | } | ||
21 | |||
22 | { | ||
23 | // fail again | ||
24 | enum Test4 { | ||
25 | Nope(i32 {}) //~ ERROR: found `{` | ||
26 | //~^ ERROR: found `{` | ||
27 | } | ||
28 | } | ||
29 | // still recover later | ||
30 | let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_` | ||
31 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.txt b/crates/ra_syntax/test_data/parser/err/0025_nope.txt new file mode 100644 index 000000000..0a3952dc9 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.txt | |||
@@ -0,0 +1,203 @@ | |||
1 | SOURCE_FILE@[0; 575) | ||
2 | FN_DEF@[0; 574) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK@[10; 574) | ||
12 | L_CURLY@[10; 11) "{" | ||
13 | WHITESPACE@[11; 16) "\n " | ||
14 | ENUM_DEF@[16; 152) | ||
15 | ENUM_KW@[16; 20) "enum" | ||
16 | WHITESPACE@[20; 21) " " | ||
17 | NAME@[21; 25) | ||
18 | IDENT@[21; 25) "Test" | ||
19 | WHITESPACE@[25; 26) " " | ||
20 | ENUM_VARIANT_LIST@[26; 152) | ||
21 | L_CURLY@[26; 27) "{" | ||
22 | WHITESPACE@[27; 36) "\n " | ||
23 | ENUM_VARIANT@[36; 40) | ||
24 | NAME@[36; 40) | ||
25 | IDENT@[36; 40) "Var1" | ||
26 | COMMA@[40; 41) "," | ||
27 | WHITESPACE@[41; 50) "\n " | ||
28 | ENUM_VARIANT@[50; 62) | ||
29 | NAME@[50; 54) | ||
30 | IDENT@[50; 54) "Var2" | ||
31 | POS_FIELD_DEF_LIST@[54; 62) | ||
32 | L_PAREN@[54; 55) "(" | ||
33 | POS_FIELD_DEF@[55; 61) | ||
34 | PATH_TYPE@[55; 61) | ||
35 | PATH@[55; 61) | ||
36 | PATH_SEGMENT@[55; 61) | ||
37 | NAME_REF@[55; 61) | ||
38 | IDENT@[55; 61) "String" | ||
39 | R_PAREN@[61; 62) ")" | ||
40 | COMMA@[62; 63) "," | ||
41 | WHITESPACE@[63; 72) "\n " | ||
42 | ENUM_VARIANT@[72; 145) | ||
43 | NAME@[72; 76) | ||
44 | IDENT@[72; 76) "Var3" | ||
45 | WHITESPACE@[76; 77) " " | ||
46 | NAMED_FIELD_DEF_LIST@[77; 145) | ||
47 | L_CURLY@[77; 78) "{" | ||
48 | WHITESPACE@[78; 91) "\n " | ||
49 | NAMED_FIELD_DEF@[91; 95) | ||
50 | NAME@[91; 94) | ||
51 | IDENT@[91; 94) "abc" | ||
52 | COLON@[94; 95) ":" | ||
53 | WHITESPACE@[95; 96) " " | ||
54 | ERROR@[96; 98) | ||
55 | L_CURLY@[96; 97) "{" | ||
56 | R_CURLY@[97; 98) "}" | ||
57 | ERROR@[98; 99) | ||
58 | COMMA@[98; 99) "," | ||
59 | WHITESPACE@[99; 100) " " | ||
60 | COMMENT@[100; 135) "//~ ERROR: expected t ..." | ||
61 | WHITESPACE@[135; 144) "\n " | ||
62 | R_CURLY@[144; 145) "}" | ||
63 | COMMA@[145; 146) "," | ||
64 | WHITESPACE@[146; 151) "\n " | ||
65 | R_CURLY@[151; 152) "}" | ||
66 | WHITESPACE@[152; 158) "\n\n " | ||
67 | COMMENT@[158; 171) "// recover..." | ||
68 | WHITESPACE@[171; 176) "\n " | ||
69 | LET_STMT@[176; 186) | ||
70 | LET_KW@[176; 179) "let" | ||
71 | WHITESPACE@[179; 180) " " | ||
72 | BIND_PAT@[180; 181) | ||
73 | NAME@[180; 181) | ||
74 | IDENT@[180; 181) "a" | ||
75 | WHITESPACE@[181; 182) " " | ||
76 | EQ@[182; 183) "=" | ||
77 | WHITESPACE@[183; 184) " " | ||
78 | LITERAL@[184; 185) | ||
79 | INT_NUMBER@[184; 185) "1" | ||
80 | SEMI@[185; 186) ";" | ||
81 | WHITESPACE@[186; 191) "\n " | ||
82 | ENUM_DEF@[191; 223) | ||
83 | ENUM_KW@[191; 195) "enum" | ||
84 | WHITESPACE@[195; 196) " " | ||
85 | NAME@[196; 201) | ||
86 | IDENT@[196; 201) "Test2" | ||
87 | WHITESPACE@[201; 202) " " | ||
88 | ENUM_VARIANT_LIST@[202; 223) | ||
89 | L_CURLY@[202; 203) "{" | ||
90 | WHITESPACE@[203; 212) "\n " | ||
91 | ENUM_VARIANT@[212; 216) | ||
92 | NAME@[212; 216) | ||
93 | IDENT@[212; 216) "Fine" | ||
94 | COMMA@[216; 217) "," | ||
95 | WHITESPACE@[217; 222) "\n " | ||
96 | R_CURLY@[222; 223) "}" | ||
97 | WHITESPACE@[223; 229) "\n\n " | ||
98 | ENUM_DEF@[229; 300) | ||
99 | ENUM_KW@[229; 233) "enum" | ||
100 | WHITESPACE@[233; 234) " " | ||
101 | NAME@[234; 239) | ||
102 | IDENT@[234; 239) "Test3" | ||
103 | WHITESPACE@[239; 240) " " | ||
104 | ENUM_VARIANT_LIST@[240; 300) | ||
105 | L_CURLY@[240; 241) "{" | ||
106 | WHITESPACE@[241; 250) "\n " | ||
107 | ENUM_VARIANT@[250; 293) | ||
108 | NAME@[250; 259) | ||
109 | IDENT@[250; 259) "StillFine" | ||
110 | WHITESPACE@[259; 260) " " | ||
111 | NAMED_FIELD_DEF_LIST@[260; 293) | ||
112 | L_CURLY@[260; 261) "{" | ||
113 | WHITESPACE@[261; 274) "\n " | ||
114 | NAMED_FIELD_DEF@[274; 282) | ||
115 | NAME@[274; 277) | ||
116 | IDENT@[274; 277) "def" | ||
117 | COLON@[277; 278) ":" | ||
118 | WHITESPACE@[278; 279) " " | ||
119 | PATH_TYPE@[279; 282) | ||
120 | PATH@[279; 282) | ||
121 | PATH_SEGMENT@[279; 282) | ||
122 | NAME_REF@[279; 282) | ||
123 | IDENT@[279; 282) "i32" | ||
124 | COMMA@[282; 283) "," | ||
125 | WHITESPACE@[283; 292) "\n " | ||
126 | R_CURLY@[292; 293) "}" | ||
127 | COMMA@[293; 294) "," | ||
128 | WHITESPACE@[294; 299) "\n " | ||
129 | R_CURLY@[299; 300) "}" | ||
130 | WHITESPACE@[300; 306) "\n\n " | ||
131 | EXPR_STMT@[306; 459) | ||
132 | BLOCK_EXPR@[306; 459) | ||
133 | BLOCK@[306; 459) | ||
134 | L_CURLY@[306; 307) "{" | ||
135 | WHITESPACE@[307; 316) "\n " | ||
136 | ENUM_DEF@[316; 453) | ||
137 | COMMENT@[316; 329) "// fail again" | ||
138 | WHITESPACE@[329; 338) "\n " | ||
139 | ENUM_KW@[338; 342) "enum" | ||
140 | WHITESPACE@[342; 343) " " | ||
141 | NAME@[343; 348) | ||
142 | IDENT@[343; 348) "Test4" | ||
143 | WHITESPACE@[348; 349) " " | ||
144 | ENUM_VARIANT_LIST@[349; 453) | ||
145 | L_CURLY@[349; 350) "{" | ||
146 | WHITESPACE@[350; 363) "\n " | ||
147 | ENUM_VARIANT@[363; 372) | ||
148 | NAME@[363; 367) | ||
149 | IDENT@[363; 367) "Nope" | ||
150 | POS_FIELD_DEF_LIST@[367; 372) | ||
151 | L_PAREN@[367; 368) "(" | ||
152 | POS_FIELD_DEF@[368; 371) | ||
153 | PATH_TYPE@[368; 371) | ||
154 | PATH@[368; 371) | ||
155 | PATH_SEGMENT@[368; 371) | ||
156 | NAME_REF@[368; 371) | ||
157 | IDENT@[368; 371) "i32" | ||
158 | WHITESPACE@[371; 372) " " | ||
159 | ERROR@[372; 372) | ||
160 | ERROR@[372; 374) | ||
161 | L_CURLY@[372; 373) "{" | ||
162 | R_CURLY@[373; 374) "}" | ||
163 | ERROR@[374; 375) | ||
164 | R_PAREN@[374; 375) ")" | ||
165 | WHITESPACE@[375; 376) " " | ||
166 | COMMENT@[376; 396) "//~ ERROR: found `{`" | ||
167 | WHITESPACE@[396; 422) "\n ..." | ||
168 | COMMENT@[422; 443) "//~^ ERROR: found `{`" | ||
169 | WHITESPACE@[443; 452) "\n " | ||
170 | R_CURLY@[452; 453) "}" | ||
171 | WHITESPACE@[453; 458) "\n " | ||
172 | R_CURLY@[458; 459) "}" | ||
173 | WHITESPACE@[459; 464) "\n " | ||
174 | COMMENT@[464; 486) "// still recover later" | ||
175 | WHITESPACE@[486; 491) "\n " | ||
176 | LET_STMT@[491; 510) | ||
177 | LET_KW@[491; 494) "let" | ||
178 | WHITESPACE@[494; 495) " " | ||
179 | BIND_PAT@[495; 505) | ||
180 | NAME@[495; 505) | ||
181 | IDENT@[495; 505) "bad_syntax" | ||
182 | WHITESPACE@[505; 506) " " | ||
183 | EQ@[506; 507) "=" | ||
184 | WHITESPACE@[507; 508) " " | ||
185 | ERROR@[508; 509) | ||
186 | UNDERSCORE@[508; 509) "_" | ||
187 | SEMI@[509; 510) ";" | ||
188 | WHITESPACE@[510; 511) " " | ||
189 | COMMENT@[511; 572) "//~ ERROR: expected e ..." | ||
190 | WHITESPACE@[572; 573) "\n" | ||
191 | R_CURLY@[573; 574) "}" | ||
192 | WHITESPACE@[574; 575) "\n" | ||
193 | error 95: expected type | ||
194 | error 95: expected COMMA | ||
195 | error 96: expected field | ||
196 | error 98: expected field declaration | ||
197 | error 371: expected COMMA | ||
198 | error 372: expected a type | ||
199 | error 372: expected R_PAREN | ||
200 | error 372: expected COMMA | ||
201 | error 372: expected enum variant | ||
202 | error 374: expected enum variant | ||
203 | error 508: expected expression | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rs b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rs new file mode 100644 index 000000000..829ca1c4b --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | impl<T: Clone> | ||
2 | impl<T> OnceCell<T> {} | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt new file mode 100644 index 000000000..d3da2f54f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt | |||
@@ -0,0 +1,49 @@ | |||
1 | SOURCE_FILE@[0; 38) | ||
2 | IMPL_BLOCK@[0; 14) | ||
3 | IMPL_KW@[0; 4) "impl" | ||
4 | TYPE_PARAM_LIST@[4; 14) | ||
5 | L_ANGLE@[4; 5) "<" | ||
6 | TYPE_PARAM@[5; 13) | ||
7 | NAME@[5; 6) | ||
8 | IDENT@[5; 6) "T" | ||
9 | COLON@[6; 7) ":" | ||
10 | WHITESPACE@[7; 8) " " | ||
11 | TYPE_BOUND_LIST@[8; 13) | ||
12 | TYPE_BOUND@[8; 13) | ||
13 | PATH_TYPE@[8; 13) | ||
14 | PATH@[8; 13) | ||
15 | PATH_SEGMENT@[8; 13) | ||
16 | NAME_REF@[8; 13) | ||
17 | IDENT@[8; 13) "Clone" | ||
18 | R_ANGLE@[13; 14) ">" | ||
19 | WHITESPACE@[14; 15) "\n" | ||
20 | IMPL_BLOCK@[15; 37) | ||
21 | IMPL_KW@[15; 19) "impl" | ||
22 | TYPE_PARAM_LIST@[19; 22) | ||
23 | L_ANGLE@[19; 20) "<" | ||
24 | TYPE_PARAM@[20; 21) | ||
25 | NAME@[20; 21) | ||
26 | IDENT@[20; 21) "T" | ||
27 | R_ANGLE@[21; 22) ">" | ||
28 | WHITESPACE@[22; 23) " " | ||
29 | PATH_TYPE@[23; 34) | ||
30 | PATH@[23; 34) | ||
31 | PATH_SEGMENT@[23; 34) | ||
32 | NAME_REF@[23; 31) | ||
33 | IDENT@[23; 31) "OnceCell" | ||
34 | TYPE_ARG_LIST@[31; 34) | ||
35 | L_ANGLE@[31; 32) "<" | ||
36 | TYPE_ARG@[32; 33) | ||
37 | PATH_TYPE@[32; 33) | ||
38 | PATH@[32; 33) | ||
39 | PATH_SEGMENT@[32; 33) | ||
40 | NAME_REF@[32; 33) | ||
41 | IDENT@[32; 33) "T" | ||
42 | R_ANGLE@[33; 34) ">" | ||
43 | WHITESPACE@[34; 35) " " | ||
44 | ITEM_LIST@[35; 37) | ||
45 | L_CURLY@[35; 36) "{" | ||
46 | R_CURLY@[36; 37) "}" | ||
47 | WHITESPACE@[37; 38) "\n" | ||
48 | error 14: expected trait or type | ||
49 | error 14: expected `{` | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rs b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rs new file mode 100644 index 000000000..2792c2084 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn foo() | ||
2 | where for<'a> | ||
3 | {} | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.txt b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.txt new file mode 100644 index 000000000..061e6fb31 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.txt | |||
@@ -0,0 +1,28 @@ | |||
1 | SOURCE_FILE@[0; 30) | ||
2 | FN_DEF@[0; 29) | ||
3 | FN_KW@[0; 2) "fn" | ||
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; 13) "\n " | ||
11 | WHERE_CLAUSE@[13; 26) | ||
12 | WHERE_KW@[13; 18) "where" | ||
13 | WHITESPACE@[18; 19) " " | ||
14 | WHERE_PRED@[19; 26) | ||
15 | FOR_TYPE@[19; 26) | ||
16 | FOR_KW@[19; 22) "for" | ||
17 | TYPE_PARAM_LIST@[22; 26) | ||
18 | L_ANGLE@[22; 23) "<" | ||
19 | LIFETIME_PARAM@[23; 25) | ||
20 | LIFETIME@[23; 25) "\'a" | ||
21 | R_ANGLE@[25; 26) ">" | ||
22 | WHITESPACE@[26; 27) "\n" | ||
23 | BLOCK@[27; 29) | ||
24 | L_CURLY@[27; 28) "{" | ||
25 | R_CURLY@[28; 29) "}" | ||
26 | WHITESPACE@[29; 30) "\n" | ||
27 | error 26: expected a path | ||
28 | error 26: expected colon | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs b/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs new file mode 100644 index 000000000..781047ba1 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs | |||
@@ -0,0 +1,15 @@ | |||
1 | macro parse_use_trees($($s:expr),* $(,)*) { | ||
2 | vec![ | ||
3 | $(parse_use_tree($s),)* | ||
4 | ] | ||
5 | } | ||
6 | |||
7 | #[test] | ||
8 | fn test_use_tree_merge() { | ||
9 | macro test_merge([$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) { | ||
10 | assert_eq!( | ||
11 | merge_use_trees(parse_use_trees!($($input,)*)), | ||
12 | parse_use_trees!($($output,)*), | ||
13 | ); | ||
14 | } | ||
15 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt b/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt new file mode 100644 index 000000000..98bc562a3 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt | |||
@@ -0,0 +1,325 @@ | |||
1 | SOURCE_FILE@[0; 349) | ||
2 | MACRO_CALL@[0; 41) | ||
3 | PATH@[0; 5) | ||
4 | PATH_SEGMENT@[0; 5) | ||
5 | NAME_REF@[0; 5) | ||
6 | IDENT@[0; 5) "macro" | ||
7 | WHITESPACE@[5; 6) " " | ||
8 | NAME@[6; 21) | ||
9 | IDENT@[6; 21) "parse_use_trees" | ||
10 | TOKEN_TREE@[21; 41) | ||
11 | L_PAREN@[21; 22) "(" | ||
12 | DOLLAR@[22; 23) "$" | ||
13 | TOKEN_TREE@[23; 32) | ||
14 | L_PAREN@[23; 24) "(" | ||
15 | DOLLAR@[24; 25) "$" | ||
16 | IDENT@[25; 26) "s" | ||
17 | COLON@[26; 27) ":" | ||
18 | IDENT@[27; 31) "expr" | ||
19 | R_PAREN@[31; 32) ")" | ||
20 | COMMA@[32; 33) "," | ||
21 | STAR@[33; 34) "*" | ||
22 | WHITESPACE@[34; 35) " " | ||
23 | DOLLAR@[35; 36) "$" | ||
24 | TOKEN_TREE@[36; 39) | ||
25 | L_PAREN@[36; 37) "(" | ||
26 | COMMA@[37; 38) "," | ||
27 | R_PAREN@[38; 39) ")" | ||
28 | STAR@[39; 40) "*" | ||
29 | R_PAREN@[40; 41) ")" | ||
30 | WHITESPACE@[41; 42) " " | ||
31 | ERROR@[42; 93) | ||
32 | L_CURLY@[42; 43) "{" | ||
33 | WHITESPACE@[43; 48) "\n " | ||
34 | MACRO_CALL@[48; 91) | ||
35 | PATH@[48; 51) | ||
36 | PATH_SEGMENT@[48; 51) | ||
37 | NAME_REF@[48; 51) | ||
38 | IDENT@[48; 51) "vec" | ||
39 | EXCL@[51; 52) "!" | ||
40 | TOKEN_TREE@[52; 91) | ||
41 | L_BRACK@[52; 53) "[" | ||
42 | WHITESPACE@[53; 62) "\n " | ||
43 | DOLLAR@[62; 63) "$" | ||
44 | TOKEN_TREE@[63; 84) | ||
45 | L_PAREN@[63; 64) "(" | ||
46 | IDENT@[64; 78) "parse_use_tree" | ||
47 | TOKEN_TREE@[78; 82) | ||
48 | L_PAREN@[78; 79) "(" | ||
49 | DOLLAR@[79; 80) "$" | ||
50 | IDENT@[80; 81) "s" | ||
51 | R_PAREN@[81; 82) ")" | ||
52 | COMMA@[82; 83) "," | ||
53 | R_PAREN@[83; 84) ")" | ||
54 | STAR@[84; 85) "*" | ||
55 | WHITESPACE@[85; 90) "\n " | ||
56 | R_BRACK@[90; 91) "]" | ||
57 | WHITESPACE@[91; 92) "\n" | ||
58 | R_CURLY@[92; 93) "}" | ||
59 | WHITESPACE@[93; 95) "\n\n" | ||
60 | FN_DEF@[95; 348) | ||
61 | ATTR@[95; 102) | ||
62 | POUND@[95; 96) "#" | ||
63 | TOKEN_TREE@[96; 102) | ||
64 | L_BRACK@[96; 97) "[" | ||
65 | IDENT@[97; 101) "test" | ||
66 | R_BRACK@[101; 102) "]" | ||
67 | WHITESPACE@[102; 103) "\n" | ||
68 | FN_KW@[103; 105) "fn" | ||
69 | WHITESPACE@[105; 106) " " | ||
70 | NAME@[106; 125) | ||
71 | IDENT@[106; 125) "test_use_tree_merge" | ||
72 | PARAM_LIST@[125; 127) | ||
73 | L_PAREN@[125; 126) "(" | ||
74 | R_PAREN@[126; 127) ")" | ||
75 | WHITESPACE@[127; 128) " " | ||
76 | BLOCK@[128; 348) | ||
77 | L_CURLY@[128; 129) "{" | ||
78 | WHITESPACE@[129; 134) "\n " | ||
79 | EXPR_STMT@[134; 139) | ||
80 | PATH_EXPR@[134; 139) | ||
81 | PATH@[134; 139) | ||
82 | PATH_SEGMENT@[134; 139) | ||
83 | NAME_REF@[134; 139) | ||
84 | IDENT@[134; 139) "macro" | ||
85 | WHITESPACE@[139; 140) " " | ||
86 | EXPR_STMT@[140; 154) | ||
87 | CALL_EXPR@[140; 154) | ||
88 | PATH_EXPR@[140; 150) | ||
89 | PATH@[140; 150) | ||
90 | PATH_SEGMENT@[140; 150) | ||
91 | NAME_REF@[140; 150) | ||
92 | IDENT@[140; 150) "test_merge" | ||
93 | ARG_LIST@[150; 154) | ||
94 | L_PAREN@[150; 151) "(" | ||
95 | ARRAY_EXPR@[151; 154) | ||
96 | L_BRACK@[151; 152) "[" | ||
97 | ERROR@[152; 153) | ||
98 | DOLLAR@[152; 153) "$" | ||
99 | PAREN_EXPR@[153; 154) | ||
100 | L_PAREN@[153; 154) "(" | ||
101 | EXPR_STMT@[154; 155) | ||
102 | ERROR@[154; 155) | ||
103 | DOLLAR@[154; 155) "$" | ||
104 | EXPR_STMT@[155; 160) | ||
105 | PATH_EXPR@[155; 160) | ||
106 | PATH@[155; 160) | ||
107 | PATH_SEGMENT@[155; 160) | ||
108 | NAME_REF@[155; 160) | ||
109 | IDENT@[155; 160) "input" | ||
110 | EXPR_STMT@[160; 161) | ||
111 | ERROR@[160; 161) | ||
112 | COLON@[160; 161) ":" | ||
113 | EXPR_STMT@[161; 165) | ||
114 | PATH_EXPR@[161; 165) | ||
115 | PATH@[161; 165) | ||
116 | PATH_SEGMENT@[161; 165) | ||
117 | NAME_REF@[161; 165) | ||
118 | IDENT@[161; 165) "expr" | ||
119 | EXPR_STMT@[165; 166) | ||
120 | ERROR@[165; 166) | ||
121 | R_PAREN@[165; 166) ")" | ||
122 | EXPR_STMT@[166; 167) | ||
123 | ERROR@[166; 167) | ||
124 | COMMA@[166; 167) "," | ||
125 | EXPR_STMT@[167; 170) | ||
126 | PREFIX_EXPR@[167; 170) | ||
127 | STAR@[167; 168) "*" | ||
128 | WHITESPACE@[168; 169) " " | ||
129 | ERROR@[169; 170) | ||
130 | DOLLAR@[169; 170) "$" | ||
131 | EXPR_STMT@[170; 171) | ||
132 | PAREN_EXPR@[170; 171) | ||
133 | L_PAREN@[170; 171) "(" | ||
134 | EXPR_STMT@[171; 172) | ||
135 | ERROR@[171; 172) | ||
136 | COMMA@[171; 172) "," | ||
137 | EXPR_STMT@[172; 173) | ||
138 | ERROR@[172; 173) | ||
139 | R_PAREN@[172; 173) ")" | ||
140 | EXPR_STMT@[173; 175) | ||
141 | PREFIX_EXPR@[173; 175) | ||
142 | STAR@[173; 174) "*" | ||
143 | ERROR@[174; 175) | ||
144 | R_BRACK@[174; 175) "]" | ||
145 | EXPR_STMT@[175; 176) | ||
146 | ERROR@[175; 176) | ||
147 | COMMA@[175; 176) "," | ||
148 | WHITESPACE@[176; 177) " " | ||
149 | EXPR_STMT@[177; 180) | ||
150 | ARRAY_EXPR@[177; 180) | ||
151 | L_BRACK@[177; 178) "[" | ||
152 | ERROR@[178; 179) | ||
153 | DOLLAR@[178; 179) "$" | ||
154 | PAREN_EXPR@[179; 180) | ||
155 | L_PAREN@[179; 180) "(" | ||
156 | EXPR_STMT@[180; 181) | ||
157 | ERROR@[180; 181) | ||
158 | DOLLAR@[180; 181) "$" | ||
159 | EXPR_STMT@[181; 187) | ||
160 | PATH_EXPR@[181; 187) | ||
161 | PATH@[181; 187) | ||
162 | PATH_SEGMENT@[181; 187) | ||
163 | NAME_REF@[181; 187) | ||
164 | IDENT@[181; 187) "output" | ||
165 | EXPR_STMT@[187; 188) | ||
166 | ERROR@[187; 188) | ||
167 | COLON@[187; 188) ":" | ||
168 | EXPR_STMT@[188; 192) | ||
169 | PATH_EXPR@[188; 192) | ||
170 | PATH@[188; 192) | ||
171 | PATH_SEGMENT@[188; 192) | ||
172 | NAME_REF@[188; 192) | ||
173 | IDENT@[188; 192) "expr" | ||
174 | EXPR_STMT@[192; 193) | ||
175 | ERROR@[192; 193) | ||
176 | R_PAREN@[192; 193) ")" | ||
177 | EXPR_STMT@[193; 194) | ||
178 | ERROR@[193; 194) | ||
179 | COMMA@[193; 194) "," | ||
180 | EXPR_STMT@[194; 197) | ||
181 | PREFIX_EXPR@[194; 197) | ||
182 | STAR@[194; 195) "*" | ||
183 | WHITESPACE@[195; 196) " " | ||
184 | ERROR@[196; 197) | ||
185 | DOLLAR@[196; 197) "$" | ||
186 | EXPR_STMT@[197; 198) | ||
187 | PAREN_EXPR@[197; 198) | ||
188 | L_PAREN@[197; 198) "(" | ||
189 | EXPR_STMT@[198; 199) | ||
190 | ERROR@[198; 199) | ||
191 | COMMA@[198; 199) "," | ||
192 | EXPR_STMT@[199; 200) | ||
193 | ERROR@[199; 200) | ||
194 | R_PAREN@[199; 200) ")" | ||
195 | EXPR_STMT@[200; 202) | ||
196 | PREFIX_EXPR@[200; 202) | ||
197 | STAR@[200; 201) "*" | ||
198 | ERROR@[201; 202) | ||
199 | R_BRACK@[201; 202) "]" | ||
200 | EXPR_STMT@[202; 203) | ||
201 | ERROR@[202; 203) | ||
202 | R_PAREN@[202; 203) ")" | ||
203 | WHITESPACE@[203; 204) " " | ||
204 | BLOCK_EXPR@[204; 346) | ||
205 | BLOCK@[204; 346) | ||
206 | L_CURLY@[204; 205) "{" | ||
207 | WHITESPACE@[205; 214) "\n " | ||
208 | EXPR_STMT@[214; 340) | ||
209 | MACRO_CALL@[214; 339) | ||
210 | PATH@[214; 223) | ||
211 | PATH_SEGMENT@[214; 223) | ||
212 | NAME_REF@[214; 223) | ||
213 | IDENT@[214; 223) "assert_eq" | ||
214 | EXCL@[223; 224) "!" | ||
215 | TOKEN_TREE@[224; 339) | ||
216 | L_PAREN@[224; 225) "(" | ||
217 | WHITESPACE@[225; 238) "\n " | ||
218 | IDENT@[238; 253) "merge_use_trees" | ||
219 | TOKEN_TREE@[253; 284) | ||
220 | L_PAREN@[253; 254) "(" | ||
221 | IDENT@[254; 269) "parse_use_trees" | ||
222 | EXCL@[269; 270) "!" | ||
223 | TOKEN_TREE@[270; 283) | ||
224 | L_PAREN@[270; 271) "(" | ||
225 | DOLLAR@[271; 272) "$" | ||
226 | TOKEN_TREE@[272; 281) | ||
227 | L_PAREN@[272; 273) "(" | ||
228 | DOLLAR@[273; 274) "$" | ||
229 | IDENT@[274; 279) "input" | ||
230 | COMMA@[279; 280) "," | ||
231 | R_PAREN@[280; 281) ")" | ||
232 | STAR@[281; 282) "*" | ||
233 | R_PAREN@[282; 283) ")" | ||
234 | R_PAREN@[283; 284) ")" | ||
235 | COMMA@[284; 285) "," | ||
236 | WHITESPACE@[285; 298) "\n " | ||
237 | IDENT@[298; 313) "parse_use_trees" | ||
238 | EXCL@[313; 314) "!" | ||
239 | TOKEN_TREE@[314; 328) | ||
240 | L_PAREN@[314; 315) "(" | ||
241 | DOLLAR@[315; 316) "$" | ||
242 | TOKEN_TREE@[316; 326) | ||
243 | L_PAREN@[316; 317) "(" | ||
244 | DOLLAR@[317; 318) "$" | ||
245 | IDENT@[318; 324) "output" | ||
246 | COMMA@[324; 325) "," | ||
247 | R_PAREN@[325; 326) ")" | ||
248 | STAR@[326; 327) "*" | ||
249 | R_PAREN@[327; 328) ")" | ||
250 | COMMA@[328; 329) "," | ||
251 | WHITESPACE@[329; 338) "\n " | ||
252 | R_PAREN@[338; 339) ")" | ||
253 | SEMI@[339; 340) ";" | ||
254 | WHITESPACE@[340; 345) "\n " | ||
255 | R_CURLY@[345; 346) "}" | ||
256 | WHITESPACE@[346; 347) "\n" | ||
257 | R_CURLY@[347; 348) "}" | ||
258 | WHITESPACE@[348; 349) "\n" | ||
259 | error 5: expected EXCL | ||
260 | error 41: expected SEMI | ||
261 | error 42: expected an item | ||
262 | error 139: expected SEMI | ||
263 | error 152: expected expression | ||
264 | error 153: expected COMMA | ||
265 | error 154: expected expression | ||
266 | error 154: expected R_PAREN | ||
267 | error 154: expected COMMA | ||
268 | error 154: expected expression | ||
269 | error 154: expected R_BRACK | ||
270 | error 154: expected COMMA | ||
271 | error 154: expected SEMI | ||
272 | error 154: expected expression | ||
273 | error 155: expected SEMI | ||
274 | error 160: expected SEMI | ||
275 | error 160: expected expression | ||
276 | error 161: expected SEMI | ||
277 | error 165: expected SEMI | ||
278 | error 165: expected expression | ||
279 | error 166: expected SEMI | ||
280 | error 166: expected expression | ||
281 | error 167: expected SEMI | ||
282 | error 169: expected expression | ||
283 | error 170: expected SEMI | ||
284 | error 171: expected expression | ||
285 | error 171: expected R_PAREN | ||
286 | error 171: expected SEMI | ||
287 | error 171: expected expression | ||
288 | error 172: expected SEMI | ||
289 | error 172: expected expression | ||
290 | error 173: expected SEMI | ||
291 | error 174: expected expression | ||
292 | error 175: expected SEMI | ||
293 | error 175: expected expression | ||
294 | error 176: expected SEMI | ||
295 | error 178: expected expression | ||
296 | error 179: expected COMMA | ||
297 | error 180: expected expression | ||
298 | error 180: expected R_PAREN | ||
299 | error 180: expected COMMA | ||
300 | error 180: expected expression | ||
301 | error 180: expected R_BRACK | ||
302 | error 180: expected SEMI | ||
303 | error 180: expected expression | ||
304 | error 181: expected SEMI | ||
305 | error 187: expected SEMI | ||
306 | error 187: expected expression | ||
307 | error 188: expected SEMI | ||
308 | error 192: expected SEMI | ||
309 | error 192: expected expression | ||
310 | error 193: expected SEMI | ||
311 | error 193: expected expression | ||
312 | error 194: expected SEMI | ||
313 | error 196: expected expression | ||
314 | error 197: expected SEMI | ||
315 | error 198: expected expression | ||
316 | error 198: expected R_PAREN | ||
317 | error 198: expected SEMI | ||
318 | error 198: expected expression | ||
319 | error 199: expected SEMI | ||
320 | error 199: expected expression | ||
321 | error 200: expected SEMI | ||
322 | error 201: expected expression | ||
323 | error 202: expected SEMI | ||
324 | error 202: expected expression | ||
325 | error 203: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0029_field_completion.rs b/crates/ra_syntax/test_data/parser/err/0029_field_completion.rs new file mode 100644 index 000000000..a7cdc17bb --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0029_field_completion.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn foo(a: A) { | ||
2 | a. | ||
3 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0029_field_completion.txt b/crates/ra_syntax/test_data/parser/err/0029_field_completion.txt new file mode 100644 index 000000000..fb50a12fc --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0029_field_completion.txt | |||
@@ -0,0 +1,35 @@ | |||
1 | SOURCE_FILE@[0; 24) | ||
2 | FN_DEF@[0; 23) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 12) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | PARAM@[7; 11) | ||
10 | BIND_PAT@[7; 8) | ||
11 | NAME@[7; 8) | ||
12 | IDENT@[7; 8) "a" | ||
13 | COLON@[8; 9) ":" | ||
14 | WHITESPACE@[9; 10) " " | ||
15 | PATH_TYPE@[10; 11) | ||
16 | PATH@[10; 11) | ||
17 | PATH_SEGMENT@[10; 11) | ||
18 | NAME_REF@[10; 11) | ||
19 | IDENT@[10; 11) "A" | ||
20 | R_PAREN@[11; 12) ")" | ||
21 | WHITESPACE@[12; 13) " " | ||
22 | BLOCK@[13; 23) | ||
23 | L_CURLY@[13; 14) "{" | ||
24 | WHITESPACE@[14; 19) "\n " | ||
25 | FIELD_EXPR@[19; 21) | ||
26 | PATH_EXPR@[19; 20) | ||
27 | PATH@[19; 20) | ||
28 | PATH_SEGMENT@[19; 20) | ||
29 | NAME_REF@[19; 20) | ||
30 | IDENT@[19; 20) "a" | ||
31 | DOT@[20; 21) "." | ||
32 | WHITESPACE@[21; 22) "\n" | ||
33 | R_CURLY@[22; 23) "}" | ||
34 | WHITESPACE@[23; 24) "\n" | ||
35 | error 21: expected field name or number | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rs b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rs new file mode 100644 index 000000000..6a04f2d0a --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rs | |||
@@ -0,0 +1,15 @@ | |||
1 | fn block() { | ||
2 | let inner = { | ||
3 | #![doc("Inner attributes not allowed here")] | ||
4 | //! Nor are ModuleDoc comments | ||
5 | }; | ||
6 | if true { | ||
7 | #![doc("Nor here")] | ||
8 | #![doc("We error on each attr")] | ||
9 | //! Nor are ModuleDoc comments | ||
10 | } | ||
11 | while true { | ||
12 | #![doc("Nor here")] | ||
13 | //! Nor are ModuleDoc comments | ||
14 | } | ||
15 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.txt b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.txt new file mode 100644 index 000000000..c205cf147 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.txt | |||
@@ -0,0 +1,114 @@ | |||
1 | SOURCE_FILE@[0; 350) | ||
2 | FN_DEF@[0; 349) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 8) | ||
6 | IDENT@[3; 8) "block" | ||
7 | PARAM_LIST@[8; 10) | ||
8 | L_PAREN@[8; 9) "(" | ||
9 | R_PAREN@[9; 10) ")" | ||
10 | WHITESPACE@[10; 11) " " | ||
11 | BLOCK@[11; 349) | ||
12 | L_CURLY@[11; 12) "{" | ||
13 | WHITESPACE@[12; 17) "\n " | ||
14 | LET_STMT@[17; 129) | ||
15 | LET_KW@[17; 20) "let" | ||
16 | WHITESPACE@[20; 21) " " | ||
17 | BIND_PAT@[21; 26) | ||
18 | NAME@[21; 26) | ||
19 | IDENT@[21; 26) "inner" | ||
20 | WHITESPACE@[26; 27) " " | ||
21 | EQ@[27; 28) "=" | ||
22 | WHITESPACE@[28; 29) " " | ||
23 | BLOCK_EXPR@[29; 128) | ||
24 | BLOCK@[29; 128) | ||
25 | L_CURLY@[29; 30) "{" | ||
26 | WHITESPACE@[30; 39) "\n " | ||
27 | ATTR@[39; 83) | ||
28 | POUND@[39; 40) "#" | ||
29 | EXCL@[40; 41) "!" | ||
30 | TOKEN_TREE@[41; 83) | ||
31 | L_BRACK@[41; 42) "[" | ||
32 | IDENT@[42; 45) "doc" | ||
33 | TOKEN_TREE@[45; 82) | ||
34 | L_PAREN@[45; 46) "(" | ||
35 | STRING@[46; 81) "\"Inner attributes not ..." | ||
36 | R_PAREN@[81; 82) ")" | ||
37 | R_BRACK@[82; 83) "]" | ||
38 | WHITESPACE@[83; 92) "\n " | ||
39 | COMMENT@[92; 122) "//! Nor are ModuleDoc ..." | ||
40 | WHITESPACE@[122; 127) "\n " | ||
41 | R_CURLY@[127; 128) "}" | ||
42 | SEMI@[128; 129) ";" | ||
43 | WHITESPACE@[129; 134) "\n " | ||
44 | EXPR_STMT@[134; 257) | ||
45 | IF_EXPR@[134; 257) | ||
46 | IF_KW@[134; 136) "if" | ||
47 | WHITESPACE@[136; 137) " " | ||
48 | CONDITION@[137; 141) | ||
49 | LITERAL@[137; 141) | ||
50 | TRUE_KW@[137; 141) "true" | ||
51 | WHITESPACE@[141; 142) " " | ||
52 | BLOCK@[142; 257) | ||
53 | L_CURLY@[142; 143) "{" | ||
54 | WHITESPACE@[143; 152) "\n " | ||
55 | ATTR@[152; 171) | ||
56 | POUND@[152; 153) "#" | ||
57 | EXCL@[153; 154) "!" | ||
58 | TOKEN_TREE@[154; 171) | ||
59 | L_BRACK@[154; 155) "[" | ||
60 | IDENT@[155; 158) "doc" | ||
61 | TOKEN_TREE@[158; 170) | ||
62 | L_PAREN@[158; 159) "(" | ||
63 | STRING@[159; 169) "\"Nor here\"" | ||
64 | R_PAREN@[169; 170) ")" | ||
65 | R_BRACK@[170; 171) "]" | ||
66 | WHITESPACE@[171; 180) "\n " | ||
67 | ATTR@[180; 212) | ||
68 | POUND@[180; 181) "#" | ||
69 | EXCL@[181; 182) "!" | ||
70 | TOKEN_TREE@[182; 212) | ||
71 | L_BRACK@[182; 183) "[" | ||
72 | IDENT@[183; 186) "doc" | ||
73 | TOKEN_TREE@[186; 211) | ||
74 | L_PAREN@[186; 187) "(" | ||
75 | STRING@[187; 210) "\"We error on each attr\"" | ||
76 | R_PAREN@[210; 211) ")" | ||
77 | R_BRACK@[211; 212) "]" | ||
78 | WHITESPACE@[212; 221) "\n " | ||
79 | COMMENT@[221; 251) "//! Nor are ModuleDoc ..." | ||
80 | WHITESPACE@[251; 256) "\n " | ||
81 | R_CURLY@[256; 257) "}" | ||
82 | WHITESPACE@[257; 262) "\n " | ||
83 | WHILE_EXPR@[262; 347) | ||
84 | WHILE_KW@[262; 267) "while" | ||
85 | WHITESPACE@[267; 268) " " | ||
86 | CONDITION@[268; 272) | ||
87 | LITERAL@[268; 272) | ||
88 | TRUE_KW@[268; 272) "true" | ||
89 | WHITESPACE@[272; 273) " " | ||
90 | BLOCK@[273; 347) | ||
91 | L_CURLY@[273; 274) "{" | ||
92 | WHITESPACE@[274; 283) "\n " | ||
93 | ATTR@[283; 302) | ||
94 | POUND@[283; 284) "#" | ||
95 | EXCL@[284; 285) "!" | ||
96 | TOKEN_TREE@[285; 302) | ||
97 | L_BRACK@[285; 286) "[" | ||
98 | IDENT@[286; 289) "doc" | ||
99 | TOKEN_TREE@[289; 301) | ||
100 | L_PAREN@[289; 290) "(" | ||
101 | STRING@[290; 300) "\"Nor here\"" | ||
102 | R_PAREN@[300; 301) ")" | ||
103 | R_BRACK@[301; 302) "]" | ||
104 | WHITESPACE@[302; 311) "\n " | ||
105 | COMMENT@[311; 341) "//! Nor are ModuleDoc ..." | ||
106 | WHITESPACE@[341; 346) "\n " | ||
107 | R_CURLY@[346; 347) "}" | ||
108 | WHITESPACE@[347; 348) "\n" | ||
109 | R_CURLY@[348; 349) "}" | ||
110 | WHITESPACE@[349; 350) "\n" | ||
111 | error [39; 83): A block in this position cannot accept inner attributes | ||
112 | error [152; 171): A block in this position cannot accept inner attributes | ||
113 | error [180; 212): A block in this position cannot accept inner attributes | ||
114 | error [283; 302): A block in this position cannot accept inner attributes | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs new file mode 100644 index 000000000..06aa47770 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs | |||
@@ -0,0 +1,20 @@ | |||
1 | fn foo() { | ||
2 | match () { | ||
3 | _ => (), | ||
4 | #![doc("Not allowed here")] | ||
5 | _ => (), | ||
6 | } | ||
7 | |||
8 | match () { | ||
9 | _ => (), | ||
10 | _ => (), | ||
11 | #![doc("Nor here")] | ||
12 | } | ||
13 | |||
14 | match () { | ||
15 | #[cfg(test)] | ||
16 | #![doc("Nor here")] | ||
17 | _ => (), | ||
18 | _ => (), | ||
19 | } | ||
20 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.txt b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.txt new file mode 100644 index 000000000..4e8c4143b --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.txt | |||
@@ -0,0 +1,201 @@ | |||
1 | SOURCE_FILE@[0; 293) | ||
2 | FN_DEF@[0; 292) | ||
3 | FN_KW@[0; 2) "fn" | ||
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; 292) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 15) "\n " | ||
14 | EXPR_STMT@[15; 101) | ||
15 | MATCH_EXPR@[15; 101) | ||
16 | MATCH_KW@[15; 20) "match" | ||
17 | WHITESPACE@[20; 21) " " | ||
18 | TUPLE_EXPR@[21; 23) | ||
19 | L_PAREN@[21; 22) "(" | ||
20 | R_PAREN@[22; 23) ")" | ||
21 | WHITESPACE@[23; 24) " " | ||
22 | MATCH_ARM_LIST@[24; 101) | ||
23 | L_CURLY@[24; 25) "{" | ||
24 | WHITESPACE@[25; 34) "\n " | ||
25 | MATCH_ARM@[34; 41) | ||
26 | PLACEHOLDER_PAT@[34; 35) | ||
27 | UNDERSCORE@[34; 35) "_" | ||
28 | WHITESPACE@[35; 36) " " | ||
29 | FAT_ARROW@[36; 38) "=>" | ||
30 | WHITESPACE@[38; 39) " " | ||
31 | TUPLE_EXPR@[39; 41) | ||
32 | L_PAREN@[39; 40) "(" | ||
33 | R_PAREN@[40; 41) ")" | ||
34 | COMMA@[41; 42) "," | ||
35 | WHITESPACE@[42; 51) "\n " | ||
36 | MATCH_ARM@[51; 78) | ||
37 | ATTR@[51; 52) | ||
38 | POUND@[51; 52) "#" | ||
39 | ERROR@[52; 53) | ||
40 | EXCL@[52; 53) "!" | ||
41 | ARRAY_EXPR@[53; 78) | ||
42 | L_BRACK@[53; 54) "[" | ||
43 | CALL_EXPR@[54; 77) | ||
44 | PATH_EXPR@[54; 57) | ||
45 | PATH@[54; 57) | ||
46 | PATH_SEGMENT@[54; 57) | ||
47 | NAME_REF@[54; 57) | ||
48 | IDENT@[54; 57) "doc" | ||
49 | ARG_LIST@[57; 77) | ||
50 | L_PAREN@[57; 58) "(" | ||
51 | LITERAL@[58; 76) | ||
52 | STRING@[58; 76) "\"Not allowed here\"" | ||
53 | R_PAREN@[76; 77) ")" | ||
54 | R_BRACK@[77; 78) "]" | ||
55 | WHITESPACE@[78; 87) "\n " | ||
56 | MATCH_ARM@[87; 94) | ||
57 | PLACEHOLDER_PAT@[87; 88) | ||
58 | UNDERSCORE@[87; 88) "_" | ||
59 | WHITESPACE@[88; 89) " " | ||
60 | FAT_ARROW@[89; 91) "=>" | ||
61 | WHITESPACE@[91; 92) " " | ||
62 | TUPLE_EXPR@[92; 94) | ||
63 | L_PAREN@[92; 93) "(" | ||
64 | R_PAREN@[93; 94) ")" | ||
65 | COMMA@[94; 95) "," | ||
66 | WHITESPACE@[95; 100) "\n " | ||
67 | R_CURLY@[100; 101) "}" | ||
68 | WHITESPACE@[101; 107) "\n\n " | ||
69 | EXPR_STMT@[107; 185) | ||
70 | MATCH_EXPR@[107; 185) | ||
71 | MATCH_KW@[107; 112) "match" | ||
72 | WHITESPACE@[112; 113) " " | ||
73 | TUPLE_EXPR@[113; 115) | ||
74 | L_PAREN@[113; 114) "(" | ||
75 | R_PAREN@[114; 115) ")" | ||
76 | WHITESPACE@[115; 116) " " | ||
77 | MATCH_ARM_LIST@[116; 185) | ||
78 | L_CURLY@[116; 117) "{" | ||
79 | WHITESPACE@[117; 126) "\n " | ||
80 | MATCH_ARM@[126; 133) | ||
81 | PLACEHOLDER_PAT@[126; 127) | ||
82 | UNDERSCORE@[126; 127) "_" | ||
83 | WHITESPACE@[127; 128) " " | ||
84 | FAT_ARROW@[128; 130) "=>" | ||
85 | WHITESPACE@[130; 131) " " | ||
86 | TUPLE_EXPR@[131; 133) | ||
87 | L_PAREN@[131; 132) "(" | ||
88 | R_PAREN@[132; 133) ")" | ||
89 | COMMA@[133; 134) "," | ||
90 | WHITESPACE@[134; 143) "\n " | ||
91 | MATCH_ARM@[143; 150) | ||
92 | PLACEHOLDER_PAT@[143; 144) | ||
93 | UNDERSCORE@[143; 144) "_" | ||
94 | WHITESPACE@[144; 145) " " | ||
95 | FAT_ARROW@[145; 147) "=>" | ||
96 | WHITESPACE@[147; 148) " " | ||
97 | TUPLE_EXPR@[148; 150) | ||
98 | L_PAREN@[148; 149) "(" | ||
99 | R_PAREN@[149; 150) ")" | ||
100 | COMMA@[150; 151) "," | ||
101 | WHITESPACE@[151; 160) "\n " | ||
102 | MATCH_ARM@[160; 179) | ||
103 | ATTR@[160; 161) | ||
104 | POUND@[160; 161) "#" | ||
105 | ERROR@[161; 162) | ||
106 | EXCL@[161; 162) "!" | ||
107 | ARRAY_EXPR@[162; 179) | ||
108 | L_BRACK@[162; 163) "[" | ||
109 | CALL_EXPR@[163; 178) | ||
110 | PATH_EXPR@[163; 166) | ||
111 | PATH@[163; 166) | ||
112 | PATH_SEGMENT@[163; 166) | ||
113 | NAME_REF@[163; 166) | ||
114 | IDENT@[163; 166) "doc" | ||
115 | ARG_LIST@[166; 178) | ||
116 | L_PAREN@[166; 167) "(" | ||
117 | LITERAL@[167; 177) | ||
118 | STRING@[167; 177) "\"Nor here\"" | ||
119 | R_PAREN@[177; 178) ")" | ||
120 | R_BRACK@[178; 179) "]" | ||
121 | WHITESPACE@[179; 184) "\n " | ||
122 | R_CURLY@[184; 185) "}" | ||
123 | WHITESPACE@[185; 191) "\n\n " | ||
124 | MATCH_EXPR@[191; 290) | ||
125 | MATCH_KW@[191; 196) "match" | ||
126 | WHITESPACE@[196; 197) " " | ||
127 | TUPLE_EXPR@[197; 199) | ||
128 | L_PAREN@[197; 198) "(" | ||
129 | R_PAREN@[198; 199) ")" | ||
130 | WHITESPACE@[199; 200) " " | ||
131 | MATCH_ARM_LIST@[200; 290) | ||
132 | L_CURLY@[200; 201) "{" | ||
133 | WHITESPACE@[201; 210) "\n " | ||
134 | MATCH_ARM@[210; 250) | ||
135 | ATTR@[210; 222) | ||
136 | POUND@[210; 211) "#" | ||
137 | TOKEN_TREE@[211; 222) | ||
138 | L_BRACK@[211; 212) "[" | ||
139 | IDENT@[212; 215) "cfg" | ||
140 | TOKEN_TREE@[215; 221) | ||
141 | L_PAREN@[215; 216) "(" | ||
142 | IDENT@[216; 220) "test" | ||
143 | R_PAREN@[220; 221) ")" | ||
144 | R_BRACK@[221; 222) "]" | ||
145 | WHITESPACE@[222; 231) "\n " | ||
146 | ATTR@[231; 232) | ||
147 | POUND@[231; 232) "#" | ||
148 | ERROR@[232; 233) | ||
149 | EXCL@[232; 233) "!" | ||
150 | ARRAY_EXPR@[233; 250) | ||
151 | L_BRACK@[233; 234) "[" | ||
152 | CALL_EXPR@[234; 249) | ||
153 | PATH_EXPR@[234; 237) | ||
154 | PATH@[234; 237) | ||
155 | PATH_SEGMENT@[234; 237) | ||
156 | NAME_REF@[234; 237) | ||
157 | IDENT@[234; 237) "doc" | ||
158 | ARG_LIST@[237; 249) | ||
159 | L_PAREN@[237; 238) "(" | ||
160 | LITERAL@[238; 248) | ||
161 | STRING@[238; 248) "\"Nor here\"" | ||
162 | R_PAREN@[248; 249) ")" | ||
163 | R_BRACK@[249; 250) "]" | ||
164 | WHITESPACE@[250; 259) "\n " | ||
165 | MATCH_ARM@[259; 266) | ||
166 | PLACEHOLDER_PAT@[259; 260) | ||
167 | UNDERSCORE@[259; 260) "_" | ||
168 | WHITESPACE@[260; 261) " " | ||
169 | FAT_ARROW@[261; 263) "=>" | ||
170 | WHITESPACE@[263; 264) " " | ||
171 | TUPLE_EXPR@[264; 266) | ||
172 | L_PAREN@[264; 265) "(" | ||
173 | R_PAREN@[265; 266) ")" | ||
174 | COMMA@[266; 267) "," | ||
175 | WHITESPACE@[267; 276) "\n " | ||
176 | MATCH_ARM@[276; 283) | ||
177 | PLACEHOLDER_PAT@[276; 277) | ||
178 | UNDERSCORE@[276; 277) "_" | ||
179 | WHITESPACE@[277; 278) " " | ||
180 | FAT_ARROW@[278; 280) "=>" | ||
181 | WHITESPACE@[280; 281) " " | ||
182 | TUPLE_EXPR@[281; 283) | ||
183 | L_PAREN@[281; 282) "(" | ||
184 | R_PAREN@[282; 283) ")" | ||
185 | COMMA@[283; 284) "," | ||
186 | WHITESPACE@[284; 289) "\n " | ||
187 | R_CURLY@[289; 290) "}" | ||
188 | WHITESPACE@[290; 291) "\n" | ||
189 | R_CURLY@[291; 292) "}" | ||
190 | WHITESPACE@[292; 293) "\n" | ||
191 | error 52: expected `[` | ||
192 | error 52: expected pattern | ||
193 | error 53: expected FAT_ARROW | ||
194 | error 78: expected COMMA | ||
195 | error 161: expected `[` | ||
196 | error 161: expected pattern | ||
197 | error 162: expected FAT_ARROW | ||
198 | error 232: expected `[` | ||
199 | error 232: expected pattern | ||
200 | error 233: expected FAT_ARROW | ||
201 | error 250: expected COMMA | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs new file mode 100644 index 000000000..4635222da --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | fn foo() { | ||
2 | match () { | ||
3 | _ => (), | ||
4 | _ => (), | ||
5 | #[cfg(test)] | ||
6 | } | ||
7 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.txt b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.txt new file mode 100644 index 000000000..e4f1f6337 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.txt | |||
@@ -0,0 +1,64 @@ | |||
1 | SOURCE_FILE@[0; 89) | ||
2 | FN_DEF@[0; 88) | ||
3 | FN_KW@[0; 2) "fn" | ||
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; 88) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 15) "\n " | ||
14 | MATCH_EXPR@[15; 86) | ||
15 | MATCH_KW@[15; 20) "match" | ||
16 | WHITESPACE@[20; 21) " " | ||
17 | TUPLE_EXPR@[21; 23) | ||
18 | L_PAREN@[21; 22) "(" | ||
19 | R_PAREN@[22; 23) ")" | ||
20 | WHITESPACE@[23; 24) " " | ||
21 | MATCH_ARM_LIST@[24; 86) | ||
22 | L_CURLY@[24; 25) "{" | ||
23 | WHITESPACE@[25; 34) "\n " | ||
24 | MATCH_ARM@[34; 41) | ||
25 | PLACEHOLDER_PAT@[34; 35) | ||
26 | UNDERSCORE@[34; 35) "_" | ||
27 | WHITESPACE@[35; 36) " " | ||
28 | FAT_ARROW@[36; 38) "=>" | ||
29 | WHITESPACE@[38; 39) " " | ||
30 | TUPLE_EXPR@[39; 41) | ||
31 | L_PAREN@[39; 40) "(" | ||
32 | R_PAREN@[40; 41) ")" | ||
33 | COMMA@[41; 42) "," | ||
34 | WHITESPACE@[42; 51) "\n " | ||
35 | MATCH_ARM@[51; 58) | ||
36 | PLACEHOLDER_PAT@[51; 52) | ||
37 | UNDERSCORE@[51; 52) "_" | ||
38 | WHITESPACE@[52; 53) " " | ||
39 | FAT_ARROW@[53; 55) "=>" | ||
40 | WHITESPACE@[55; 56) " " | ||
41 | TUPLE_EXPR@[56; 58) | ||
42 | L_PAREN@[56; 57) "(" | ||
43 | R_PAREN@[57; 58) ")" | ||
44 | COMMA@[58; 59) "," | ||
45 | WHITESPACE@[59; 68) "\n " | ||
46 | MATCH_ARM@[68; 80) | ||
47 | ATTR@[68; 80) | ||
48 | POUND@[68; 69) "#" | ||
49 | TOKEN_TREE@[69; 80) | ||
50 | L_BRACK@[69; 70) "[" | ||
51 | IDENT@[70; 73) "cfg" | ||
52 | TOKEN_TREE@[73; 79) | ||
53 | L_PAREN@[73; 74) "(" | ||
54 | IDENT@[74; 78) "test" | ||
55 | R_PAREN@[78; 79) ")" | ||
56 | R_BRACK@[79; 80) "]" | ||
57 | WHITESPACE@[80; 85) "\n " | ||
58 | R_CURLY@[85; 86) "}" | ||
59 | WHITESPACE@[86; 87) "\n" | ||
60 | R_CURLY@[87; 88) "}" | ||
61 | WHITESPACE@[88; 89) "\n" | ||
62 | error 80: expected pattern | ||
63 | error 80: expected FAT_ARROW | ||
64 | error 80: expected expression | ||