本文整理汇总了Python中symbol.compound_stmt方法的典型用法代码示例。如果您正苦于以下问题:Python symbol.compound_stmt方法的具体用法?Python symbol.compound_stmt怎么用?Python symbol.compound_stmt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类symbol
的用法示例。
在下文中一共展示了symbol.compound_stmt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Annotate
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import compound_stmt [as 别名]
def Annotate(cls, symbol_type, children):
if symbol_type != symbol.stmt:
return None
compound_statement = children[0]
if compound_statement.type != symbol.compound_stmt:
return None
statement = compound_statement.children[0]
if statement.type == symbol.funcdef:
return cls(statement.type, statement.children)
elif (statement.type == symbol.decorated and
statement.children[-1].type == symbol.funcdef):
return cls(statement.type, statement.children)
else:
return None
示例2: Annotate
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import compound_stmt [as 别名]
def Annotate(cls, symbol_type, children):
if symbol_type != symbol.stmt:
return None
compound_statement = children[0]
if compound_statement.type != symbol.compound_stmt:
return None
statement = compound_statement.children[0]
if statement.type == symbol.classdef:
return cls(statement.type, statement.children)
elif (statement.type == symbol.decorated and
statement.children[-1].type == symbol.classdef):
return cls(statement.type, statement.children)
else:
return None
示例3: single_input
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import compound_stmt [as 别名]
def single_input(self, node):
### do we want to do anything about being "interactive" ?
# NEWLINE | simple_stmt | compound_stmt NEWLINE
n = node[0][0]
if n != token.NEWLINE:
return self.com_stmt(node[0])
return Pass()
示例4: com_node
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import compound_stmt [as 别名]
def com_node(self, node):
# Note: compile.c has handling in com_node for del_stmt, pass_stmt,
# break_stmt, stmt, small_stmt, flow_stmt, simple_stmt,
# and compound_stmt.
# We'll just dispatch them.
return self._dispatch[node[0]](node[1:])