diff options
author | Aleksey Kladov <[email protected]> | 2018-08-04 11:17:24 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-04 11:17:24 +0100 |
commit | e919db3731968ae7a6877530d2cb645b0495d5fd (patch) | |
tree | 02c8f9a9accf0db8f89bdf9c8a8293a81f557568 /tests/data/parser/err | |
parent | 7264c3294b3c460da459774058c9b9fa77edac12 (diff) |
refine item parsing
Diffstat (limited to 'tests/data/parser/err')
9 files changed, 33 insertions, 20 deletions
diff --git a/tests/data/parser/err/0001_item_recovery_in_file.txt b/tests/data/parser/err/0001_item_recovery_in_file.txt index f35b97b48..49612ac73 100644 --- a/tests/data/parser/err/0001_item_recovery_in_file.txt +++ b/tests/data/parser/err/0001_item_recovery_in_file.txt | |||
@@ -1,9 +1,9 @@ | |||
1 | FILE@[0; 21) | 1 | FILE@[0; 21) |
2 | ERROR@[0; 3) | 2 | ERROR@[0; 3) |
3 | IF_KW@[0; 2) | 3 | IF_KW@[0; 2) |
4 | err: `expected item` | 4 | err: `expected an item` |
5 | WHITESPACE@[2; 3) | 5 | WHITESPACE@[2; 3) |
6 | err: `expected item` | 6 | err: `expected an item` |
7 | ERROR@[3; 10) | 7 | ERROR@[3; 10) |
8 | MATCH_KW@[3; 8) | 8 | MATCH_KW@[3; 8) |
9 | WHITESPACE@[8; 10) | 9 | WHITESPACE@[8; 10) |
diff --git a/tests/data/parser/err/0002_duplicate_shebang.txt b/tests/data/parser/err/0002_duplicate_shebang.txt index 1a4b37da8..ef0ddb09a 100644 --- a/tests/data/parser/err/0002_duplicate_shebang.txt +++ b/tests/data/parser/err/0002_duplicate_shebang.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | FILE@[0; 42) | 1 | FILE@[0; 42) |
2 | SHEBANG@[0; 20) | 2 | SHEBANG@[0; 20) |
3 | err: `expected item` | 3 | err: `expected an item` |
4 | ERROR@[20; 42) | 4 | ERROR@[20; 42) |
5 | WHITESPACE@[20; 21) | 5 | WHITESPACE@[20; 21) |
6 | SHEBANG@[21; 41) | 6 | SHEBANG@[21; 41) |
diff --git a/tests/data/parser/err/0003_C++_semicolon.txt b/tests/data/parser/err/0003_C++_semicolon.txt index dc3cf6c73..0a2dad70d 100644 --- a/tests/data/parser/err/0003_C++_semicolon.txt +++ b/tests/data/parser/err/0003_C++_semicolon.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | FILE@[0; 40) | 1 | FILE@[0; 40) |
2 | STRUCT_ITEM@[0; 39) | 2 | STRUCT_ITEM@[0; 40) |
3 | STRUCT_KW@[0; 6) | 3 | STRUCT_KW@[0; 6) |
4 | NAME@[6; 9) | 4 | NAME@[6; 9) |
5 | WHITESPACE@[6; 7) | 5 | WHITESPACE@[6; 7) |
@@ -34,5 +34,5 @@ FILE@[0; 40) | |||
34 | R_CURLY@[38; 39) | 34 | R_CURLY@[38; 39) |
35 | err: `expected item, found `;` | 35 | err: `expected item, found `;` |
36 | consider removing this semicolon` | 36 | consider removing this semicolon` |
37 | ERROR@[39; 40) | 37 | ERROR@[39; 40) |
38 | SEMI@[39; 40) | 38 | SEMI@[39; 40) |
diff --git a/tests/data/parser/err/0004_use_path_bad_segment.txt b/tests/data/parser/err/0004_use_path_bad_segment.txt index 6eb6123ec..9b827d862 100644 --- a/tests/data/parser/err/0004_use_path_bad_segment.txt +++ b/tests/data/parser/err/0004_use_path_bad_segment.txt | |||
@@ -11,11 +11,10 @@ FILE@[0; 12) | |||
11 | COLONCOLON@[7; 9) | 11 | COLONCOLON@[7; 9) |
12 | err: `expected identifier` | 12 | err: `expected identifier` |
13 | err: `expected SEMI` | 13 | err: `expected SEMI` |
14 | err: `expected item` | 14 | err: `expected an item` |
15 | PATH_SEGMENT@[9; 9) | 15 | PATH_SEGMENT@[9; 9) |
16 | ERROR@[9; 11) | 16 | ERROR@[9; 11) |
17 | INT_NUMBER@[9; 11) "92" | 17 | INT_NUMBER@[9; 11) "92" |
18 | err: `expected item, found `;` | 18 | err: `expected an item` |
19 | consider removing this semicolon` | ||
20 | ERROR@[11; 12) | 19 | ERROR@[11; 12) |
21 | SEMI@[11; 12) | 20 | SEMI@[11; 12) |
diff --git a/tests/data/parser/err/0007_stray_curly_in_file.txt b/tests/data/parser/err/0007_stray_curly_in_file.txt index 9758a969f..473fe17cb 100644 --- a/tests/data/parser/err/0007_stray_curly_in_file.txt +++ b/tests/data/parser/err/0007_stray_curly_in_file.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | FILE@[0; 31) | 1 | FILE@[0; 31) |
2 | ERROR@[0; 3) | 2 | ERROR@[0; 3) |
3 | R_CURLY@[0; 1) | 3 | R_CURLY@[0; 1) |
4 | err: `expected item` | 4 | err: `expected an item` |
5 | WHITESPACE@[1; 3) | 5 | WHITESPACE@[1; 3) |
6 | STRUCT_ITEM@[3; 14) | 6 | STRUCT_ITEM@[3; 14) |
7 | STRUCT_KW@[3; 9) | 7 | STRUCT_KW@[3; 9) |
@@ -10,7 +10,7 @@ FILE@[0; 31) | |||
10 | IDENT@[10; 11) "S" | 10 | IDENT@[10; 11) "S" |
11 | SEMI@[11; 12) | 11 | SEMI@[11; 12) |
12 | WHITESPACE@[12; 14) | 12 | WHITESPACE@[12; 14) |
13 | err: `expected item` | 13 | err: `expected an item` |
14 | ERROR@[14; 17) | 14 | ERROR@[14; 17) |
15 | R_CURLY@[14; 15) | 15 | R_CURLY@[14; 15) |
16 | WHITESPACE@[15; 17) | 16 | WHITESPACE@[15; 17) |
@@ -26,7 +26,7 @@ FILE@[0; 31) | |||
26 | L_CURLY@[25; 26) | 26 | L_CURLY@[25; 26) |
27 | R_CURLY@[26; 27) | 27 | R_CURLY@[26; 27) |
28 | WHITESPACE@[27; 29) | 28 | WHITESPACE@[27; 29) |
29 | err: `expected item` | 29 | err: `expected an item` |
30 | ERROR@[29; 31) | 30 | ERROR@[29; 31) |
31 | R_CURLY@[29; 30) | 31 | R_CURLY@[29; 30) |
32 | WHITESPACE@[30; 31) | 32 | WHITESPACE@[30; 31) |
diff --git a/tests/data/parser/err/0008_item_block_recovery.txt b/tests/data/parser/err/0008_item_block_recovery.txt index 5bc62b6e1..80253d8af 100644 --- a/tests/data/parser/err/0008_item_block_recovery.txt +++ b/tests/data/parser/err/0008_item_block_recovery.txt | |||
@@ -13,17 +13,17 @@ FILE@[0; 95) | |||
13 | WHITESPACE@[10; 11) | 13 | WHITESPACE@[10; 11) |
14 | R_CURLY@[11; 12) | 14 | R_CURLY@[11; 12) |
15 | WHITESPACE@[12; 14) | 15 | WHITESPACE@[12; 14) |
16 | err: `expected item` | 16 | err: `expected an item` |
17 | ERROR@[14; 17) | 17 | ERROR@[14; 17) |
18 | IDENT@[14; 17) "bar" | 18 | IDENT@[14; 17) "bar" |
19 | err: `expected item` | 19 | err: `expected an item` |
20 | ERROR@[17; 18) | 20 | ERROR@[17; 18) |
21 | L_PAREN@[17; 18) | 21 | L_PAREN@[17; 18) |
22 | err: `expected item` | 22 | err: `expected an item` |
23 | ERROR@[18; 20) | 23 | ERROR@[18; 20) |
24 | R_PAREN@[18; 19) | 24 | R_PAREN@[18; 19) |
25 | WHITESPACE@[19; 20) | 25 | WHITESPACE@[19; 20) |
26 | err: `expected item` | 26 | err: `expected an item` |
27 | ERROR@[20; 82) | 27 | ERROR@[20; 82) |
28 | L_CURLY@[20; 21) | 28 | L_CURLY@[20; 21) |
29 | WHITESPACE@[21; 26) | 29 | WHITESPACE@[21; 26) |
diff --git a/tests/data/parser/err/0009_broken_struct_type_parameter.txt b/tests/data/parser/err/0009_broken_struct_type_parameter.txt index 700fc550f..72e5b36e5 100644 --- a/tests/data/parser/err/0009_broken_struct_type_parameter.txt +++ b/tests/data/parser/err/0009_broken_struct_type_parameter.txt | |||
@@ -13,18 +13,18 @@ FILE@[0; 43) | |||
13 | err: `expected COMMA` | 13 | err: `expected COMMA` |
14 | err: `expected R_ANGLE` | 14 | err: `expected R_ANGLE` |
15 | err: `expected `;`, `{`, or `(`` | 15 | err: `expected `;`, `{`, or `(`` |
16 | err: `expected item` | 16 | err: `expected an item` |
17 | ERROR@[12; 14) | 17 | ERROR@[12; 14) |
18 | PLUS@[12; 13) | 18 | PLUS@[12; 13) |
19 | WHITESPACE@[13; 14) | 19 | WHITESPACE@[13; 14) |
20 | err: `expected item` | 20 | err: `expected an item` |
21 | ERROR@[14; 15) | 21 | ERROR@[14; 15) |
22 | INT_NUMBER@[14; 15) "2" | 22 | INT_NUMBER@[14; 15) "2" |
23 | err: `expected item` | 23 | err: `expected an item` |
24 | ERROR@[15; 17) | 24 | ERROR@[15; 17) |
25 | R_ANGLE@[15; 16) | 25 | R_ANGLE@[15; 16) |
26 | WHITESPACE@[16; 17) | 26 | WHITESPACE@[16; 17) |
27 | err: `expected item` | 27 | err: `expected an item` |
28 | ERROR@[17; 33) | 28 | ERROR@[17; 33) |
29 | L_CURLY@[17; 18) | 29 | L_CURLY@[17; 18) |
30 | WHITESPACE@[18; 23) | 30 | WHITESPACE@[18; 23) |
diff --git a/tests/data/parser/err/0011_extern_struct.rs b/tests/data/parser/err/0011_extern_struct.rs new file mode 100644 index 000000000..c1bd0a2d1 --- /dev/null +++ b/tests/data/parser/err/0011_extern_struct.rs | |||
@@ -0,0 +1 @@ | |||
extern struct Foo; | |||
diff --git a/tests/data/parser/err/0011_extern_struct.txt b/tests/data/parser/err/0011_extern_struct.txt new file mode 100644 index 000000000..288f3469b --- /dev/null +++ b/tests/data/parser/err/0011_extern_struct.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | FILE@[0; 19) | ||
2 | ERROR@[0; 7) | ||
3 | ABI@[0; 7) | ||
4 | EXTERN_KW@[0; 6) | ||
5 | WHITESPACE@[6; 7) | ||
6 | err: `expected fn, trait or impl` | ||
7 | STRUCT_ITEM@[7; 19) | ||
8 | STRUCT_KW@[7; 13) | ||
9 | NAME@[13; 17) | ||
10 | WHITESPACE@[13; 14) | ||
11 | IDENT@[14; 17) "Foo" | ||
12 | SEMI@[17; 18) | ||
13 | WHITESPACE@[18; 19) | ||