OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Utility functions (file reading, simple IDL parsing by regexes) for IDL build
. | 5 """Utility functions (file reading, simple IDL parsing by regexes) for IDL build
. |
6 | 6 |
7 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 7 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return ( | 112 return ( |
113 [left for left, right in implements_pairs if right == interface_name], | 113 [left for left, right in implements_pairs if right == interface_name], |
114 [right for left, right in implements_pairs if left == interface_name]) | 114 [right for left, right in implements_pairs if left == interface_name]) |
115 | 115 |
116 | 116 |
117 def is_callback_interface_from_idl(file_contents): | 117 def is_callback_interface_from_idl(file_contents): |
118 match = re.search(r'callback\s+interface\s+\w+\s*{', file_contents) | 118 match = re.search(r'callback\s+interface\s+\w+\s*{', file_contents) |
119 return bool(match) | 119 return bool(match) |
120 | 120 |
121 | 121 |
| 122 def is_dictionary_from_idl(file_contents): |
| 123 match = re.search(r'dictionary\s+\w+\s*{', file_contents) |
| 124 return bool(match) |
| 125 |
| 126 |
122 def get_parent_interface(file_contents): | 127 def get_parent_interface(file_contents): |
123 match = re.search(r'interface\s+' | 128 match = re.search(r'interface\s+' |
124 r'\w+\s*' | 129 r'\w+\s*' |
125 r':\s*(\w+)\s*' | 130 r':\s*(\w+)\s*' |
126 r'{', | 131 r'{', |
127 file_contents) | 132 file_contents) |
128 return match and match.group(1) | 133 return match and match.group(1) |
129 | 134 |
130 | 135 |
131 def get_interface_extended_attributes_from_idl(file_contents): | 136 def get_interface_extended_attributes_from_idl(file_contents): |
(...skipping 30 matching lines...) Expand all Loading... |
162 | 167 |
163 def get_put_forward_interfaces_from_idl(file_contents): | 168 def get_put_forward_interfaces_from_idl(file_contents): |
164 put_forwards_pattern = (r'\[[^\]]*PutForwards=[^\]]*\]\s+' | 169 put_forwards_pattern = (r'\[[^\]]*PutForwards=[^\]]*\]\s+' |
165 r'readonly\s+' | 170 r'readonly\s+' |
166 r'attribute\s+' | 171 r'attribute\s+' |
167 r'(\w+)') | 172 r'(\w+)') |
168 return sorted(set(match.group(1) | 173 return sorted(set(match.group(1) |
169 for match in re.finditer(put_forwards_pattern, | 174 for match in re.finditer(put_forwards_pattern, |
170 file_contents, | 175 file_contents, |
171 flags=re.DOTALL))) | 176 flags=re.DOTALL))) |
OLD | NEW |