

def parse(codelet):
    "\n    Dispatches the codelet to the correct parser based on its language.\n        It is the job of the respective parsers to accumulate data about the\n        code and to convert it into a string representing a python dict.\n        The codelet is then given dict as its 'symbols' field.\n\n    :param codelet: The codelet object to parsed.\n\n    :type code: Codelet\n    "
    lang = _lang(codelet)
    lang_string = LANGS[lang]
    codelet.language = lang

    def loc_helper(l):
        for i in l:
            if (i == (- 1)):
                (yield None)
            else:
                (yield i)
    if (lang_string in PARSERS):
        symbols = PARSERS[lang_string](codelet)
        symbols = {key: [(name, [tuple(loc_helper(loc)) for loc in syms[name]['assignments']], [tuple(loc_helper(loc)) for loc in syms[name]['uses']]) for name in syms] for (key, syms) in symbols.iteritems()}
        codelet.symbols = symbols

dataset/ETHPy150Open earwig/bitshift/bitshift/parser/__init__.py parse/original