Exemplo n.º 1
0
 def process_item(self):
     clsname = self.__class__.__name__.lower()
     item = self.item
     line = item.get_line()
     m = self.match(line)
     i = line.lower().find(clsname)
     assert i != -1, repr((clsname, line))
     self.prefix = line[:i].rstrip()
     self.name = line[i:m.end()].lstrip()[len(clsname):].strip()
     line = line[m.end():].lstrip()
     args = []
     if line.startswith('('):
         i = line.find(')')
         assert i != -1, repr(line)
         line2 = item.apply_map(line[:i + 1])
         for a in line2[1:-1].split(','):
             a = a.strip()
             if not a:
                 continue
             args.append(a)
         line = line[i + 1:].lstrip()
     suffix = item.apply_map(line)
     self.bind, suffix = parse_bind(suffix, item)
     self.result = None
     if isinstance(self, Function):
         self.result, suffix = parse_result(suffix, item)
         if suffix:
             assert self.bind is None, repr(self.bind)
             self.bind, suffix = parse_result(suffix, item)
         if self.result is None:
             self.result = self.name
     assert not suffix, repr(suffix)
     self.args = args
     self.typedecl = None
     return BeginStatement.process_item(self)
Exemplo n.º 2
0
 def process_item(self):
     line = self.item.get_line()[4:].lstrip()
     if line.startswith('('):
         self.isvalid = False
         return
     specs = []
     i = line.find('::')
     if i != -1:
         for s in line[:i].split(','):
             s = s.strip()
             if s:
                 specs.append(s)
         line = line[i + 2:].lstrip()
     self.specs = specs
     i = line.find('(')
     if i != -1:
         self.name = line[:i].rstrip()
         assert line[-1] == ')', repr(line)
         self.params = split_comma(line[i + 1:-1].lstrip())
     else:
         self.name = line
         self.params = []
     if not is_name(self.name):
         self.isvalid = False
         return
     return BeginStatement.process_item(self)
Exemplo n.º 3
0
 def process_item(self):
     if self.item is not None:
         name = self.item.get_line().replace(' ', '')
         name = name[len(self.blocktype):].strip()
         if name:
             self.name = name
     return BeginStatement.process_item(self)
Exemplo n.º 4
0
 def process_item(self):
     item = self.item
     line = item.get_line()[2:-4].strip()
     assert line[0] == '(' and line[-1] == ')', repr(line)
     self.expr = item.apply_map(line[1:-1].strip())
     self.construct_name = item.name
     return BeginStatement.process_item(self)
Exemplo n.º 5
0
 def process_item(self):
     line = self.item.get_line()
     line = self.item.apply_map(line)
     self.isabstract = line.startswith('abstract')
     if self.isabstract:
         self.generic_spec = ''
     else:
         self.generic_spec = line[len(self.blocktype):].strip()
     self.name = self.generic_spec  # XXX
     return BeginStatement.process_item(self)
Exemplo n.º 6
0
 def process_item(self):
     ''' Populate the state of this Select object by parsing the
     associated line of code '''
     item = self.item
     # TODO make the following more robust, particularly to the
     # presence of a name at the beginning
     # (e.g. "a_name: select case(...)")
     line = item.get_line()[6:].lstrip()[4:].lstrip()[1:-1].strip()
     self.expr = item.apply_map(line)
     self.construct_name = self.item.name
     return BeginStatement.process_item(self)
Exemplo n.º 7
0
 def process_item(self):
     item = self.item
     line = item.get_line()
     m = self.item_re(line)
     label = m.group('label').strip() or None
     if label:
         label = int(label)
     self.endlabel = label
     self.construct_name = item.name
     self.loopcontrol = m.group('loopcontrol').strip()
     return BeginStatement.process_item(self)
Exemplo n.º 8
0
 def process_item(self):
     self.name = self.item.get_line()[5:].lstrip()[4:].lstrip()
     return BeginStatement.process_item(self)
Exemplo n.º 9
0
 def process_item(self):
     self.name = self.item.get_line().replace(' ', '')
     self.name = self.name[len(self.blocktype):].strip()
     return BeginStatement.process_item(self)
Exemplo n.º 10
0
 def process_item(self):
     return BeginStatement.process_item(self)
Exemplo n.º 11
0
 def process_item(self):
     line = self.item.get_line()[9:].lstrip()
     self.associations = line[1:-1].strip()
     return BeginStatement.process_item(self)
Exemplo n.º 12
0
 def process_item(self):
     self.specs = self.item.get_line()[6:].lstrip()[1:-1].strip()
     return BeginStatement.process_item(self)
Exemplo n.º 13
0
 def process_item(self):
     self.expr = self.item.apply_map(
         self.item.get_line()[5:].lstrip()[1:-1].strip())
     self.construct_name = self.item.name
     return BeginStatement.process_item(self)