MCPcopy
hub / github.com/waditu/tushare / recover_parser

Method recover_parser

tushare/util/demjson.py:3528–3538  ·  view source on GitHub ↗

Try to recover after a syntax error by locating the next "known" position.

(self, state)

Source from the content-addressed store, hash-verified

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):

Callers 3

decode_numberMethod · 0.95
decode_compositeMethod · 0.95
decodeobjMethod · 0.95

Calls 5

skipwsMethod · 0.95
skipuntilMethod · 0.80
char_is_unicode_eolMethod · 0.80
peekMethod · 0.80
push_infoMethod · 0.80

Tested by

no test coverage detected