| OLD | NEW |
| 1 # Copyright 2014 the V8 project authors. All rights reserved. | 1 # Copyright 2014 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 def f(node, (node_content, edge_content)): | 75 def f(node, (node_content, edge_content)): |
| 76 if node.action(): | 76 if node.action(): |
| 77 action_text = escape_for_dot(node.action()) | 77 action_text = escape_for_dot(node.action()) |
| 78 node_content.append(' S_l%s[shape = box, label="%s"];' % | 78 node_content.append(' S_l%s[shape = box, label="%s"];' % |
| 79 (node.node_number(), action_text)) | 79 (node.node_number(), action_text)) |
| 80 node_content.append(' S_%s -> S_l%s [arrowhead = none];' % | 80 node_content.append(' S_%s -> S_l%s [arrowhead = none];' % |
| 81 (node.node_number(), node.node_number())) | 81 (node.node_number(), node.node_number())) |
| 82 for key, state in node.key_state_iter(): | 82 for key, state in node.key_state_iter(): |
| 83 if key == TransitionKey.epsilon(): | 83 if key == TransitionKey.epsilon(): |
| 84 key = "ε" | 84 key = "ε" |
| 85 elif key == TransitionKey.omega(): |
| 86 key = "ω" |
| 85 else: | 87 else: |
| 86 key = key.to_string(automaton.encoding()) | 88 key = key.to_string(automaton.encoding()) |
| 87 edge_content.append(" S_%s -> S_%s [ label = \"%s\" ];" % ( | 89 edge_content.append(" S_%s -> S_%s [ label = \"%s\" ];" % ( |
| 88 node.node_number(), state.node_number(), escape_for_dot(key))) | 90 node.node_number(), state.node_number(), escape_for_dot(key))) |
| 89 return (node_content, edge_content) | 91 return (node_content, edge_content) |
| 90 | 92 |
| 91 (node_content, edge_content) = automaton.visit_all_states(f, ([], [])) | 93 (node_content, edge_content) = automaton.visit_all_states(f, ([], [])) |
| 92 | 94 |
| 93 start_set = automaton.start_set() | 95 start_set = automaton.start_set() |
| 94 assert len(start_set) == 1 | 96 assert len(start_set) == 1 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 108 node [shape = doublecircle, style=unfilled]; %s | 110 node [shape = doublecircle, style=unfilled]; %s |
| 109 node [shape = circle]; | 111 node [shape = circle]; |
| 110 %s | 112 %s |
| 111 %s | 113 %s |
| 112 } | 114 } |
| 113 ''' % (start_shape, | 115 ''' % (start_shape, |
| 114 start_number, | 116 start_number, |
| 115 " ".join(terminals), | 117 " ".join(terminals), |
| 116 "\n".join(edge_content), | 118 "\n".join(edge_content), |
| 117 "\n".join(node_content)) | 119 "\n".join(node_content)) |
| OLD | NEW |