Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

simplejson::scanner Namespace Reference


Functions

def py_make_scanner

Variables

 c_make_scanner = None
list __all__ = ['make_scanner']
tuple NUMBER_RE
 make_scanner = c_make_scannerorpy_make_scanner


Detailed Description

JSON token scanner

Function Documentation

def simplejson::scanner::py_make_scanner (   context  ) 

Definition at line 15 of file scanner.py.

00015                             :
00016     parse_object = context.parse_object
00017     parse_array = context.parse_array
00018     parse_string = context.parse_string
00019     match_number = NUMBER_RE.match
00020     encoding = context.encoding
00021     strict = context.strict
00022     parse_float = context.parse_float
00023     parse_int = context.parse_int
00024     parse_constant = context.parse_constant
00025     object_hook = context.object_hook
00026 
00027     def _scan_once(string, idx):
00028         try:
00029             nextchar = string[idx]
00030         except IndexError:
00031             raise StopIteration
00032 
00033         if nextchar == '"':
00034             return parse_string(string, idx + 1, encoding, strict)
00035         elif nextchar == '{':
00036             return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)
00037         elif nextchar == '[':
00038             return parse_array((string, idx + 1), _scan_once)
00039         elif nextchar == 'n' and string[idx:idx + 4] == 'null':
00040             return None, idx + 4
00041         elif nextchar == 't' and string[idx:idx + 4] == 'true':
00042             return True, idx + 4
00043         elif nextchar == 'f' and string[idx:idx + 5] == 'false':
00044             return False, idx + 5
00045 
00046         m = match_number(string, idx)
00047         if m is not None:
00048             integer, frac, exp = m.groups()
00049             if frac or exp:
00050                 res = parse_float(integer + (frac or '') + (exp or ''))
00051             else:
00052                 res = parse_int(integer)
00053             return res, m.end()
00054         elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
00055             return parse_constant('NaN'), idx + 3
00056         elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
00057             return parse_constant('Infinity'), idx + 8
00058         elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
00059             return parse_constant('-Infinity'), idx + 9
00060         else:
00061             raise StopIteration
00062 
00063     return _scan_once
00064 
make_scanner = c_make_scanner or py_make_scanner


Variable Documentation

Definition at line 9 of file scanner.py.

Definition at line 7 of file scanner.py.

simplejson::scanner::make_scanner = c_make_scannerorpy_make_scanner

Definition at line 65 of file scanner.py.

Initial value:

re.compile(
    r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
    (re.VERBOSE | re.MULTILINE | re.DOTALL))

Definition at line 11 of file scanner.py.


Generated at Wed Mar 17 18:22:39 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004