def _load(self, event):
        if event.type == START_OBJECT:
            value = start = "{"
            end = "}"
        elif event.type == START_ARRAY:
            value = start = "["
            end = "]"
        else:
            raise JSONParseError(
                JSON_UNEXPECTED_ELEMENT_ERROR,
                "Unexpected event: " + event.type)
        count = 1
        tokens = self.tokens
        tokenIndex = self.tokenIndex
        inString = False
        inEscape = False
        try:
            while True:
                startIndex = tokenIndex
                for token in tokens[startIndex:]:
                    tokenIndex += 1
                    if token == "":
                        pass
                    elif inString:
                        if inEscape:
                            inEscape = False
                        elif token == '"':
                            inString = False
                        elif token == '\\':
                            inEscape = True
                    elif token == '"':
                        inString = True
                    elif token == start:
                        count += 1
                    elif token == end:
                        count -= 1
                        if count == 0:
                            value += "".join(tokens[startIndex:tokenIndex])
                            raise StopIteration()
                value += "".join(tokens[startIndex:])
                data = self.stream.read(self.size)
                if data == "":
                    raise JSONParseError(
                        JSON_INCOMPLETE_ERROR, "Reached end of input before "
                        "reaching end of JSON structures.")
                tokens = self.pattern.split(data)
                tokenIndex = 0
        except __HOLE__:
            pass
        self.tokens = tokens
        self.tokenIndex = tokenIndex
        try:
            return json.loads(value, parse_float=decimal.Decimal,
                              parse_int=decimal.Decimal)
        except ValueError as e:
            raise JSONParseError(JSON_SYNTAX_ERROR, "".join(e.args))
dataset/ETHPy150Open Teradata/PyTd/teradata/pulljson.py/JSONPullParser._load