Beispiel #1
0
 def tree(self):
     """
     Parse code up to, but not including, the current line.
     However, we could be inside component, in that case remove the opening statement.
     FIXME: this is rather naive, but should work reasonably well
     """
     lineno = self.lineno if self._first_line_is_zero else self.lineno - 1
     src_lines = self.source_lines[:lineno]
     for l in reversed(src_lines):
         if '}' in l:
             break
         if l.startswith('component'):
             src_lines.remove(l)
             break
     src = "\n".join(src_lines)
     ir, _, issues = calvin_parse(src)
     return ir
 def tree(self):
     """
     Parse code up to, but not including, the current line.
     However, we could be inside component, in that case remove the opening statement.
     FIXME: this is rather naive, but should work reasonably well
     """
     lineno = self.lineno if self._first_line_is_zero else self.lineno - 1
     src_lines = self.source_lines[:lineno]
     for l in reversed(src_lines):
         if '}' in l:
             break
         if l.startswith('component'):
             src_lines.remove(l)
             break
     src = "\n".join(src_lines)
     ir, issues = calvin_parse(src)
     return ir
 def setUp(self):
     self.ir, self.it = calvin_parse(inspect.cleandoc(self.source_text))
Beispiel #4
0
 def setUp(self):
     self.ir, self.deploy_ir, self.it = calvin_parse(inspect.cleandoc(self.source_text))