aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-09-05 17:53:07 +0100
committerAleksey Kladov <[email protected]>2019-09-05 17:53:07 +0100
commitb2be998b7b0beb48806cd3a1552e44100b12ddb6 (patch)
treec9221ae272d625fce3751e86afe21e6a623e3b71 /crates/ra_syntax
parentedc2016f8b49964fa5b179c1ed8e12e4e0a39702 (diff)
better error recovery for use trees
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0035_use_recover.rs5
-rw-r--r--crates/ra_syntax/test_data/parser/err/0035_use_recover.txt54
3 files changed, 60 insertions, 1 deletions
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
index 84867026f..bdb5fa6c5 100644
--- a/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.txt
+++ b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.txt
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 42)
28 WHITESPACE@[41; 42) "\n" 28 WHITESPACE@[41; 42) "\n"
29error 23: expected `[` 29error 23: expected `[`
30error 23: expected an item 30error 23: expected an item
31error 27: expected one of `*`, `::`, `{`, `self`, `super` or an indentifier 31error 27: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
32error 28: expected SEMI 32error 28: expected SEMI
33error 31: expected EXCL 33error 31: expected EXCL
34error 31: expected `{`, `[`, `(` 34error 31: expected `{`, `[`, `(`
diff --git a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rs b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rs
new file mode 100644
index 000000000..4a2668126
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rs
@@ -0,0 +1,5 @@
1use foo::bar;
2use
3use crate::baz;
4use
5fn f() {}
diff --git a/crates/ra_syntax/test_data/parser/err/0035_use_recover.txt b/crates/ra_syntax/test_data/parser/err/0035_use_recover.txt
new file mode 100644
index 000000000..636840828
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/err/0035_use_recover.txt
@@ -0,0 +1,54 @@
1SOURCE_FILE@[0; 48)
2 USE_ITEM@[0; 13)
3 USE_KW@[0; 3) "use"
4 WHITESPACE@[3; 4) " "
5 USE_TREE@[4; 12)
6 PATH@[4; 12)
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; 12)
13 NAME_REF@[9; 12)
14 IDENT@[9; 12) "bar"
15 SEMI@[12; 13) ";"
16 WHITESPACE@[13; 14) "\n"
17 USE_ITEM@[14; 17)
18 USE_KW@[14; 17) "use"
19 WHITESPACE@[17; 18) "\n"
20 USE_ITEM@[18; 33)
21 USE_KW@[18; 21) "use"
22 WHITESPACE@[21; 22) " "
23 USE_TREE@[22; 32)
24 PATH@[22; 32)
25 PATH@[22; 27)
26 PATH_SEGMENT@[22; 27)
27 CRATE_KW@[22; 27) "crate"
28 COLONCOLON@[27; 29) "::"
29 PATH_SEGMENT@[29; 32)
30 NAME_REF@[29; 32)
31 IDENT@[29; 32) "baz"
32 SEMI@[32; 33) ";"
33 WHITESPACE@[33; 34) "\n"
34 USE_ITEM@[34; 37)
35 USE_KW@[34; 37) "use"
36 WHITESPACE@[37; 38) "\n"
37 FN_DEF@[38; 47)
38 FN_KW@[38; 40) "fn"
39 WHITESPACE@[40; 41) " "
40 NAME@[41; 42)
41 IDENT@[41; 42) "f"
42 PARAM_LIST@[42; 44)
43 L_PAREN@[42; 43) "("
44 R_PAREN@[43; 44) ")"
45 WHITESPACE@[44; 45) " "
46 BLOCK_EXPR@[45; 47)
47 BLOCK@[45; 47)
48 L_CURLY@[45; 46) "{"
49 R_CURLY@[46; 47) "}"
50 WHITESPACE@[47; 48) "\n"
51error 17: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
52error 17: expected SEMI
53error 37: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
54error 37: expected SEMI