| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 from automaton import * | 29 from automaton import * |
| 30 from transition_keys import TransitionKey | 30 from transition_keys import TransitionKey |
| 31 | 31 |
| 32 class DfaState(AutomatonState): | 32 class DfaState(AutomatonState): |
| 33 | 33 |
| 34 def __init__(self, name, action): | 34 def __init__(self, name, action): |
| 35 super(DfaState, self).__init__() | 35 super(DfaState, self).__init__() |
| 36 self.__name = name | 36 self.__name = name |
| 37 self.__transitions = {} | 37 self.__transitions = {} |
| 38 self.__action = action | 38 self.__action = action |
| 39 assert isinstance(action, Action) |
| 39 | 40 |
| 40 def transitions_to_multiple_states(self): | 41 def transitions_to_multiple_states(self): |
| 41 return False | 42 return False |
| 42 | 43 |
| 43 def name(self): | 44 def name(self): |
| 44 return self.__name | 45 return self.__name |
| 45 | 46 |
| 46 def action(self): | 47 def action(self): |
| 47 return self.__action | 48 return self.__action |
| 48 | 49 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 elif len(intersection) <= len(difference): | 388 elif len(intersection) <= len(difference): |
| 388 working_set.add(intersection) | 389 working_set.add(intersection) |
| 389 else: | 390 else: |
| 390 working_set.add(difference) | 391 working_set.add(difference) |
| 391 if old_partitions: | 392 if old_partitions: |
| 392 partitions -= old_partitions | 393 partitions -= old_partitions |
| 393 if new_partitions: | 394 if new_partitions: |
| 394 partitions |= new_partitions | 395 partitions |= new_partitions |
| 395 (start_name, mapping) = self.__create_states_from_partitions(partitions) | 396 (start_name, mapping) = self.__create_states_from_partitions(partitions) |
| 396 return Dfa(self.__dfa.encoding(), start_name, mapping) | 397 return Dfa(self.__dfa.encoding(), start_name, mapping) |
| OLD | NEW |