From 4899e7be76c5c8309222c8afe1c0f74dc59a4345 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 24 Jan 2019 21:19:16 +0000 Subject: Support universal function call syntax in function calls --- crates/ra_syntax/src/grammar/expressions/atom.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/ra_syntax/src/grammar/expressions/atom.rs') diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 167a76551..5feca090c 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs @@ -40,6 +40,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![ L_PAREN, L_CURLY, L_BRACK, + L_ANGLE, // Universal function call syntax PIPE, MOVE_KW, IF_KW, -- cgit v1.2.3 From f0e5a314b029216c4f9446aa6ba34c4b842db23e Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 24 Jan 2019 21:31:43 +0000 Subject: Dedupe PATH_FIRST in ATOM_EXPR_FIRST --- crates/ra_syntax/src/grammar/expressions/atom.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'crates/ra_syntax/src/grammar/expressions/atom.rs') diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 5feca090c..5072d2c49 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs @@ -1,4 +1,5 @@ use super::*; +use crate::grammar::paths::PATH_FIRST; // test expr_literals // fn foo() { @@ -36,11 +37,10 @@ pub(crate) fn literal(p: &mut Parser) -> Option { } // E.g. for after the break in `if break {}`, this should not match -pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![ +pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(PATH_FIRST).union(token_set![ L_PAREN, L_CURLY, L_BRACK, - L_ANGLE, // Universal function call syntax PIPE, MOVE_KW, IF_KW, @@ -48,11 +48,6 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![ MATCH_KW, UNSAFE_KW, RETURN_KW, - IDENT, - SELF_KW, - SUPER_KW, - CRATE_KW, - COLONCOLON, BREAK_KW, CONTINUE_KW, LIFETIME, -- cgit v1.2.3 From 82dfb0015760742e437f224f315f2d5534bdb926 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 24 Jan 2019 21:41:02 +0000 Subject: Apply suggestions from code review Co-Authored-By: DJMcNab <36049421+DJMcNab@users.noreply.github.com> --- crates/ra_syntax/src/grammar/expressions/atom.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'crates/ra_syntax/src/grammar/expressions/atom.rs') diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 5072d2c49..23f9b05bb 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs @@ -1,5 +1,4 @@ use super::*; -use crate::grammar::paths::PATH_FIRST; // test expr_literals // fn foo() { @@ -37,7 +36,7 @@ pub(crate) fn literal(p: &mut Parser) -> Option { } // E.g. for after the break in `if break {}`, this should not match -pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(PATH_FIRST).union(token_set![ +pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![ L_PAREN, L_CURLY, L_BRACK, -- cgit v1.2.3 From 107d6a0a16c8dc89394b9ee69ec3b20f52a5a721 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 24 Jan 2019 22:01:49 +0000 Subject: Reformat --- crates/ra_syntax/src/grammar/expressions/atom.rs | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'crates/ra_syntax/src/grammar/expressions/atom.rs') diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 23f9b05bb..6d6d89f70 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs @@ -36,21 +36,22 @@ pub(crate) fn literal(p: &mut Parser) -> Option { } // E.g. for after the break in `if break {}`, this should not match -pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![ - L_PAREN, - L_CURLY, - L_BRACK, - PIPE, - MOVE_KW, - IF_KW, - WHILE_KW, - MATCH_KW, - UNSAFE_KW, - RETURN_KW, - BREAK_KW, - CONTINUE_KW, - LIFETIME, -]); +pub(super) const ATOM_EXPR_FIRST: TokenSet = + LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![ + L_PAREN, + L_CURLY, + L_BRACK, + PIPE, + MOVE_KW, + IF_KW, + WHILE_KW, + MATCH_KW, + UNSAFE_KW, + RETURN_KW, + BREAK_KW, + CONTINUE_KW, + LIFETIME, + ]); const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; -- cgit v1.2.3