Index: tools/metrics/histograms/update_use_counter_css.py |
diff --git a/tools/metrics/histograms/update_use_counter_css.py b/tools/metrics/histograms/update_use_counter_css.py |
index a598439007d2cc7aac7df5c1414afb61afa1f5c7..a4dd2865eddb93de066c3bdca4c3928d8d4e920d 100755 |
--- a/tools/metrics/histograms/update_use_counter_css.py |
+++ b/tools/metrics/histograms/update_use_counter_css.py |
@@ -36,19 +36,23 @@ def ReadCssProperties(filename): |
with open(path_util.GetInputFile(filename)) as f: |
content = f.readlines() |
- # Looking for a line like "case CSSPropertyGrid: return 453;". |
+ # Looking for a pair of lines like "case CSSPropertyGrid:\n return 453;". |
ENUM_REGEX = re.compile(r"""CSSProperty(.*): # capture the enum name |
\s*return\s* |
([0-9]+) # capture the id |
""", re.VERBOSE) |
properties = {} |
+ previous_line = '' |
for line in content: |
- enum_match = ENUM_REGEX.search(line) |
+ enum_match = ENUM_REGEX.search(previous_line + '\n' + line) |
if enum_match: |
enum_name = enum_match.group(1) |
property_id = int(enum_match.group(2)) |
properties[property_id] = EnumToCssProperty(enum_name) |
+ previous_line = '' |
+ else: |
+ previous_line = line |
Ilya Sherman
2016/12/08 04:52:33
Hmm, odd. Did the structure of the file recently
Eric Willigers
2016/12/08 05:03:56
clang-format was run across Blink on Sep 30:
1c8e1
Ilya Sherman
2016/12/08 05:04:33
Okay, that makes sense. Thanks!
|
return properties |