| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 # | 6 # |
| 7 | 7 |
| 8 """ | 8 """ |
| 9 Frogpad is used to compile .dart files to javascript. | 9 Frogpad is used to compile .dart files to javascript. |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 <script type="text/javascript"> | 89 <script type="text/javascript"> |
| 90 {{FROGPAD_JS}} | 90 {{FROGPAD_JS}} |
| 91 </script> | 91 </script> |
| 92 </body> | 92 </body> |
| 93 </html> | 93 </html> |
| 94 """ | 94 """ |
| 95 | 95 |
| 96 # This finds everything after the word "Output:" in the html page. | 96 # This finds everything after the word "Output:" in the html page. |
| 97 # (Note, because the javascript we're fishing out spans multiple lines | 97 # (Note, because the javascript we're fishing out spans multiple lines |
| 98 # we need to use the DOTALL switch here.) | 98 # we need to use the DOTALL switch here.) |
| 99 OUTPUT_JAVASCRIPT_REGEX = re.compile(".*\nOutput:(.*)#EOF", re.DOTALL) | 99 OUTPUT_JAVASCRIPT_REGEX = re.compile(".*\nOutput:\n(.*)\n#EOF", re.DOTALL) |
| 100 | 100 |
| 101 # If the frogpad.dart encounters a compilation error, the generated | 101 # If the frogpad.dart encounters a compilation error, the generated |
| 102 # javascript will start with the word 'throw'. | 102 # javascript will start with the word 'throw'. |
| 103 COMPILATION_ERROR_REGEX = re.compile(".*frogpad compilation error.*", re.DOTALL) | 103 COMPILATION_ERROR_REGEX = re.compile(".*frogpad compilation error.*", re.DOTALL) |
| 104 | 104 |
| 105 # We use "application/inert" here to make the browser ignore the | 105 # We use "application/inert" here to make the browser ignore the |
| 106 # these script tags. (frogpad.dart will fish out the contents as needed.) | 106 # these script tags. (frogpad.dart will fish out the contents as needed.) |
| 107 # | 107 # |
| 108 SCRIPT_TAG = """<script type="application/inert" id="{{id}}"> | 108 SCRIPT_TAG = """<script type="application/inert" id="{{id}}"> |
| 109 {{contents}} | 109 {{contents}} |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 raise CommandFailedException(msg) | 361 raise CommandFailedException(msg) |
| 362 logging.debug("SUCCEEDED (%d bytes)" % len(stdout)) | 362 logging.debug("SUCCEEDED (%d bytes)" % len(stdout)) |
| 363 return stdout | 363 return stdout |
| 364 | 364 |
| 365 | 365 |
| 366 def main(argv): | 366 def main(argv): |
| 367 Pad(argv) | 367 Pad(argv) |
| 368 | 368 |
| 369 if __name__ == "__main__": | 369 if __name__ == "__main__": |
| 370 sys.exit(main(sys.argv)) | 370 sys.exit(main(sys.argv)) |
| OLD | NEW |