Changeset 114090 in webkit
- Timestamp:
- Apr 12, 2012 11:33:14 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r114088 r114090 1 2012-04-12 Kent Tamura <tkent@chromium.org> 2 3 Calendar Picker: remove unnecessary code from calendarPicker.{css,js} 4 https://bugs.webkit.org/show_bug.cgi?id=83685 5 6 Reviewed by Kentaro Hara. 7 8 Remove the followings from input files: 9 - multi line comments /*...*/ (.js and .css) 10 - single line comment //... (.js) 11 - repeating whitespace (.js and .css) 12 - leading and trailing whitespace (.js and .css) 13 - empty lines (.js and .css) 14 15 This doesn't work for arbitrary JavaScript or CSS inputs, but 16 works well for expected input files like 17 css/make-css-file-arrays.pl 18 19 * make-file-arrays.py: 20 (strip_whitespace_and_comments): 21 (main): 22 1 23 2012-04-12 Sailesh Agrawal <sail@chromium.org> 2 24 -
trunk/Source/WebCore/make-file-arrays.py
r113838 r114090 48 48 49 49 50 def strip_whitespace_and_comments(file_name, content): 51 result = re.match(r".*\.([^.]+)", file_name) 52 if not result: 53 print "The file name has no extension:", file_name 54 sys.exit(1) 55 extension = result.group(1).lower() 56 multi_line_comment = re.compile(r"/\*.*?\*/", re.MULTILINE | re.DOTALL) 57 single_line_comment = re.compile(r"//.*$", re.MULTILINE) 58 repeating_space = re.compile(r"[ \t]+", re.MULTILINE) 59 leading_space = re.compile(r"^[ \t]+", re.MULTILINE) 60 trailing_space = re.compile(r"[ \t]+$", re.MULTILINE) 61 empty_line = re.compile(r"\n+") 62 if extension == "js": 63 content = multi_line_comment.sub("", content) 64 content = single_line_comment.sub("", content) 65 content = repeating_space.sub(" ", content) 66 content = leading_space.sub("", content) 67 content = trailing_space.sub("", content) 68 content = empty_line.sub("\n", content) 69 elif extension == "css": 70 content = multi_line_comment.sub("", content) 71 content = repeating_space.sub(" ", content) 72 content = leading_space.sub("", content) 73 content = trailing_space.sub("", content) 74 content = empty_line.sub("\n", content) 75 return content 76 77 50 78 def main(): 51 79 parser = OptionParser() … … 75 103 for file_name in args: 76 104 (variable_name, content) = make_variable_name_and_read(file_name) 105 content = strip_whitespace_and_comments(file_name, content) 77 106 size = len(content) 78 107 header_file.write("extern const char %s[%d];\n" % (variable_name, size))
Note: See TracChangeset
for help on using the changeset viewer.