From f35151afed49d48eec8430864c5e348ff5a021e5 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 20 Dec 2018 15:50:42 +0000 Subject: Don't require a command before EQ in a where clause --- crates/ra_syntax/src/grammar/type_params.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src') 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) { break; } where_predicate(p); - if p.current() != L_CURLY && p.current() != SEMI { + if p.current() != L_CURLY && p.current() != SEMI && p.current() != EQ { p.expect(COMMA); } } -- cgit v1.2.3 From 466885aa5bad53732786380f7579880fe2fd5645 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 20 Dec 2018 16:22:13 +0000 Subject: Fix missing DOTDOTEQs --- crates/ra_syntax/src/grammar/expressions.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_syntax/src') 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 { } const LHS_FIRST: TokenSet = token_set_union![ - token_set![AMP, STAR, EXCL, DOTDOT, MINUS], + token_set![AMP, STAR, EXCL, DOTDOT, DOTDOTEQ, MINUS], atom::ATOM_EXPR_FIRST, ]; @@ -237,7 +237,7 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> } // test full_range_expr // fn foo() { xs[..]; } - DOTDOT => { + DOTDOT | DOTDOTEQ => { m = p.start(); p.bump(); if p.at_ts(EXPR_FIRST) { @@ -287,7 +287,7 @@ fn postfix_expr( DOT if p.nth(1) == INT_NUMBER => field_expr(p, lhs), // test postfix_range // fn foo() { let x = 1..; } - DOTDOT if !EXPR_FIRST.contains(p.nth(1)) => { + DOTDOT | DOTDOTEQ if !EXPR_FIRST.contains(p.nth(1)) => { let m = lhs.precede(p); p.bump(); m.complete(p, RANGE_EXPR) -- cgit v1.2.3 From 134fe4f566d94fd4ca91c6417fab0ae7b3e4275f Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 20 Dec 2018 16:45:54 +0000 Subject: Fix the tests and fix the precommit hook --- crates/ra_syntax/src/grammar/expressions/atom.rs | 4 ++-- crates/ra_syntax/src/grammar/items.rs | 2 +- crates/ra_syntax/src/grammar/items/traits.rs | 2 +- crates/ra_syntax/src/grammar/items/use_item.rs | 2 +- crates/ra_syntax/src/grammar/type_args.rs | 2 +- crates/ra_syntax/src/grammar/types.rs | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'crates/ra_syntax/src') 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 WHILE_KW => while_expr(p, Some(m)), L_CURLY => block_expr(p, Some(m)), _ => { - // test misplaced_label_err + // test_err misplaced_label_err // fn main() { // 'loop: impl // } @@ -354,7 +354,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) { // fn foo() { // match () { // _ => (), -// _ if Test>{field: 0} => (), +// _ if Test > Test{field: 0} => (), // X | Y if Z => (), // | X | Y if Z => (), // | 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 { // modifiers has_mods |= p.eat(CONST_KW); - // test unsafe_block_in_mod + // test_err unsafe_block_in_mod // fn foo(){} unsafe { } fn bar(){} if p.at(UNSAFE_KW) && p.nth(1) != L_CURLY { 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 { && (p.nth(2) == R_ANGLE || p.nth(2) == COMMA || p.nth(2) == COLON || p.nth(2) == EQ) } -// test impl_type +// test_err impl_type // impl Type {} // impl Trait1 for T {} // 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) { // other::path as some_other_name, // different::path as different_name, // yet::another::path, - // running::out::of::synonyms::for::different::* + // running::out::of::synonyms::for_::different::* // }; opt_alias(p); } 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) { } // test type_arg -// type A = B<'static, i32, Item=u64> +// type A = B<'static, i32, Item=u64>; fn type_arg(p: &mut Parser) { let m = p.start(); match p.current() { 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) { // type C = *mut (); MUT_KW | CONST_KW => p.bump(), _ => { - // test pointer_type_no_mutability + // test_err pointer_type_no_mutability // type T = *(); p.error( "expected mut or const in raw pointer type \ @@ -132,7 +132,7 @@ fn array_or_slice_type(p: &mut Parser) { p.expect(R_BRACK); ARRAY_TYPE } - // test array_type_missing_semi + // test_err array_type_missing_semi // type T = [() 92]; _ => { p.error("expected `;` or `]`"); @@ -175,7 +175,7 @@ fn fn_pointer_type(p: &mut Parser) { if p.at(EXTERN_KW) { abi(p); } - // test fn_pointer_type_missing_fn + // test_err fn_pointer_type_missing_fn // type F = unsafe (); if !p.eat(FN_KW) { m.abandon(p); -- cgit v1.2.3