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()
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()
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()
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'