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

Side by Side Diff: tools/js2c.py

Issue 1106633002: Wrap messages implementation in a function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@messages_5
Patch Set: fix and rebase Created 5 years, 7 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/cctest/test-parsing.cc ('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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 file = open(filename, "rt") 62 file = open(filename, "rt")
63 try: 63 try:
64 lines = file.read() 64 lines = file.read()
65 finally: 65 finally:
66 file.close() 66 file.close()
67 return lines 67 return lines
68 68
69 69
70 EVAL_PATTERN = re.compile(r'\beval\s*\(') 70 EVAL_PATTERN = re.compile(r'\beval\s*\(')
71 WITH_PATTERN = re.compile(r'\bwith\s*\(') 71 WITH_PATTERN = re.compile(r'\bwith\s*\(')
72 INVALID_ERROR_MESSAGE_PATTERN = re.compile(r'Make\w*Error\(([kA-Z]\w+)') 72 INVALID_ERROR_MESSAGE_PATTERN = re.compile(
73 NEW_ERROR_PATTERN = re.compile(r'new \$\w*Error\((?!\))'); 73 r'Make(?!Generic)\w*Error\(([kA-Z]\w+)')
74 NEW_ERROR_PATTERN = re.compile(r'new \$\w*Error\((?!\))')
74 75
75 def Validate(lines): 76 def Validate(lines):
76 # Because of simplified context setup, eval and with is not 77 # Because of simplified context setup, eval and with is not
77 # allowed in the natives files. 78 # allowed in the natives files.
78 if EVAL_PATTERN.search(lines): 79 if EVAL_PATTERN.search(lines):
79 raise Error("Eval disallowed in natives.") 80 raise Error("Eval disallowed in natives.")
80 if WITH_PATTERN.search(lines): 81 if WITH_PATTERN.search(lines):
81 raise Error("With statements disallowed in natives.") 82 raise Error("With statements disallowed in natives.")
82 invalid_error = INVALID_ERROR_MESSAGE_PATTERN.search(lines) 83 invalid_error = INVALID_ERROR_MESSAGE_PATTERN.search(lines)
83 if invalid_error: 84 if invalid_error:
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 out.cc: C code to be generated. 561 out.cc: C code to be generated.
561 type: type parameter for NativesCollection template. 562 type: type parameter for NativesCollection template.
562 sources.js: JS internal sources or macros.py.""") 563 sources.js: JS internal sources or macros.py.""")
563 (options, args) = parser.parse_args() 564 (options, args) = parser.parse_args()
564 565
565 JS2C(args[2:], args[0], args[1], options.raw, options.startup_blob) 566 JS2C(args[2:], args[0], args[1], options.raw, options.startup_blob)
566 567
567 568
568 if __name__ == "__main__": 569 if __name__ == "__main__":
569 main() 570 main()
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698