| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 ''' | 216 ''' |
| 217 def __init__(self, typeref, parent, additional_properties=OrderedDict()): | 217 def __init__(self, typeref, parent, additional_properties=OrderedDict()): |
| 218 self.typeref = typeref | 218 self.typeref = typeref |
| 219 self.parent = parent | 219 self.parent = parent |
| 220 self.additional_properties = additional_properties | 220 self.additional_properties = additional_properties |
| 221 | 221 |
| 222 def process(self, callbacks): | 222 def process(self, callbacks): |
| 223 properties = self.additional_properties | 223 properties = self.additional_properties |
| 224 result = properties | 224 result = properties |
| 225 | 225 |
| 226 if self.parent.GetProperty('OPTIONAL', False): | 226 if self.parent.GetProperty('OPTIONAL'): |
| 227 properties['optional'] = True | 227 properties['optional'] = True |
| 228 | 228 |
| 229 # The IDL parser denotes array types by adding a child 'Array' node onto | 229 # The IDL parser denotes array types by adding a child 'Array' node onto |
| 230 # the Param node in the Callspec. | 230 # the Param node in the Callspec. |
| 231 for sibling in self.parent.GetChildren(): | 231 for sibling in self.parent.GetChildren(): |
| 232 if sibling.cls == 'Array' and sibling.GetName() == self.parent.GetName(): | 232 if sibling.cls == 'Array' and sibling.GetName() == self.parent.GetName(): |
| 233 properties['type'] = 'array' | 233 properties['type'] = 'array' |
| 234 properties['items'] = OrderedDict() | 234 properties['items'] = OrderedDict() |
| 235 properties = properties['items'] | 235 properties = properties['items'] |
| 236 break | 236 break |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 Dump a json serialization of parse result for the IDL files whose names | 446 Dump a json serialization of parse result for the IDL files whose names |
| 447 were passed in on the command line. | 447 were passed in on the command line. |
| 448 ''' | 448 ''' |
| 449 for filename in sys.argv[1:]: | 449 for filename in sys.argv[1:]: |
| 450 schema = Load(filename) | 450 schema = Load(filename) |
| 451 print json.dumps(schema, indent=2) | 451 print json.dumps(schema, indent=2) |
| 452 | 452 |
| 453 | 453 |
| 454 if __name__ == '__main__': | 454 if __name__ == '__main__': |
| 455 Main() | 455 Main() |
| OLD | NEW |