diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-17 18:39:26 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-17 18:39:26 +0000 |
commit | 646b53ace30660935641932c043301e3cdd4e71f (patch) | |
tree | 42f94aa460aa4233ad4372044faa6e2a27842ed1 /crates/ra_syntax/src/syntax_node | |
parent | 3dcde0b2ab8bc28dc8ef98ec07cb6d1072b93de8 (diff) | |
parent | bb259587056faa3a76eed6e7dae487e1848d841a (diff) |
Merge #846
846: WIP: Enable parsing of attributes inside a match block r=matklad a=vipentti
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.
This fixes #845 and works towards #759
Co-authored-by: Ville Penttinen <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/syntax_node')
-rw-r--r-- | crates/ra_syntax/src/syntax_node/syntax_error.rs | 4 |
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 | } |