本文整理汇总了Python中spark.GenericASTBuilder类的典型用法代码示例。如果您正苦于以下问题:Python GenericASTBuilder类的具体用法?Python GenericASTBuilder怎么用?Python GenericASTBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericASTBuilder类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resolve
def resolve(self, list):
if len(list) == 2 and "funcdef" in list and "assign" in list:
return "funcdef"
if "grammar" in list and "expr" in list:
return "expr"
# print >> sys.stderr, 'resolve', str(list)
return GenericASTBuilder.resolve(self, list)
示例2: nonterminal
def nonterminal(self, type, args):
#
# Flatten AST a bit by not making nodes if there's only
# one child.
#
if len(args) == 1:
return args[0]
return GenericASTBuilder.nonterminal(self, type, args)
示例3: nonterminal
def nonterminal(self, nt, args):
collect = ("stmts", "exprlist", "kvlist", "_stmts", "print_items")
if nt in collect and len(args) > 1:
#
# Collect iterated thingies together.
#
rv = args[0]
rv.append(args[1])
else:
rv = GenericASTBuilder.nonterminal(self, nt, args)
return rv
示例4: nonterminal
def nonterminal(self, nt, args):
collect = ('stmts', 'exprlist', 'kvlist')
if nt in collect and len(args) > 1:
#
# Collect iterated thingies together.
#
rv = args[0]
rv.append(args[1])
else:
rv = GenericASTBuilder.nonterminal(self, nt, args)
return rv
示例5: __init__
def __init__(self, AST, start='func_list'):
GenericASTBuilder.__init__(self, AST, start)
示例6: nonterminal
def nonterminal(self, type, args):
if len(args) == 1:
return args[0]
return GenericASTBuilder.nonterminal(self, type, args)
示例7: __ambiguity
def __ambiguity(self, children):
# only for debugging! to be removed hG/2000-10-15
print children
return GenericASTBuilder.ambiguity(self, children)
示例8: __init__
def __init__(self):
GenericASTBuilder.__init__(self, AST, "stmts")
self.customized = {}
示例9: __init__
def __init__(self, AST, start='expr'):
GenericASTBuilder.__init__(self, AST, start)
示例10: __init__
def __init__(self, ASTclass, start='top'):
GenericASTBuilder.__init__(self, ASTclass, start)
示例11: resolve
def resolve(self, list):
if len(list) == 2 and 'funcdef' in list and 'assign' in list:
return 'funcdef'
#sys.stderr.writelines( ['resolve ', str(list), '\n'] )
return GenericASTBuilder.resolve(self, list)
示例12: __init__
def __init__(self):
GenericASTBuilder.__init__(self, AST, 'code')
self.customized = {}
示例13: __init__
def __init__(self):
GenericASTBuilder.__init__(self, AST, "file")