pass_manager.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:monasca-analytics 作者: openstack 项目源码 文件源码
def try_compute_type_table(banana):
    """
    Compute the type table for the provided banana string
    if possible. Does not throw any exception if it fails.
    :type banana: str
    :param banana: The string to parse and type check.
    """
    try:
        # Convert the grammar into an AST
        parser = grammar.banana_grammar()
        ast = parser.parse(banana)
        # Compute the type table for the given AST
        return typeck.typeck(ast)
    except exception.BananaException:
        return None
    except p.ParseSyntaxException:
        return None
    except p.ParseFatalException:
        return None
    except p.ParseException:
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号