Try to recover after a syntax error by locating the next "known" position.
(self, state)
| 3526 | |
| 3527 | |
| 3528 | def recover_parser(self, state): |
| 3529 | """Try to recover after a syntax error by locating the next "known" position.""" |
| 3530 | buf = state.buf |
| 3531 | buf.skipuntil( lambda c: c in ",:[]{}\"\';" or helpers.char_is_unicode_eol(c) ) |
| 3532 | stopchar = buf.peek() |
| 3533 | self.skipws(state) |
| 3534 | if buf.at_end: |
| 3535 | state.push_info("Could not recover parsing after previous error",position=buf.position) |
| 3536 | else: |
| 3537 | state.push_info("Recovering parsing after character %r" % stopchar, position=buf.position) |
| 3538 | return stopchar |
| 3539 | |
| 3540 | |
| 3541 | def decode_null(self, state): |
no test coverage detected