| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 def __visit_all_edges(self, visitor, state): | 149 def __visit_all_edges(self, visitor, state): |
| 150 edge = set([self.__start]) | 150 edge = set([self.__start]) |
| 151 next_edge = lambda node: set(node.transitions().values()) | 151 next_edge = lambda node: set(node.transitions().values()) |
| 152 return self.visit_edges(edge, next_edge, visitor, state) | 152 return self.visit_edges(edge, next_edge, visitor, state) |
| 153 | 153 |
| 154 def to_dot(self): | 154 def to_dot(self): |
| 155 iterator = lambda visitor, state: self.__visit_all_edges(visitor, state) | 155 iterator = lambda visitor, state: self.__visit_all_edges(visitor, state) |
| 156 state_iterator = lambda x : [x] | 156 state_iterator = lambda x : [x] |
| 157 return self.generate_dot(self.__start, self.__terminal_set, iterator, state_
iterator) | 157 return self.generate_dot(self.__start, self.__terminal_set, iterator, state_
iterator) |
| 158 | 158 |
| 159 def minimize(self): |
| 160 pass |
| 161 |
| 159 def to_code(self): | 162 def to_code(self): |
| 160 code = ''' | 163 code = ''' |
| 161 char c = *cursor; | 164 char c = *cursor; |
| 162 goto code_%s; | 165 goto code_%s; |
| 163 ''' % (self.__start.node_number()) | 166 ''' % (self.__start.node_number()) |
| 164 for n in self.__name_map.values(): | 167 for n in self.__name_map.values(): |
| 165 code += n.to_code() | 168 code += n.to_code() |
| 166 return code | 169 return code |
| OLD | NEW |