<s> """<STR_LIT>""" <EOL> import re <EOL> try : <EOL> from simplejson . _speedups import make_scanner as c_make_scanner <EOL> except ImportError : <EOL> c_make_scanner = None <EOL> __all__ = [ '<STR_LIT>' ] <EOL> NUMBER_RE = re . compile ( <EOL> r'<STR_LIT>' , <EOL> ( re . VERBOSE | re . MULTILINE | re . DOTALL ) ) <EOL> def py_make_scanner ( context ) : <EOL> parse_object = context . parse_object <EOL> parse_array = context . parse_array <EOL> parse_string = context . parse_string <EOL> match_number = NUMBER_RE . match <EOL> encoding = context . encoding <EOL> strict = context . strict <EOL> parse_float = context . parse_float <EOL> parse_int = context . parse_int <EOL> parse_constant = context . parse_constant <EOL> object_hook = context . object_hook <EOL> def _scan_once ( string , idx ) : <EOL> try : <EOL> nextchar = string [ idx ] <EOL> except IndexError : <EOL> raise StopIteration <EOL> if nextchar == '<STR_LIT:">' : <EOL> return parse_string ( string , idx + <NUM_LIT:1> , encoding , strict ) <EOL> elif nextchar == '<STR_LIT:{>' : <EOL> return parse_object ( ( string , idx + <NUM_LIT:1> ) , encoding , strict , _scan_once , object_hook ) <EOL> elif nextchar == '<STR_LIT:[>' : <EOL> return parse_array ( ( string , idx + <NUM_LIT:1> ) , _scan_once ) <EOL> elif nextchar == '<STR_LIT:n>' and string [ idx : idx + <NUM_LIT:4> ] == '<STR_LIT:null>' : <EOL> return None , idx + <NUM_LIT:4> <EOL> elif nextchar == '<STR_LIT:t>' and string [ idx : idx + <NUM_LIT:4> ] == '<STR_LIT:true>' : <EOL> return True , idx + <NUM_LIT:4> <EOL> elif nextchar == '<STR_LIT:f>' and string [ idx : idx + <NUM_LIT:5> ] == '<STR_LIT:false>' : <EOL> return False , idx + <NUM_LIT:5> <EOL> m = match_number ( string , idx ) <EOL> if m is not None : <EOL> integer , frac , exp = m . groups ( ) <EOL> if frac or exp : <EOL> res = parse_float ( integer + ( frac or '<STR_LIT>' ) + ( exp or '<STR_LIT>' ) ) <EOL> else : <EOL> res = parse_int ( integer ) <EOL> return res , m . end ( ) <EOL> elif nextchar == '<STR_LIT:N>' and string [ idx : idx + <NUM_LIT:3> ] == '<STR_LIT>' : <EOL> return parse_constant ( '<STR_LIT>' ) , idx + <NUM_LIT:3> <EOL> elif nextchar == '<STR_LIT:I>' and string [ idx : idx + <NUM_LIT:8> ] == '<STR_LIT>' : <EOL> return parse_constant ( '<STR_LIT>' ) , idx + <NUM_LIT:8> <EOL> elif nextchar == '<STR_LIT:->' and string [ idx : idx + <NUM_LIT:9> ] == '<STR_LIT>' : <EOL> return parse_constant ( '<STR_LIT>' ) , idx + <NUM_LIT:9> <EOL> else : <EOL> raise StopIteration <EOL> return _scan_once <EOL> make_scanner = c_make_scanner or py_make_scanner </s>
