(&mut self, comment: Comment<'a>)
| 209 | } |
| 210 | |
| 211 | fn handle_comment(&mut self, comment: Comment<'a>) -> Result<(), ParseError> { |
| 212 | if !self.allow_comments { |
| 213 | return Err(self.create_error(ParseErrorKind::CommentsNotAllowed)); |
| 214 | } |
| 215 | |
| 216 | if self.comments.is_some() { |
| 217 | if let Some(comments) = self.current_comments.as_mut() { |
| 218 | comments.push(comment); |
| 219 | } else { |
| 220 | self.current_comments = Some(vec![comment]); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | Ok(()) |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /// Parses a string containing JSONC to an AST with comments and tokens. |
no test coverage detected