Back to index

python3.2  3.2.2
Functions | Variables
json.decoder Namespace Reference

Functions

def _floatconstants
def linecol
def errmsg

Variables

 c_scanstring = None
list __all__ = ['JSONDecoder']
 FLAGS = re.VERBOSE|re.MULTILINE|re.DOTALL
dictionary _CONSTANTS

Detailed Description

Implementation of JSONDecoder

Function Documentation

def json.decoder._floatconstants ( ) [private]

Definition at line 18 of file decoder.py.

00018 
00019 def _floatconstants():
00020     _BYTES = binascii.unhexlify(b'7FF80000000000007FF0000000000000')
00021     if sys.byteorder != 'big':
00022         _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]
00023     nan, inf = struct.unpack('dd', _BYTES)
00024     return nan, inf, -inf
00025 
00026 NaN, PosInf, NegInf = _floatconstants()
00027 

def json.decoder.errmsg (   msg,
  doc,
  pos,
  end = None 
)

Definition at line 41 of file decoder.py.

00041 
00042 def errmsg(msg, doc, pos, end=None):
00043     # Note that this function is called from _json
00044     lineno, colno = linecol(doc, pos)
00045     if end is None:
00046         fmt = '{0}: line {1} column {2} (char {3})'
00047         return fmt.format(msg, lineno, colno, pos)
00048         #fmt = '%s: line %d column %d (char %d)'
00049         #return fmt % (msg, lineno, colno, pos)
00050     endlineno, endcolno = linecol(doc, end)
00051     fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})'
00052     return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end)
00053     #fmt = '%s: line %d column %d - line %d column %d (char %d - %d)'
00054     #return fmt % (msg, lineno, colno, endlineno, endcolno, pos, end)
00055 

Here is the call graph for this function:

Here is the caller graph for this function:

def json.decoder.linecol (   doc,
  pos 
)

Definition at line 28 of file decoder.py.

00028 
00029 def linecol(doc, pos):
00030     if isinstance(doc, bytes):
00031         newline = b'\n'
00032     else:
00033         newline = '\n'
00034     lineno = doc.count(newline, 0, pos) + 1
00035     if lineno == 1:
00036         colno = pos
00037     else:
00038         colno = pos - doc.rindex(newline, 0, pos)
00039     return lineno, colno
00040 

Here is the caller graph for this function:


Variable Documentation

list json.decoder.__all__ = ['JSONDecoder']

Definition at line 14 of file decoder.py.

Initial value:
00001 {
00002     '-Infinity': NegInf,
00003     'Infinity': PosInf,
00004     'NaN': NaN,
00005 }

Definition at line 56 of file decoder.py.

Definition at line 12 of file decoder.py.

json.decoder.FLAGS = re.VERBOSE|re.MULTILINE|re.DOTALL

Definition at line 16 of file decoder.py.