本文整理汇总了Python中Table.Table.destroy_current_scope方法的典型用法代码示例。如果您正苦于以下问题:Python Table.destroy_current_scope方法的具体用法?Python Table.destroy_current_scope怎么用?Python Table.destroy_current_scope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table.Table
的用法示例。
在下文中一共展示了Table.destroy_current_scope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Table import Table [as 别名]
# 或者: from Table.Table import destroy_current_scope [as 别名]
#.........这里部分代码省略.........
curr_line = self.lines._iter
pprint("# izraz")
pprint(self.lines.get_line())
if self.check_expressions(["<izraz_pridruzivanja>"]):
return self.izraz_pridruzivanja()
elif self.check_expressions(["<izraz>", "ZAREZ", "<izraz_pridruzivanja>"]):
self.izraz()
self.assert_leaf("ZAREZ")
return self.izraz_pridruzivanja()
##################################
## NAREDBENA STRUKTURA PROGRAMA ##
##################################
"""SLOZENA NAREDBA"""
def slozena_naredba(self, in_loop = False, in_function = False, function_to = []):
curr_line = self.lines._iter
pprint("# slozena_naredba")
pprint(self.lines.get_line())
if self.check_expressions(["L_VIT_ZAGRADA", "<lista_naredbi>", "D_VIT_ZAGRADA"]):
self.assert_leaf("L_VIT_ZAGRADA")
self.lista_naredbi(in_loop = in_loop, in_function = in_function, function_to = function_to)
self.assert_leaf("D_VIT_ZAGRADA")
elif self.check_expressions(["L_VIT_ZAGRADA", "<lista_deklaracija>", "<lista_naredbi>"
, "D_VIT_ZAGRADA"]):
self.table.create_new_scope() #### SCOPING!!!!!!!!
self.assert_leaf("L_VIT_ZAGRADA")
self.lista_deklaracija()
self.lista_naredbi(in_loop = in_loop, in_function = in_function, function_to = function_to)
self.assert_leaf("D_VIT_ZAGRADA")
self.table.destroy_current_scope() #### SCOPING!!!!!!!!
else:
return self.parse_error(curr_line)
"""LISTA NAREDBI"""
def lista_naredbi(self, in_loop = False, in_function = False, function_to = []):
curr_line = self.lines._iter
pprint("# lista_naredbi")
pprint(self.lines.get_line())
if self.check_expressions(["<naredba>"]):
self.naredba(in_loop = in_loop, in_function = in_function, function_to = function_to)
elif self.check_expressions(["<lista_naredbi>", "<naredba>"]):
self.lista_naredbi(in_loop = in_loop, in_function = in_function, function_to = function_to)
self.naredba(in_loop = in_loop, in_function = in_function, function_to = function_to)
else:
return self.parse_error(curr_line)
"""NAREDBA"""
def naredba(self, in_loop = False, in_function = False, function_to = []):
curr_line = self.lines._iter
pprint("# naredba")
pprint(self.lines.get_line())
if self.check_expressions(["<slozena_naredba>"]):
self.slozena_naredba(in_loop = in_loop, in_function = in_function, function_to = function_to)
elif self.check_expressions(["<izraz_naredba>"]):
self.izraz_naredba()
elif self.check_expressions(["<naredba_grananja>"]):
self.naredba_grananja(in_loop = in_loop, in_function = in_function, function_to = function_to)
elif self.check_expressions(["<naredba_petlje>"]):
self.naredba_petlje(in_loop = in_loop, in_function = in_function, function_to = function_to)
elif self.check_expressions(["<naredba_skoka>"]):