OLD | NEW |
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 Args: | 341 Args: |
342 macro_filename: Name of the macro file, if any. | 342 macro_filename: Name of the macro file, if any. |
343 | 343 |
344 Returns: | 344 Returns: |
345 A function (string -> string) that processes a source file. | 345 A function (string -> string) that processes a source file. |
346 """ | 346 """ |
347 filter_chain = [] | 347 filter_chain = [] |
348 | 348 |
349 if macro_filename: | 349 if macro_filename: |
350 (consts, macros) = ReadMacros(ReadFile(macro_filename)) | 350 (consts, macros) = ReadMacros(ReadFile(macro_filename)) |
| 351 filter_chain.append(lambda l: ExpandConstants(l, consts)) |
351 filter_chain.append(lambda l: ExpandMacros(l, macros)) | 352 filter_chain.append(lambda l: ExpandMacros(l, macros)) |
352 filter_chain.append(lambda l: ExpandConstants(l, consts)) | |
353 | 353 |
354 if message_template_file: | 354 if message_template_file: |
355 message_templates = ReadMessageTemplates(ReadFile(message_template_file)) | 355 message_templates = ReadMessageTemplates(ReadFile(message_template_file)) |
356 filter_chain.append(lambda l: ExpandConstants(l, message_templates)) | 356 filter_chain.append(lambda l: ExpandConstants(l, message_templates)) |
357 | 357 |
358 filter_chain.extend([ | 358 filter_chain.extend([ |
359 RemoveCommentsAndTrailingWhitespace, | 359 RemoveCommentsAndTrailingWhitespace, |
360 ExpandInlineMacros, | 360 ExpandInlineMacros, |
361 ExpandInlineConstants, | 361 ExpandInlineConstants, |
362 Validate, | 362 Validate, |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 JS2C(args[2:], | 595 JS2C(args[2:], |
596 args[0], | 596 args[0], |
597 args[1], | 597 args[1], |
598 options.raw, | 598 options.raw, |
599 options.startup_blob, | 599 options.startup_blob, |
600 options.js) | 600 options.js) |
601 | 601 |
602 | 602 |
603 if __name__ == "__main__": | 603 if __name__ == "__main__": |
604 main() | 604 main() |
OLD | NEW |