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

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

Issue 66163014: Experimental parser: fix up action_type display (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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 | « tools/lexer_generator/automaton.py ('k') | 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 code += ''' { 85 code += ''' {
86 goto code_%s; 86 goto code_%s;
87 } 87 }
88 ''' % s.node_number() 88 ''' % s.node_number()
89 89
90 if action: 90 if action:
91 if action.type() == 'code': 91 if action.type() == 'code':
92 code += '%s\nBACK();\ngoto code_%s;\n' % (action.data(), 92 code += '%s\nBACK();\ngoto code_%s;\n' % (action.data(),
93 start_node_number) 93 start_node_number)
94 elif action.type() == 'push_token': 94 elif action.type() == 'push_token':
95 #TODO 95 content = 'PUSH_TOKEN(Token::%s);' % action.data()
96 pass 96 code += '%s\nBACK();\ngoto code_%s;\n' % (content,
97 start_node_number)
97 else: 98 else:
98 raise Exception("unknown type %s" % action.type()) 99 raise Exception("unknown type %s" % action.type())
99 else: 100 else:
100 code += 'goto default_action;' 101 code += 'goto default_action;'
101 return code 102 return code
102 103
103 @staticmethod 104 @staticmethod
104 def rule_processor_to_code(rule_processor, use_mdfa): 105 def rule_processor_to_code(rule_processor, use_mdfa):
105 if use_mdfa: 106 if use_mdfa:
106 dfa = rule_processor.default_automata().minimal_dfa() 107 dfa = rule_processor.default_automata().minimal_dfa()
(...skipping 19 matching lines...) Expand all
126 //fprintf(stderr, "default action\\n"); 127 //fprintf(stderr, "default action\\n");
127 %s 128 %s
128 goto code_%s; 129 goto code_%s;
129 return 0; 130 return 0;
130 } 131 }
131 132
132 } 133 }
133 } 134 }
134 ''' % (rule_processor.default_action, start_node_number) 135 ''' % (rule_processor.default_action, start_node_number)
135 return code 136 return code
OLDNEW
« no previous file with comments | « tools/lexer_generator/automaton.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698