コード例 #1
0
ファイル: dtm.py プロジェクト: 01majo60/TM11
 def _validate_left_end_direction_R(self, state, paths):
     for symbol in paths.keys():
         if symbol in self.left_end:
             state1, symbol1, direction1 = self.transitions.get(state).get(
                 symbol)
             if symbol1 != self.left_end and direction1 != 'R':
                 raise exceptions.LeftEndError(
                     'Lavá koncová značka {} je prepísaná symbolom {} a má smer prechodu {}'
                     .format(self.left_end, symbol1, direction1))
             elif symbol1 != self.left_end:
                 raise exceptions.LeftEndError(
                     'Lavá koncová značka {} je prepísaná symbolom {}'.
                     format(self.left_end, symbol1))
             elif direction1 != 'R':
                 raise exceptions.LeftEndError(
                     'Lavá koncová značka {} má smer prechodu {}'.format(
                         self.left_end, direction1))
コード例 #2
0
ファイル: xdtm.py プロジェクト: 01majo60/18
    def _validate_left_end_direction_R(self, state, paths):

        for symbols in paths.keys():
            count = 1
            for symbol in symbols:
                if symbol in self.left_end:
                    tran = self.transitions.get(state).get(symbols)
                    length = int((len(tran) - 1) / 2)
                    symbol1 = tran[count]
                    direction1 = tran[count + length]
                    if symbol1 != self.left_end and direction1 == 'L':
                        raise exceptions.LeftEndError(
                            'Lavá koncová značka {} je prepísaná symbolom {} a má smer prechodu {}'
                            .format(self.left_end, symbol1, direction1))
                    elif symbol1 != self.left_end:
                        raise exceptions.LeftEndError(
                            'Lavá koncová značka {} je prepísaná symbolom {}'.
                            format(self.left_end, symbol1))
                    elif direction1 == 'L':
                        raise exceptions.LeftEndError(
                            'Lavá koncová značka {} má smer prechodu {}'.
                            format(self.left_end, direction1))
                count += 1