OLD | NEW |
1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import itertools | 6 import itertools |
7 import json | 7 import json |
8 import os.path | 8 import os.path |
9 import re | 9 import re |
10 import sys | 10 import sys |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 to see. | 163 to see. |
164 ''' | 164 ''' |
165 def __init__(self, member_node): | 165 def __init__(self, member_node): |
166 self.node = member_node | 166 self.node = member_node |
167 | 167 |
168 def process(self, callbacks): | 168 def process(self, callbacks): |
169 properties = OrderedDict() | 169 properties = OrderedDict() |
170 name = self.node.GetName() | 170 name = self.node.GetName() |
171 if self.node.GetProperty('deprecated'): | 171 if self.node.GetProperty('deprecated'): |
172 properties['deprecated'] = self.node.GetProperty('deprecated') | 172 properties['deprecated'] = self.node.GetProperty('deprecated') |
| 173 if self.node.GetProperty('allowAmbiguousOptionalArguments'): |
| 174 properties['allowAmbiguousOptionalArguments'] = True |
173 for property_name in ('OPTIONAL', 'nodoc', 'nocompile', 'nodart'): | 175 for property_name in ('OPTIONAL', 'nodoc', 'nocompile', 'nodart'): |
174 if self.node.GetProperty(property_name): | 176 if self.node.GetProperty(property_name): |
175 properties[property_name.lower()] = True | 177 properties[property_name.lower()] = True |
176 for option_name, sanitizer in [ | 178 for option_name, sanitizer in [ |
177 ('maxListeners', int), | 179 ('maxListeners', int), |
178 ('supportsFilters', lambda s: s == 'true'), | 180 ('supportsFilters', lambda s: s == 'true'), |
179 ('supportsListeners', lambda s: s == 'true'), | 181 ('supportsListeners', lambda s: s == 'true'), |
180 ('supportsRules', lambda s: s == 'true')]: | 182 ('supportsRules', lambda s: s == 'true')]: |
181 if self.node.GetProperty(option_name): | 183 if self.node.GetProperty(option_name): |
182 if 'options' not in properties: | 184 if 'options' not in properties: |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 print json.dumps(schema, indent=2) | 477 print json.dumps(schema, indent=2) |
476 else: | 478 else: |
477 contents = sys.stdin.read() | 479 contents = sys.stdin.read() |
478 idl = idl_parser.IDLParser().ParseData(contents, '<stdin>') | 480 idl = idl_parser.IDLParser().ParseData(contents, '<stdin>') |
479 schema = IDLSchema(idl).process() | 481 schema = IDLSchema(idl).process() |
480 print json.dumps(schema, indent=2) | 482 print json.dumps(schema, indent=2) |
481 | 483 |
482 | 484 |
483 if __name__ == '__main__': | 485 if __name__ == '__main__': |
484 Main() | 486 Main() |
OLD | NEW |