Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1428)

Side by Side Diff: tools/lexer_generator/automaton.py

Issue 83063002: Experimental lexer generator: unbreak dot output after harmony stuff. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return (isinstance(other, self.__class__) and 73 return (isinstance(other, self.__class__) and
74 self.__entry_action == other.__entry_action and 74 self.__entry_action == other.__entry_action and
75 self.__match_action == other.__match_action) 75 self.__match_action == other.__match_action)
76 76
77 def __str__(self): 77 def __str__(self):
78 parts = [] 78 parts = []
79 for action in [self.__entry_action, self.__match_action]: 79 for action in [self.__entry_action, self.__match_action]:
80 part = "" 80 part = ""
81 if action: 81 if action:
82 part += action[0] 82 part += action[0]
83 if action[1]: 83 if action[1] and isinstance(action[1], str):
84 part += "(%s)" % action[1] 84 part += "(%s)" % action[1]
85 parts.append(part) 85 parts.append(part)
86 return "action< %s >" % " | ".join(parts) 86 return "action< %s >" % " | ".join(parts)
87 87
88 class AutomatonState(object): 88 class AutomatonState(object):
89 89
90 __node_number_counter = 0 90 __node_number_counter = 0
91 91
92 def __init__(self): 92 def __init__(self):
93 self.__node_number = AutomatonState.__node_number_counter 93 self.__node_number = AutomatonState.__node_number_counter
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 node [shape = doublecircle, style=unfilled]; %s 241 node [shape = doublecircle, style=unfilled]; %s
242 node [shape = circle]; 242 node [shape = circle];
243 %s 243 %s
244 %s 244 %s
245 } 245 }
246 ''' % (start_shape, 246 ''' % (start_shape,
247 start_number, 247 start_number,
248 " ".join(terminals), 248 " ".join(terminals),
249 "\n".join(edge_content), 249 "\n".join(edge_content),
250 "\n".join(node_content)) 250 "\n".join(node_content))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698