Centralize retrieval of new characters when parsing

Bug #244424 reported by John Millikin
2
Affects Status Importance Assigned to Milestone
jsonlib
New
Undecided
Unassigned

Bug Description

Currently, the parser uses recursive functions to build an object representing a given JSON expression. This is bad design, because it makes it more difficult to handle streaming parsing (such as from network or file). The parser should probably be redesigned to use something like the state machine in the pure-Python implementation:

int parse (text)
 state = ParserState ()
 for char in text:
  if char == '{': parse_object_start (state)
  elif char == '}': parse_dict_end (state)
  etc...

Once that's working, then parse() can be rewritten to accept streams.

Also, parse should allow the called functions to set the current state (IN_STRING, IN_NUMBER, AFTER_VALUE, etc). This will be used to decide which event function to call.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.