Exemplo n.º 1
0
 def process_subitem(self, item):
     r = False
     if self.endlabel:
         label = item.label
         if label == self.endlabel:
             r = True
             if isinstance(self.parent,
                           Do) and label == self.parent.endlabel:
                 # the same item label may be used for different block ends
                 self.put_item(item)
     return BeginStatement.process_subitem(self, item) or r
Exemplo n.º 2
0
 def process_subitem(self, item):
     # MAIN block does not define start/end line conditions,
     # so it should never end until all lines are read.
     # However, sometimes F77 programs lack the PROGRAM statement,
     # and here we fix that:
     if self.reader.format.is_f77:
         line = item.get_line()
         if line == 'end':
             message = item.reader.format_message(
                 'WARNING',
                 'assuming the end of undefined PROGRAM statement',
                 item.span[0], item.span[1])
             logger.warning(message)
             # print >> sys.stderr, message
             p = Program(self)
             p.content.extend(self.content)
             p.content.append(EndProgram(p, item))
             self.content[:] = [p]
             return
     return BeginStatement.process_subitem(self, item)