| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 def f(node, (node_content, edge_content)): | 210 def f(node, (node_content, edge_content)): |
| 211 if node.action(): | 211 if node.action(): |
| 212 action_text = escape(node.action()) | 212 action_text = escape(node.action()) |
| 213 node_content.append(' S_l%s[shape = box, label="%s"];' % | 213 node_content.append(' S_l%s[shape = box, label="%s"];' % |
| 214 (node.node_number(), action_text)) | 214 (node.node_number(), action_text)) |
| 215 node_content.append(' S_%s -> S_l%s [arrowhead = none];' % | 215 node_content.append(' S_%s -> S_l%s [arrowhead = none];' % |
| 216 (node.node_number(), node.node_number())) | 216 (node.node_number(), node.node_number())) |
| 217 for key, state in node.key_state_iter(): | 217 for key, state in node.key_state_iter(): |
| 218 if key == TransitionKey.epsilon(): | 218 if key == TransitionKey.epsilon(): |
| 219 key = "ε" | 219 key = "ε" |
| 220 else: |
| 221 key = key.to_string(self.encoding()) |
| 220 edge_content.append(" S_%s -> S_%s [ label = \"%s\" ];" % ( | 222 edge_content.append(" S_%s -> S_%s [ label = \"%s\" ];" % ( |
| 221 node.node_number(), state.node_number(), escape(key))) | 223 node.node_number(), state.node_number(), escape(key))) |
| 222 return (node_content, edge_content) | 224 return (node_content, edge_content) |
| 223 | 225 |
| 224 (node_content, edge_content) = self.visit_all_states(f, ([], [])) | 226 (node_content, edge_content) = self.visit_all_states(f, ([], [])) |
| 225 | 227 |
| 226 start_set = self.start_set() | 228 start_set = self.start_set() |
| 227 assert len(start_set) == 1 | 229 assert len(start_set) == 1 |
| 228 start_node = iter(start_set).next() | 230 start_node = iter(start_set).next() |
| 229 terminal_set = self.terminal_set() | 231 terminal_set = self.terminal_set() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 241 node [shape = doublecircle, style=unfilled]; %s | 243 node [shape = doublecircle, style=unfilled]; %s |
| 242 node [shape = circle]; | 244 node [shape = circle]; |
| 243 %s | 245 %s |
| 244 %s | 246 %s |
| 245 } | 247 } |
| 246 ''' % (start_shape, | 248 ''' % (start_shape, |
| 247 start_number, | 249 start_number, |
| 248 " ".join(terminals), | 250 " ".join(terminals), |
| 249 "\n".join(edge_content), | 251 "\n".join(edge_content), |
| 250 "\n".join(node_content)) | 252 "\n".join(node_content)) |
| OLD | NEW |