From 1c97c1ac11459d45f7bfc57dc72428d2b294520c Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Sun, 17 Feb 2019 19:08:34 +0200 Subject: Enable parsing of attributes inside a match block We allow invalid inner attributes to be parsed, e.g. inner attributes that are not directly after the opening brace of the match block. Instead we run validation on `MatchArmList` to allow better reporting of errors. --- crates/ra_syntax/src/syntax_node/syntax_error.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_syntax/src/syntax_node') diff --git a/crates/ra_syntax/src/syntax_node/syntax_error.rs b/crates/ra_syntax/src/syntax_node/syntax_error.rs index 412cf82cc..4ff998090 100644 --- a/crates/ra_syntax/src/syntax_node/syntax_error.rs +++ b/crates/ra_syntax/src/syntax_node/syntax_error.rs @@ -92,6 +92,7 @@ pub enum SyntaxErrorKind { UnclosedString, InvalidSuffix, InvalidBlockAttr, + InvalidMatchInnerAttr, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -136,6 +137,9 @@ impl fmt::Display for SyntaxErrorKind { InvalidBlockAttr => { write!(f, "A block in this position cannot accept inner attributes") } + InvalidMatchInnerAttr => { + write!(f, "Inner attributes are only allowed directly after the opening brace of the match expression") + } ParseError(msg) => write!(f, "{}", msg.0), } } -- cgit v1.2.3