当前位置: 首页>>代码示例>>Python>>正文


Python Table.destroy_current_scope方法代码示例

本文整理汇总了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>"]):
开发者ID:PPJ-Grupa,项目名称:PPJ,代码行数:70,代码来源:MojSemantickiAnalizator.py


注:本文中的Table.Table.destroy_current_scope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。