From c12450fb4e30c3418555e47d045bb9fd4318a10a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 29 Jul 2018 13:51:55 +0300 Subject: Introduce red-green syntax tree --- .../data/parser/err/0000_struct_field_missing_comma.txt | 2 +- tests/data/parser/err/0001_item_recovery_in_file.txt | 4 ++-- tests/data/parser/err/0002_duplicate_shebang.txt | 2 +- tests/data/parser/err/0003_C++_semicolon.txt | 4 ++-- tests/data/parser/err/0004_use_path_bad_segment.txt | 10 +++++----- tests/data/parser/err/0005_attribute_recover.txt | 6 +++--- tests/data/parser/err/0006_named_field_recovery.txt | 13 ++++++++----- tests/data/parser/err/0007_stray_curly_in_file.txt | 6 +++--- tests/data/parser/err/0008_item_block_recovery.txt | 8 ++++---- .../parser/err/0009_broken_struct_type_parameter.txt | 16 ++++++++-------- 10 files changed, 37 insertions(+), 34 deletions(-) (limited to 'tests/data/parser/err') diff --git a/tests/data/parser/err/0000_struct_field_missing_comma.txt b/tests/data/parser/err/0000_struct_field_missing_comma.txt index 5196fd718..2bb3ee6ec 100644 --- a/tests/data/parser/err/0000_struct_field_missing_comma.txt +++ b/tests/data/parser/err/0000_struct_field_missing_comma.txt @@ -18,7 +18,7 @@ FILE@[0; 34) WHITESPACE@[17; 18) IDENT@[18; 21) "u32" WHITESPACE@[21; 26) - err: `expected COMMA` + err: `expected COMMA` NAMED_FIELD@[26; 33) NAME@[26; 27) IDENT@[26; 27) "b" 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 e41ddc009..01bd2abe6 100644 --- a/tests/data/parser/err/0001_item_recovery_in_file.txt +++ b/tests/data/parser/err/0001_item_recovery_in_file.txt @@ -1,10 +1,10 @@ FILE@[0; 21) +err: `expected item` ERROR@[0; 3) - err: `expected item` IF_KW@[0; 2) WHITESPACE@[2; 3) + err: `expected item` ERROR@[3; 10) - err: `expected item` MATCH_KW@[3; 8) WHITESPACE@[8; 10) STRUCT_ITEM@[10; 21) diff --git a/tests/data/parser/err/0002_duplicate_shebang.txt b/tests/data/parser/err/0002_duplicate_shebang.txt index e7cf7187d..1a4b37da8 100644 --- a/tests/data/parser/err/0002_duplicate_shebang.txt +++ b/tests/data/parser/err/0002_duplicate_shebang.txt @@ -1,7 +1,7 @@ FILE@[0; 42) SHEBANG@[0; 20) - ERROR@[20; 42) err: `expected item` + ERROR@[20; 42) WHITESPACE@[20; 21) SHEBANG@[21; 41) WHITESPACE@[41; 42) diff --git a/tests/data/parser/err/0003_C++_semicolon.txt b/tests/data/parser/err/0003_C++_semicolon.txt index affe8fd09..dc3cf6c73 100644 --- a/tests/data/parser/err/0003_C++_semicolon.txt +++ b/tests/data/parser/err/0003_C++_semicolon.txt @@ -32,7 +32,7 @@ FILE@[0; 40) COMMA@[36; 37) WHITESPACE@[37; 38) R_CURLY@[38; 39) - ERROR@[39; 40) - err: `expected item, found `;` + err: `expected item, found `;` consider removing this semicolon` + ERROR@[39; 40) 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 0a67002ac..d9ff79ebe 100644 --- a/tests/data/parser/err/0004_use_path_bad_segment.txt +++ b/tests/data/parser/err/0004_use_path_bad_segment.txt @@ -9,13 +9,13 @@ FILE@[0; 12) WHITESPACE@[3; 4) IDENT@[4; 7) "foo" COLONCOLON@[7; 9) - PATH_SEGMENT@[9; 9) + err: `expected SEMI` err: `expected identifier` - err: `expected SEMI` + err: `expected item` + PATH_SEGMENT@[9; 9) ERROR@[9; 11) - err: `expected item` INT_NUMBER@[9; 11) - ERROR@[11; 12) - err: `expected item, found `;` + err: `expected item, found `;` consider removing this semicolon` + ERROR@[11; 12) SEMI@[11; 12) diff --git a/tests/data/parser/err/0005_attribute_recover.txt b/tests/data/parser/err/0005_attribute_recover.txt index 731f5f2f8..74dd38959 100644 --- a/tests/data/parser/err/0005_attribute_recover.txt +++ b/tests/data/parser/err/0005_attribute_recover.txt @@ -9,12 +9,12 @@ FILE@[0; 54) META_ITEM@[6; 9) IDENT@[6; 9) "foo" COMMA@[9; 10) - ERROR@[10; 12) err: `expected attribute` + ERROR@[10; 12) WHITESPACE@[10; 11) PLUS@[11; 12) + err: `expected attribute` ERROR@[12; 14) - err: `expected attribute` COMMA@[12; 13) WHITESPACE@[13; 14) LITERAL@[14; 16) @@ -43,7 +43,7 @@ FILE@[0; 54) L_PAREN@[39; 40) err: `expected attribute` WHITESPACE@[40; 41) - err: `expected R_BRACK` + err: `expected R_BRACK` FN_KW@[41; 43) NAME@[43; 47) WHITESPACE@[43; 44) diff --git a/tests/data/parser/err/0006_named_field_recovery.txt b/tests/data/parser/err/0006_named_field_recovery.txt index 2dec74866..cb5a9c32c 100644 --- a/tests/data/parser/err/0006_named_field_recovery.txt +++ b/tests/data/parser/err/0006_named_field_recovery.txt @@ -22,23 +22,26 @@ FILE@[0; 74) WHITESPACE@[22; 27) PUB_KW@[27; 30) WHITESPACE@[30; 31) + err: `expected field declaration` ERROR@[31; 38) - err: `expected field declaration` INT_NUMBER@[31; 33) WHITESPACE@[33; 38) - err: `expected COMMA` + err: `expected COMMA` + err: `expected field declaration` ERROR@[38; 40) - err: `expected field declaration` PLUS@[38; 39) WHITESPACE@[39; 40) + err: `expected COMMA` + err: `expected field declaration` ERROR@[40; 42) - err: `expected field declaration` MINUS@[40; 41) WHITESPACE@[41; 42) + err: `expected COMMA` + err: `expected field declaration` ERROR@[42; 48) - err: `expected field declaration` STAR@[42; 43) WHITESPACE@[43; 48) + err: `expected COMMA` NAMED_FIELD@[48; 58) VISIBILITY@[48; 52) PUB_KW@[48; 51) 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 8a3cb5096..cfc714cc6 100644 --- a/tests/data/parser/err/0007_stray_curly_in_file.txt +++ b/tests/data/parser/err/0007_stray_curly_in_file.txt @@ -1,6 +1,6 @@ FILE@[0; 31) +err: `expected item` ERROR@[0; 3) - err: `expected item` R_CURLY@[0; 1) WHITESPACE@[1; 3) STRUCT_ITEM@[3; 14) @@ -10,8 +10,8 @@ FILE@[0; 31) IDENT@[10; 11) "S" SEMI@[11; 12) WHITESPACE@[12; 14) + err: `expected item` ERROR@[14; 17) - err: `expected item` R_CURLY@[14; 15) WHITESPACE@[15; 17) FN_ITEM@[17; 29) @@ -25,7 +25,7 @@ FILE@[0; 31) L_CURLY@[25; 26) R_CURLY@[26; 27) WHITESPACE@[27; 29) + err: `expected item` ERROR@[29; 31) - err: `expected item` R_CURLY@[29; 30) 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 0e2aae7cc..ca332bcf0 100644 --- a/tests/data/parser/err/0008_item_block_recovery.txt +++ b/tests/data/parser/err/0008_item_block_recovery.txt @@ -12,18 +12,18 @@ FILE@[0; 95) WHITESPACE@[10; 11) R_CURLY@[11; 12) WHITESPACE@[12; 14) + err: `expected item` ERROR@[14; 17) - err: `expected item` IDENT@[14; 17) "bar" + err: `expected item` ERROR@[17; 18) - err: `expected item` L_PAREN@[17; 18) + err: `expected item` ERROR@[18; 20) - err: `expected item` R_PAREN@[18; 19) WHITESPACE@[19; 20) + err: `expected item` ERROR@[20; 82) - err: `expected item` L_CURLY@[20; 21) WHITESPACE@[21; 26) IF_KW@[26; 28) 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 9434a764a..c16c6dffe 100644 --- a/tests/data/parser/err/0009_broken_struct_type_parameter.txt +++ b/tests/data/parser/err/0009_broken_struct_type_parameter.txt @@ -6,26 +6,26 @@ FILE@[0; 43) IDENT@[7; 8) "S" TYPE_PARAM_LIST@[8; 12) L_ANGLE@[8; 9) - ERROR@[9; 12) err: `expected type parameter` + ERROR@[9; 12) INT_NUMBER@[9; 11) WHITESPACE@[11; 12) - err: `expected COMMA` - err: `expected R_ANGLE` - err: `expected `;`, `{`, or `(`` + err: `expected COMMA` + err: `expected R_ANGLE` + err: `expected `;`, `{`, or `(`` + err: `expected item` ERROR@[12; 14) - err: `expected item` PLUS@[12; 13) WHITESPACE@[13; 14) + err: `expected item` ERROR@[14; 15) - err: `expected item` INT_NUMBER@[14; 15) + err: `expected item` ERROR@[15; 17) - err: `expected item` R_ANGLE@[15; 16) WHITESPACE@[16; 17) + err: `expected item` ERROR@[17; 33) - err: `expected item` L_CURLY@[17; 18) WHITESPACE@[18; 23) IDENT@[23; 24) "f" -- cgit v1.2.3