Non-syncing diagnostic at peek; used when flow must continue (e.g. missing class name). */
(&mut self, msg: &str)
| 303 | |
| 304 | /* Non-syncing diagnostic at peek; used when flow must continue (e.g. missing class name). */ |
| 305 | pub(super) fn diag_at_peek(&mut self, msg: &str) { |
| 306 | let n = self.source.len(); |
| 307 | let (start, end) = match self.tokens.peek() { |
| 308 | Some(t) if t.line > self.last_line && self.last_end > 0 => (self.last_end, self.last_end), |
| 309 | Some(t) => (t.start, t.end), |
| 310 | None => (n, n), |
| 311 | }; |
| 312 | self.errors.push(Diagnostic { start, end, msg: msg.to_string() }); |
| 313 | } |
| 314 | |
| 315 | /* Diagnostic at next token + panic-mode sync to next statement boundary. */ |
| 316 | pub(super) fn error(&mut self, msg: &str) { |
no test coverage detected