| 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 pprint | 9 import pprint |
| 10 import re | 10 import re |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 properties['type'] = 'object' | 296 properties['type'] = 'object' |
| 297 if 'additionalProperties' not in properties: | 297 if 'additionalProperties' not in properties: |
| 298 properties['additionalProperties'] = OrderedDict() | 298 properties['additionalProperties'] = OrderedDict() |
| 299 properties['additionalProperties']['type'] = 'any' | 299 properties['additionalProperties']['type'] = 'any' |
| 300 instance_of = self.parent.GetProperty('instanceOf') | 300 instance_of = self.parent.GetProperty('instanceOf') |
| 301 if instance_of: | 301 if instance_of: |
| 302 properties['isInstanceOf'] = instance_of | 302 properties['isInstanceOf'] = instance_of |
| 303 elif self.typeref == 'ArrayBuffer': | 303 elif self.typeref == 'ArrayBuffer': |
| 304 properties['type'] = 'binary' | 304 properties['type'] = 'binary' |
| 305 properties['isInstanceOf'] = 'ArrayBuffer' | 305 properties['isInstanceOf'] = 'ArrayBuffer' |
| 306 elif self.typeref == 'FileEntry': | 306 elif self.typeref == 'FileSystemFileEntry': |
| 307 properties['type'] = 'object' | 307 properties['type'] = 'object' |
| 308 properties['isInstanceOf'] = 'FileEntry' | 308 properties['isInstanceOf'] = 'FileSystemFileEntry' |
| 309 if 'additionalProperties' not in properties: | 309 if 'additionalProperties' not in properties: |
| 310 properties['additionalProperties'] = OrderedDict() | 310 properties['additionalProperties'] = OrderedDict() |
| 311 properties['additionalProperties']['type'] = 'any' | 311 properties['additionalProperties']['type'] = 'any' |
| 312 elif self.parent.GetPropertyLocal('Union'): | 312 elif self.parent.GetPropertyLocal('Union'): |
| 313 properties['choices'] = [Typeref(node.GetProperty('TYPEREF'), | 313 properties['choices'] = [Typeref(node.GetProperty('TYPEREF'), |
| 314 node, | 314 node, |
| 315 OrderedDict()).process(callbacks) | 315 OrderedDict()).process(callbacks) |
| 316 for node in self.parent.GetChildren() | 316 for node in self.parent.GetChildren() |
| 317 if node.cls == 'Option'] | 317 if node.cls == 'Option'] |
| 318 elif self.typeref is None: | 318 elif self.typeref is None: |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 print json.dumps(schema, indent=2) | 551 print json.dumps(schema, indent=2) |
| 552 else: | 552 else: |
| 553 contents = sys.stdin.read() | 553 contents = sys.stdin.read() |
| 554 idl = idl_parser.IDLParser().ParseData(contents, '<stdin>') | 554 idl = idl_parser.IDLParser().ParseData(contents, '<stdin>') |
| 555 schema = IDLSchema(idl).process() | 555 schema = IDLSchema(idl).process() |
| 556 print json.dumps(schema, indent=2) | 556 print json.dumps(schema, indent=2) |
| 557 | 557 |
| 558 | 558 |
| 559 if __name__ == '__main__': | 559 if __name__ == '__main__': |
| 560 Main() | 560 Main() |
| OLD | NEW |