Exemplo n.º 1
0
 def _get_re(self, patt, mtype=EXACT, callback=None):
     try:
         return self._patt_cache[patt]
     except KeyError:
         if mtype == EXACT:
             self._patt_cache[patt] = p = (compile_exact(patt), callback)
             return p
         elif mtype == GLOB:
             self._patt_cache[patt] = p = (re.compile(glob_translate(patt)), callback)
             return p
         elif mtype == REGEX:
             self._patt_cache[patt] = p = (re.compile(patt), callback)
             return p
Exemplo n.º 2
0
 def _get_re(self, patt, mtype=EXACT, callback=None):
     try:
         return self._patt_cache[patt]
     except KeyError:
         if mtype == EXACT:
             self._patt_cache[patt] = p = (compile_exact(patt), callback)
             return p
         elif mtype == GLOB:
             self._patt_cache[patt] = p = (re.compile(glob_translate(patt)),
                                           callback)
             return p
         elif mtype == REGEX:
             self._patt_cache[patt] = p = (re.compile(patt), callback)
             return p
Exemplo n.º 3
0
 def add_exact(self, symbol, state, action, next_state):
     cre = compile_exact(symbol)
     self._exact_transitions[(symbol, state)] = (cre, action, next_state)
Exemplo n.º 4
0
 def add_exact(self, symbol, state, action, next_state):
     cre = compile_exact(symbol)
     self._exact_transitions[(symbol, state)] = (cre, action, next_state)