def parse(seq):
    """Sequence(Token) -> object"""
    const = lambda x: lambda _: x
    tokval = lambda x: x.value
    toktype = lambda t: some(lambda x: x.type == t) >> tokval
    op = lambda s: a(Token(u'Op', s)) >> tokval
    op_ = lambda s: skip(op(s))
    n = lambda s: a(Token(u'Name', s)) >> tokval

    def make_array(n):
        if n is None:
            return []
        else:
            return [n[0]] + n[1]

    def make_object(n):
        return dict(make_array(n))

    def make_number(n):
        try:
            return int(n)
        except __HOLE__:
            return float(n)

    def unescape(s):
        std = {
            u'"': u'"', u'\\': u'\\', u'/': u'/', u'b': u'\b', u'f': u'\f',
            u'n': u'\n', u'r': u'\r', u't': u'\t',
        }

        def sub(m):
            if m.group(u'standard') is not None:
                return std[m.group(u'standard')]
            else:
                return unichr(int(m.group(u'unicode'), 16))

        return re_esc.sub(sub, s)

    def make_string(n):
        return unescape(n[1:-1])

    null = n(u'null') >> const(None)
    true = n(u'true') >> const(True)
    false = n(u'false') >> const(False)
    number = toktype(u'Number') >> make_number
    string = toktype(u'String') >> make_string
    value = forward_decl()
    member = string + op_(u':') + value >> tuple
    object = (
        op_(u'{') +
        maybe(member + many(op_(u',') + member)) +
        op_(u'}')
        >> make_object)
    array = (
        op_(u'[') +
        maybe(value + many(op_(u',') + value)) +
        op_(u']')
        >> make_array)
    value.define(
        null
        | true
        | false
        | object
        | array
        | number
        | string)
    json_text = object | array
    json_file = json_text + skip(finished)

    return json_file.parse(seq)
dataset/ETHPy150Open vlasovskikh/funcparserlib/funcparserlib/tests/json.py/parse