From e919db3731968ae7a6877530d2cb645b0495d5fd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 4 Aug 2018 13:17:24 +0300 Subject: refine item parsing --- tests/data/parser/inline/0006_extern_struct.rs | 1 - tests/data/parser/inline/0006_extern_struct.txt | 12 ----------- .../parser/inline/0013_unsafe_block_in_mod.txt | 8 ++++--- .../parser/inline/0023_array_type_missing_semi.txt | 7 +++--- .../inline/0029_fn_pointer_type_missing_fn.txt | 7 +++--- tests/data/parser/inline/0068_pub_expr.rs | 1 + tests/data/parser/inline/0068_pub_expr.txt | 25 ++++++++++++++++++++++ 7 files changed, 37 insertions(+), 24 deletions(-) delete mode 100644 tests/data/parser/inline/0006_extern_struct.rs delete mode 100644 tests/data/parser/inline/0006_extern_struct.txt create mode 100644 tests/data/parser/inline/0068_pub_expr.rs create mode 100644 tests/data/parser/inline/0068_pub_expr.txt (limited to 'tests/data/parser/inline') diff --git a/tests/data/parser/inline/0006_extern_struct.rs b/tests/data/parser/inline/0006_extern_struct.rs deleted file mode 100644 index c1bd0a2d1..000000000 --- a/tests/data/parser/inline/0006_extern_struct.rs +++ /dev/null @@ -1 +0,0 @@ -extern struct Foo; diff --git a/tests/data/parser/inline/0006_extern_struct.txt b/tests/data/parser/inline/0006_extern_struct.txt deleted file mode 100644 index f310e1225..000000000 --- a/tests/data/parser/inline/0006_extern_struct.txt +++ /dev/null @@ -1,12 +0,0 @@ -FILE@[0; 19) - ABI@[0; 7) - EXTERN_KW@[0; 6) - WHITESPACE@[6; 7) - err: `expected `fn` or `{`` - STRUCT_ITEM@[7; 19) - STRUCT_KW@[7; 13) - NAME@[13; 17) - WHITESPACE@[13; 14) - IDENT@[14; 17) "Foo" - SEMI@[17; 18) - WHITESPACE@[18; 19) diff --git a/tests/data/parser/inline/0013_unsafe_block_in_mod.txt b/tests/data/parser/inline/0013_unsafe_block_in_mod.txt index e5581d615..142838692 100644 --- a/tests/data/parser/inline/0013_unsafe_block_in_mod.txt +++ b/tests/data/parser/inline/0013_unsafe_block_in_mod.txt @@ -11,10 +11,12 @@ FILE@[0; 33) L_CURLY@[8; 9) R_CURLY@[9; 10) WHITESPACE@[10; 11) - UNSAFE_KW@[11; 17) - err: `expected `trait`, `impl` or `fn`` - ERROR@[17; 22) + err: `expected an item` + ERROR@[11; 18) + UNSAFE_KW@[11; 17) WHITESPACE@[17; 18) + err: `expected an item` + ERROR@[18; 22) L_CURLY@[18; 19) WHITESPACE@[19; 20) R_CURLY@[20; 21) diff --git a/tests/data/parser/inline/0023_array_type_missing_semi.txt b/tests/data/parser/inline/0023_array_type_missing_semi.txt index f3e9ffe4a..aa600eab4 100644 --- a/tests/data/parser/inline/0023_array_type_missing_semi.txt +++ b/tests/data/parser/inline/0023_array_type_missing_semi.txt @@ -15,14 +15,13 @@ FILE@[0; 18) WHITESPACE@[12; 13) err: `expected `;` or `]`` err: `expected SEMI` - err: `expected item` + err: `expected an item` ERROR@[13; 15) INT_NUMBER@[13; 15) "92" - err: `expected item` + err: `expected an item` ERROR@[15; 16) R_BRACK@[15; 16) - err: `expected item, found `;` -consider removing this semicolon` + err: `expected an item` ERROR@[16; 18) SEMI@[16; 17) WHITESPACE@[17; 18) diff --git a/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.txt b/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.txt index c99714ed4..82632b7bf 100644 --- a/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.txt +++ b/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.txt @@ -11,14 +11,13 @@ FILE@[0; 20) err: `expected `fn`` err: `expected SEMI` WHITESPACE@[15; 16) - err: `expected item` + err: `expected an item` ERROR@[16; 17) L_PAREN@[16; 17) - err: `expected item` + err: `expected an item` ERROR@[17; 18) R_PAREN@[17; 18) - err: `expected item, found `;` -consider removing this semicolon` + err: `expected an item` ERROR@[18; 20) SEMI@[18; 19) WHITESPACE@[19; 20) diff --git a/tests/data/parser/inline/0068_pub_expr.rs b/tests/data/parser/inline/0068_pub_expr.rs new file mode 100644 index 000000000..d9d99d2d3 --- /dev/null +++ b/tests/data/parser/inline/0068_pub_expr.rs @@ -0,0 +1 @@ +fn foo() { pub 92; } //FIXME diff --git a/tests/data/parser/inline/0068_pub_expr.txt b/tests/data/parser/inline/0068_pub_expr.txt new file mode 100644 index 000000000..09cf9b262 --- /dev/null +++ b/tests/data/parser/inline/0068_pub_expr.txt @@ -0,0 +1,25 @@ +FILE@[0; 29) + FN_ITEM@[0; 29) + FN_KW@[0; 2) + NAME@[2; 6) + WHITESPACE@[2; 3) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 9) + L_PAREN@[6; 7) + R_PAREN@[7; 8) + WHITESPACE@[8; 9) + BLOCK_EXPR@[9; 29) + L_CURLY@[9; 10) + EXPR_STMT@[10; 19) + VISIBILITY@[10; 15) + WHITESPACE@[10; 11) + PUB_KW@[11; 14) + WHITESPACE@[14; 15) + LITERAL@[15; 17) + INT_NUMBER@[15; 17) "92" + SEMI@[17; 18) + WHITESPACE@[18; 19) + R_CURLY@[19; 20) + WHITESPACE@[20; 21) + COMMENT@[21; 28) + WHITESPACE@[28; 29) -- cgit v1.2.3