aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/syntax_node
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-02-17 17:08:34 +0000
committerVille Penttinen <[email protected]>2019-02-17 17:26:57 +0000
commit1c97c1ac11459d45f7bfc57dc72428d2b294520c (patch)
tree70638cabf61f96a7511f974cc66dae40175bfb22 /crates/ra_syntax/src/syntax_node
parent982f72c022b45629e6adbaef22884359d3495ecf (diff)
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.
Diffstat (limited to 'crates/ra_syntax/src/syntax_node')
-rw-r--r--crates/ra_syntax/src/syntax_node/syntax_error.rs4
1 files changed, 4 insertions, 0 deletions
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 {
92 UnclosedString, 92 UnclosedString,
93 InvalidSuffix, 93 InvalidSuffix,
94 InvalidBlockAttr, 94 InvalidBlockAttr,
95 InvalidMatchInnerAttr,
95} 96}
96 97
97#[derive(Debug, Clone, PartialEq, Eq, Hash)] 98#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -136,6 +137,9 @@ impl fmt::Display for SyntaxErrorKind {
136 InvalidBlockAttr => { 137 InvalidBlockAttr => {
137 write!(f, "A block in this position cannot accept inner attributes") 138 write!(f, "A block in this position cannot accept inner attributes")
138 } 139 }
140 InvalidMatchInnerAttr => {
141 write!(f, "Inner attributes are only allowed directly after the opening brace of the match expression")
142 }
139 ParseError(msg) => write!(f, "{}", msg.0), 143 ParseError(msg) => write!(f, "{}", msg.0),
140 } 144 }
141 } 145 }