# Path: debugger/debugee.py
# class Breakpoint(object):
#     """
#     Represents a breakpoint.
#     """
#     def __init__(self, number, location, line):
#         """
#         @type number: int
#         @type location: str
#         @type line: int
#         """
#         self.number = number
#         self.location = location
#         self.line = line
# 
#     def __repr__(self):
#         return "BP #{0}: {1}:{2}".format(self.number, self.location, self.line)
# 
# class InferiorThread(object):
#     """
#     Represents a thread of the debugged process.
#     """
#     def __init__(self, id, name, state, frame=None):
#         """
#         @type id: int
#         @type name: str
#         @type state: enums.ProcessState
#         @type frame: Frame
#         """
#         self.id = id
#         self.name = name
#         self.state = state
#         self.frame = frame
# 
#     def __repr__(self):
#         return "Thread #{0} ({1}): {2}".format(self.id, self.name, self.state)
# 
# class ThreadInfo(object):
#     """
#     Represents thread state (list of threads and the selected thread) of the
#     debugged process.
#     """
#     def __init__(self, selected_thread, threads):
#         """
#         @type selected_thread: InferiorThread
#         @type threads: list of InferiorThread
#         """
#         self.selected_thread = selected_thread
#         self.threads = threads
# 
#     def __repr__(self):
#         return "Thread info: active: {0}, threads: {1}".format(
#             str(self.selected_thread), str(self.threads))
# 
# class Frame(object):
#     """
#     Represents a stack frame of the debugged process.
#     """
#     def __init__(self, level, func, file, line):
#         """
#         @type level: int
#         @type func: str
#         @type file: str
#         @type line: int
#         """
#         self.level = level
#         self.func = func
#         self.file = file
#         self.line = line
#         self.variables = []
#         """@type variables: debugger.debugee.Variable"""
# 
#     def __repr__(self):
#         return "Frame #{0} ({1} at {2}:{3}".format(self.level, self.func,
#                                                    self.file, self.line)
# 
# Path: debugger/enums.py
# class ThreadState(Enum):
#     """
#     Represents thread state.
#     """
#     Running = 1
#     Stopped = 2
#     Exited = 3


import json
import re
from debugger.debugee import Breakpoint, InferiorThread, ThreadInfo, Frame
from debugger.enums import ThreadState
        @rtype: dict
        """
        return self.parse(data)["variables"]

    def parse_struct_member_names(self, data):
        """
        @type data: str
        @rtype: list of str
        """
        data = data.replace("'", "\"")
        return self._parse_json(data)

    def parse(self, data):
        return self._parse_json(self._prep_json(data))

    def _instantiate_thread(self, thread):
        return InferiorThread(int(thread["id"]), thread["name"],
                              self._instantiate_thread_state(thread["state"]),
                              self._instantiate_frame(thread["frame"]))

    def _instantiate_frame(self, frame):
        """
        @type frame: dict
        @rtype: debugee.Frame
        """
        level = int(frame.get("level", "0"))
        func = frame.get("func", "")
        fullname = frame.get("fullname", "")
        line = int(frame.get("line", "0"))


# Path: debugger/debugee.py
# class Breakpoint(object):
#     """
#     Represents a breakpoint.
#     """
#     def __init__(self, number, location, line):
#         """
#         @type number: int
#         @type location: str
#         @type line: int
#         """
#         self.number = number
#         self.location = location
#         self.line = line
# 
#     def __repr__(self):
#         return "BP #{0}: {1}:{2}".format(self.number, self.location, self.line)
# 
# class InferiorThread(object):
#     """
#     Represents a thread of the debugged process.
#     """
#     def __init__(self, id, name, state, frame=None):
#         """
#         @type id: int
#         @type name: str
#         @type state: enums.ProcessState
#         @type frame: Frame
#         """
#         self.id = id
#         self.name = name
#         self.state = state
#         self.frame = frame
# 
#     def __repr__(self):
#         return "Thread #{0} ({1}): {2}".format(self.id, self.name, self.state)
# 
# class ThreadInfo(object):
#     """
#     Represents thread state (list of threads and the selected thread) of the
#     debugged process.
#     """
#     def __init__(self, selected_thread, threads):
#         """
#         @type selected_thread: InferiorThread
#         @type threads: list of InferiorThread
#         """
#         self.selected_thread = selected_thread
#         self.threads = threads
# 
#     def __repr__(self):
#         return "Thread info: active: {0}, threads: {1}".format(
#             str(self.selected_thread), str(self.threads))
# 
# class Frame(object):
#     """
#     Represents a stack frame of the debugged process.
#     """
#     def __init__(self, level, func, file, line):
#         """
#         @type level: int
#         @type func: str
#         @type file: str
#         @type line: int
#         """
#         self.level = level
#         self.func = func
#         self.file = file
#         self.line = line
#         self.variables = []
#         """@type variables: debugger.debugee.Variable"""
# 
#     def __repr__(self):
#         return "Frame #{0} ({1} at {2}:{3}".format(self.level, self.func,
#                                                    self.file, self.line)
# 
# Path: debugger/enums.py
# class ThreadState(Enum):
#     """
#     Represents thread state.
#     """
#     Running = 1
#     Stopped = 2
#     Exited = 3


# Path: debugger/mi/parser.py
import json
import re
from debugger.debugee import Breakpoint, InferiorThread, ThreadInfo, Frame
from debugger.enums import ThreadState

        @rtype: dict
        """
        return self.parse(data)["variables"]

    def parse_struct_member_names(self, data):
        """
        @type data: str
        @rtype: list of str
        """
        data = data.replace("'", "\"")
        return self._parse_json(data)

    def parse(self, data):
        return self._parse_json(self._prep_json(data))

    def _instantiate_thread(self, thread):
        return InferiorThread(int(thread["id"]), thread["name"],
                              self._instantiate_thread_state(thread["state"]),
                              self._instantiate_frame(thread["frame"]))

    def _instantiate_frame(self, frame):
        """
        @type frame: dict
        @rtype: debugee.Frame
        """
        level = int(frame.get("level", "0"))
        func = frame.get("func", "")
        fullname = frame.get("fullname", "")
        line = int(frame.get("line", "0"))


        return Frame(level, func, fullname, line)