OLD | NEW |
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #!/usr/bin/env python | 5 #!/usr/bin/env python |
6 # | 6 # |
7 | 7 |
8 """Rewrites HTML files, converting Dart script sections into JavaScript. | 8 """Rewrites HTML files, converting Dart script sections into JavaScript. |
9 | 9 |
10 Process HTML files, and internally changes script sections that use Dart code | 10 Process HTML files, and internally changes script sections that use Dart code |
(...skipping 11 matching lines...) Expand all Loading... |
22 TOOLS_PATH = join(DART_PATH, 'tools') | 22 TOOLS_PATH = join(DART_PATH, 'tools') |
23 | 23 |
24 sys.path.append(TOOLS_PATH) | 24 sys.path.append(TOOLS_PATH) |
25 import utils | 25 import utils |
26 | 26 |
27 DART_MIME_TYPE = "application/dart" | 27 DART_MIME_TYPE = "application/dart" |
28 LIBRARY_PATTERN = "^#library\(.*\);" | 28 LIBRARY_PATTERN = "^#library\(.*\);" |
29 IMPORT_SOURCE_MATCHER = re.compile( | 29 IMPORT_SOURCE_MATCHER = re.compile( |
30 r"^ *(#import|#source)(\(['\"])([^'\"]*)(.*\);)", re.MULTILINE) | 30 r"^ *(#import|#source)(\(['\"])([^'\"]*)(.*\);)", re.MULTILINE) |
31 DOM_IMPORT_MATCHER = re.compile( | 31 DOM_IMPORT_MATCHER = re.compile( |
32 r"^#import\(['\"]dart\:dom['\"].*\);", re.MULTILINE) | 32 r"^#import\(['\"]dart\:dom_deprecated['\"].*\);", re.MULTILINE) |
33 HTML_IMPORT_MATCHER = re.compile( | 33 HTML_IMPORT_MATCHER = re.compile( |
34 r"^#import\(['\"]dart\:html['\"].*\);", re.MULTILINE) | 34 r"^#import\(['\"]dart\:html['\"].*\);", re.MULTILINE) |
35 | 35 |
36 FROG_NOT_FOUND_ERROR = ( | 36 FROG_NOT_FOUND_ERROR = ( |
37 """Couldn't find compiler: please run the following commands: | 37 """Couldn't find compiler: please run the following commands: |
38 $ cd %s/frog | 38 $ cd %s/frog |
39 $ ./tools/build.py -m release""") | 39 $ ./tools/build.py -m release""") |
40 | 40 |
41 ENTRY_POINT = """ | 41 ENTRY_POINT = """ |
42 #library('entry'); | 42 #library('entry'); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 if 'dartium' in options.target: | 549 if 'dartium' in options.target: |
550 convertForDartium(filename, options.out, | 550 convertForDartium(filename, options.out, |
551 outfile.replace(extension, '-dart' + extension), options.verbose) | 551 outfile.replace(extension, '-dart' + extension), options.verbose) |
552 except Exception as e: | 552 except Exception as e: |
553 print "%sERROR%s: %s" % (RED_COLOR, NO_COLOR, str(e)) | 553 print "%sERROR%s: %s" % (RED_COLOR, NO_COLOR, str(e)) |
554 return 1 | 554 return 1 |
555 return 0 | 555 return 0 |
556 | 556 |
557 if __name__ == '__main__': | 557 if __name__ == '__main__': |
558 sys.exit(main()) | 558 sys.exit(main()) |
OLD | NEW |