本文整理匯總了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")