Increments depth and checks the nesting limit.
(&mut self)
| 89 | |
| 90 | /// Increments depth and checks the nesting limit. |
| 91 | pub fn enter_container(&mut self) -> Result<(), ParseError> { |
| 92 | self.depth += 1; |
| 93 | if self.depth > 512 { |
| 94 | self.depth -= 1; |
| 95 | Err( |
| 96 | self |
| 97 | .scanner |
| 98 | .create_error_for_current_token(ParseErrorKind::NestingDepthExceeded), |
| 99 | ) |
| 100 | } else { |
| 101 | Ok(()) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /// Decrements depth. |
| 106 | pub fn exit_container(&mut self) { |
no test coverage detected