diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-20 18:45:24 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-20 18:45:24 +0000 |
commit | 057c95d3dd72725f13bfef25827b9034f19ba877 (patch) | |
tree | 67f280325c9bf3310b8a85f5d35dad2f2030c8c6 /crates/ra_syntax/src | |
parent | c626e4a52688bfc63b9d29ed89025b61e00d4326 (diff) | |
parent | 0ffba1e8965a75d2c07a053a0803a186fb7fa1f7 (diff) |
Merge #299
299: Ensure that the parser errors or not for the parser tests r=matklad a=DJMcNab
Co-authored-by: DJMcNab <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions.rs | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions/atom.rs | 4 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/items.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/items/traits.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/items/use_item.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/type_args.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/type_params.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/types.rs | 6 |
8 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs index 4f8c46ab3..1608b1a73 100644 --- a/crates/ra_syntax/src/grammar/expressions.rs +++ b/crates/ra_syntax/src/grammar/expressions.rs | |||
@@ -206,7 +206,7 @@ fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> BlockLike { | |||
206 | } | 206 | } |
207 | 207 | ||
208 | const LHS_FIRST: TokenSet = token_set_union![ | 208 | const LHS_FIRST: TokenSet = token_set_union![ |
209 | token_set![AMP, STAR, EXCL, DOTDOT, MINUS], | 209 | token_set![AMP, STAR, EXCL, DOTDOT, DOTDOTEQ, MINUS], |
210 | atom::ATOM_EXPR_FIRST, | 210 | atom::ATOM_EXPR_FIRST, |
211 | ]; | 211 | ]; |
212 | 212 | ||
@@ -237,7 +237,7 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> | |||
237 | } | 237 | } |
238 | // test full_range_expr | 238 | // test full_range_expr |
239 | // fn foo() { xs[..]; } | 239 | // fn foo() { xs[..]; } |
240 | DOTDOT => { | 240 | DOTDOT | DOTDOTEQ => { |
241 | m = p.start(); | 241 | m = p.start(); |
242 | p.bump(); | 242 | p.bump(); |
243 | if p.at_ts(EXPR_FIRST) { | 243 | if p.at_ts(EXPR_FIRST) { |
@@ -287,7 +287,7 @@ fn postfix_expr( | |||
287 | DOT if p.nth(1) == INT_NUMBER => field_expr(p, lhs), | 287 | DOT if p.nth(1) == INT_NUMBER => field_expr(p, lhs), |
288 | // test postfix_range | 288 | // test postfix_range |
289 | // fn foo() { let x = 1..; } | 289 | // fn foo() { let x = 1..; } |
290 | DOTDOT if !EXPR_FIRST.contains(p.nth(1)) => { | 290 | DOTDOT | DOTDOTEQ if !EXPR_FIRST.contains(p.nth(1)) => { |
291 | let m = lhs.precede(p); | 291 | let m = lhs.precede(p); |
292 | p.bump(); | 292 | p.bump(); |
293 | m.complete(p, RANGE_EXPR) | 293 | m.complete(p, RANGE_EXPR) |
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 3b5749318..31b09ac5b 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs | |||
@@ -89,7 +89,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
89 | WHILE_KW => while_expr(p, Some(m)), | 89 | WHILE_KW => while_expr(p, Some(m)), |
90 | L_CURLY => block_expr(p, Some(m)), | 90 | L_CURLY => block_expr(p, Some(m)), |
91 | _ => { | 91 | _ => { |
92 | // test misplaced_label_err | 92 | // test_err misplaced_label_err |
93 | // fn main() { | 93 | // fn main() { |
94 | // 'loop: impl | 94 | // 'loop: impl |
95 | // } | 95 | // } |
@@ -354,7 +354,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
354 | // fn foo() { | 354 | // fn foo() { |
355 | // match () { | 355 | // match () { |
356 | // _ => (), | 356 | // _ => (), |
357 | // _ if Test>{field: 0} => (), | 357 | // _ if Test > Test{field: 0} => (), |
358 | // X | Y if Z => (), | 358 | // X | Y if Z => (), |
359 | // | X | Y if Z => (), | 359 | // | X | Y if Z => (), |
360 | // | X => (), | 360 | // | X => (), |
diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs index 4473c2fab..b646dd070 100644 --- a/crates/ra_syntax/src/grammar/items.rs +++ b/crates/ra_syntax/src/grammar/items.rs | |||
@@ -89,7 +89,7 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem { | |||
89 | // modifiers | 89 | // modifiers |
90 | has_mods |= p.eat(CONST_KW); | 90 | has_mods |= p.eat(CONST_KW); |
91 | 91 | ||
92 | // test unsafe_block_in_mod | 92 | // test_err unsafe_block_in_mod |
93 | // fn foo(){} unsafe { } fn bar(){} | 93 | // fn foo(){} unsafe { } fn bar(){} |
94 | if p.at(UNSAFE_KW) && p.nth(1) != L_CURLY { | 94 | if p.at(UNSAFE_KW) && p.nth(1) != L_CURLY { |
95 | p.eat(UNSAFE_KW); | 95 | p.eat(UNSAFE_KW); |
diff --git a/crates/ra_syntax/src/grammar/items/traits.rs b/crates/ra_syntax/src/grammar/items/traits.rs index 31258c253..d4da8b2f7 100644 --- a/crates/ra_syntax/src/grammar/items/traits.rs +++ b/crates/ra_syntax/src/grammar/items/traits.rs | |||
@@ -116,7 +116,7 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool { | |||
116 | && (p.nth(2) == R_ANGLE || p.nth(2) == COMMA || p.nth(2) == COLON || p.nth(2) == EQ) | 116 | && (p.nth(2) == R_ANGLE || p.nth(2) == COMMA || p.nth(2) == COLON || p.nth(2) == EQ) |
117 | } | 117 | } |
118 | 118 | ||
119 | // test impl_type | 119 | // test_err impl_type |
120 | // impl Type {} | 120 | // impl Type {} |
121 | // impl Trait1 for T {} | 121 | // impl Trait1 for T {} |
122 | // impl impl NotType {} | 122 | // impl impl NotType {} |
diff --git a/crates/ra_syntax/src/grammar/items/use_item.rs b/crates/ra_syntax/src/grammar/items/use_item.rs index b3c78f351..5111d37eb 100644 --- a/crates/ra_syntax/src/grammar/items/use_item.rs +++ b/crates/ra_syntax/src/grammar/items/use_item.rs | |||
@@ -74,7 +74,7 @@ fn use_tree(p: &mut Parser) { | |||
74 | // other::path as some_other_name, | 74 | // other::path as some_other_name, |
75 | // different::path as different_name, | 75 | // different::path as different_name, |
76 | // yet::another::path, | 76 | // yet::another::path, |
77 | // running::out::of::synonyms::for::different::* | 77 | // running::out::of::synonyms::for_::different::* |
78 | // }; | 78 | // }; |
79 | opt_alias(p); | 79 | opt_alias(p); |
80 | } | 80 | } |
diff --git a/crates/ra_syntax/src/grammar/type_args.rs b/crates/ra_syntax/src/grammar/type_args.rs index 29ff6e534..f889419c5 100644 --- a/crates/ra_syntax/src/grammar/type_args.rs +++ b/crates/ra_syntax/src/grammar/type_args.rs | |||
@@ -26,7 +26,7 @@ pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | // test type_arg | 28 | // test type_arg |
29 | // type A = B<'static, i32, Item=u64> | 29 | // type A = B<'static, i32, Item=u64>; |
30 | fn type_arg(p: &mut Parser) { | 30 | fn type_arg(p: &mut Parser) { |
31 | let m = p.start(); | 31 | let m = p.start(); |
32 | match p.current() { | 32 | match p.current() { |
diff --git a/crates/ra_syntax/src/grammar/type_params.rs b/crates/ra_syntax/src/grammar/type_params.rs index f4c98675c..863f8e00c 100644 --- a/crates/ra_syntax/src/grammar/type_params.rs +++ b/crates/ra_syntax/src/grammar/type_params.rs | |||
@@ -108,7 +108,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) { | |||
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | where_predicate(p); | 110 | where_predicate(p); |
111 | if p.current() != L_CURLY && p.current() != SEMI { | 111 | if p.current() != L_CURLY && p.current() != SEMI && p.current() != EQ { |
112 | p.expect(COMMA); | 112 | p.expect(COMMA); |
113 | } | 113 | } |
114 | } | 114 | } |
diff --git a/crates/ra_syntax/src/grammar/types.rs b/crates/ra_syntax/src/grammar/types.rs index 811d399d4..a933b986b 100644 --- a/crates/ra_syntax/src/grammar/types.rs +++ b/crates/ra_syntax/src/grammar/types.rs | |||
@@ -97,7 +97,7 @@ fn pointer_type(p: &mut Parser) { | |||
97 | // type C = *mut (); | 97 | // type C = *mut (); |
98 | MUT_KW | CONST_KW => p.bump(), | 98 | MUT_KW | CONST_KW => p.bump(), |
99 | _ => { | 99 | _ => { |
100 | // test pointer_type_no_mutability | 100 | // test_err pointer_type_no_mutability |
101 | // type T = *(); | 101 | // type T = *(); |
102 | p.error( | 102 | p.error( |
103 | "expected mut or const in raw pointer type \ | 103 | "expected mut or const in raw pointer type \ |
@@ -132,7 +132,7 @@ fn array_or_slice_type(p: &mut Parser) { | |||
132 | p.expect(R_BRACK); | 132 | p.expect(R_BRACK); |
133 | ARRAY_TYPE | 133 | ARRAY_TYPE |
134 | } | 134 | } |
135 | // test array_type_missing_semi | 135 | // test_err array_type_missing_semi |
136 | // type T = [() 92]; | 136 | // type T = [() 92]; |
137 | _ => { | 137 | _ => { |
138 | p.error("expected `;` or `]`"); | 138 | p.error("expected `;` or `]`"); |
@@ -175,7 +175,7 @@ fn fn_pointer_type(p: &mut Parser) { | |||
175 | if p.at(EXTERN_KW) { | 175 | if p.at(EXTERN_KW) { |
176 | abi(p); | 176 | abi(p); |
177 | } | 177 | } |
178 | // test fn_pointer_type_missing_fn | 178 | // test_err fn_pointer_type_missing_fn |
179 | // type F = unsafe (); | 179 | // type F = unsafe (); |
180 | if !p.eat(FN_KW) { | 180 | if !p.eat(FN_KW) { |
181 | m.abandon(p); | 181 | m.abandon(p); |