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