Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: Source/bindings/scripts/utilities.py

Issue 409373002: IDL: Binding code generation for dictionaries (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698