def preprocess(self):
     s_GI = self.GI.s
     s_re = re.search(r'troublemaker\s+(.*):', s_GI)
     if s_re is None:
         raise SyntaxError
     self.ptn = ExpressionFactory(s_re.group(1)).assign()
     self.commands = self.get_enclosed_commands()
示例#2
0
 def preprocess(self, s):
     s_GI = self.GI.s
     s_re = re.search(r'if\s+(.*):', s_GI) # syntax "if /xxx/:"
     if s_re is None:
         raise SyntaxError
     self.ptn = ExpressionFactory(s_re.group(1)).assign()
     self.commands = self.get_enclosed_commands()
示例#3
0
    def __init__(self, GI, FI, parsed_container, troublemakers):
        super().__init__(GI, FI, parsed_container, troublemakers)

        s = self.GI.s
        s_re = re.search(r'jump\s*(.*)', s)  # syntax "if /xxx/:"
        if s_re is None:
            raise SyntaxError

        self.s_function = s_re.group(1)
        self.f = ExpressionFactory(
            self.s_function,
            f_get_params=self.parsed_container.last_value).assign()
示例#4
0
 def init_global_if(self):
     s_GI = self.GI.s
     s_re = re.search(r'if\s+(.*):', s_GI)  # syntax "if /xxx/:"
     if s_re is None:
         raise SyntaxError
     s_re = s_re.group(1)
     ptn = ExpressionFactory(s_re).assign()
     self.pattern_type = ptn.type
     self.pattern = ptn.pattern
     self.start = ptn.start
     self.end = ptn.end
     self.commands = self.get_enclosed_commands()
     if self.start == 0:
         self.pattern_type += ' 0'