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

Side by Side Diff: tools/js2c.py

Issue 1089303003: Migrate error messages, part 3 (runtime.js). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « test/mjsunit/messages.js ('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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 name = python_match.group(1) 185 name = python_match.group(1)
186 args = [match.strip() for match in python_match.group(2).split(',')] 186 args = [match.strip() for match in python_match.group(2).split(',')]
187 body = python_match.group(3).strip() 187 body = python_match.group(3).strip()
188 fun = eval("lambda " + ",".join(args) + ': ' + body) 188 fun = eval("lambda " + ",".join(args) + ': ' + body)
189 macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun))) 189 macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun)))
190 else: 190 else:
191 raise Error("Illegal line: " + line) 191 raise Error("Illegal line: " + line)
192 return (constants, macros) 192 return (constants, macros)
193 193
194 194
195 TEMPLATE_PATTERN = re.compile(r'^\s+T\(([a-zA-Z]+), ".+"\)') 195 TEMPLATE_PATTERN = re.compile(r'^\s+T\(([A-Z][a-zA-Z]*),')
196 196
197 def ReadMessageTemplates(lines): 197 def ReadMessageTemplates(lines):
198 templates = [] 198 templates = []
199 index = 0 199 index = 0
200 for line in lines.split('\n'): 200 for line in lines.split('\n'):
201 template_match = TEMPLATE_PATTERN.match(line) 201 template_match = TEMPLATE_PATTERN.match(line)
202 if template_match: 202 if template_match:
203 name = "k%s" % template_match.group(1) 203 name = "k%s" % template_match.group(1)
204 value = index 204 value = index
205 index = index + 1 205 index = index + 1
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 out.cc: C code to be generated. 557 out.cc: C code to be generated.
558 type: type parameter for NativesCollection template. 558 type: type parameter for NativesCollection template.
559 sources.js: JS internal sources or macros.py.""") 559 sources.js: JS internal sources or macros.py.""")
560 (options, args) = parser.parse_args() 560 (options, args) = parser.parse_args()
561 561
562 JS2C(args[2:], args[0], args[1], options.raw, options.startup_blob) 562 JS2C(args[2:], args[0], args[1], options.raw, options.startup_blob)
563 563
564 564
565 if __name__ == "__main__": 565 if __name__ == "__main__":
566 main() 566 main()
OLDNEW
« no previous file with comments | « test/mjsunit/messages.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698