本文整理汇总了Python中incoq.compiler.incast.L.import_incast方法的典型用法代码示例。如果您正苦于以下问题:Python L.import_incast方法的具体用法?Python L.import_incast怎么用?Python L.import_incast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类incoq.compiler.incast.L
的用法示例。
在下文中一共展示了L.import_incast方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: py_preprocess
# 需要导入模块: from incoq.compiler.incast import L [as 别名]
# 或者: from incoq.compiler.incast.L import import_incast [as 别名]
def py_preprocess(tree):
"""Take in a Python AST tree, partially preprocess it, and return
the corresponding IncAST tree along with parsed information.
"""
# Rewrite QUERY directives to replace their source strings with
# the corresponding parsed Python ASTs. Provided that the other
# preprocessing steps are functional (i.e., apply equally to
# multiple occurrences of the same AST), this ensures that any
# subsequent steps that modify occurrences of a query will also
# modify its occurrence in the QUERY directive.
tree = preprocess_query_directives(tree)
# Admit some constructs as syntactic sugar that would otherwise
# be excluded from IncAST.
tree = preprocess_constructs(tree)
# Get rid of import statement and qualifiers for the runtime
# library.
tree = preprocess_runtime_import(tree)
# Get rid of main boilerplate.
tree = preprocess_main_call(tree)
# Get relation declarations.
tree, decls = preprocess_var_decls(tree)
# Get symbol info.
tree, info = preprocess_directives(tree)
# Convert the tree and parsed query info to IncAST.
tree = L.import_incast(tree)
info.query_info = [(L.import_incast(query), value) for query, value in info.query_info]
return tree, decls, info