| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 properties['type'] = 'object' | 253 properties['type'] = 'object' |
| 254 if 'additionalProperties' not in properties: | 254 if 'additionalProperties' not in properties: |
| 255 properties['additionalProperties'] = OrderedDict() | 255 properties['additionalProperties'] = OrderedDict() |
| 256 properties['additionalProperties']['type'] = 'any' | 256 properties['additionalProperties']['type'] = 'any' |
| 257 instance_of = self.parent.GetProperty('instanceOf') | 257 instance_of = self.parent.GetProperty('instanceOf') |
| 258 if instance_of: | 258 if instance_of: |
| 259 properties['isInstanceOf'] = instance_of | 259 properties['isInstanceOf'] = instance_of |
| 260 elif self.typeref == 'ArrayBuffer': | 260 elif self.typeref == 'ArrayBuffer': |
| 261 properties['type'] = 'binary' | 261 properties['type'] = 'binary' |
| 262 properties['isInstanceOf'] = 'ArrayBuffer' | 262 properties['isInstanceOf'] = 'ArrayBuffer' |
| 263 elif self.typeref == 'Uint8Array': |
| 264 properties['type'] = 'binary' |
| 265 properties['isInstanceOf'] = 'Uint8Array' |
| 263 elif self.typeref == 'FileEntry': | 266 elif self.typeref == 'FileEntry': |
| 264 properties['type'] = 'object' | 267 properties['type'] = 'object' |
| 265 properties['isInstanceOf'] = 'FileEntry' | 268 properties['isInstanceOf'] = 'FileEntry' |
| 266 if 'additionalProperties' not in properties: | 269 if 'additionalProperties' not in properties: |
| 267 properties['additionalProperties'] = OrderedDict() | 270 properties['additionalProperties'] = OrderedDict() |
| 268 properties['additionalProperties']['type'] = 'any' | 271 properties['additionalProperties']['type'] = 'any' |
| 269 elif self.parent.GetPropertyLocal('Union'): | 272 elif self.parent.GetPropertyLocal('Union'): |
| 270 choices = [] | 273 choices = [] |
| 271 properties['choices'] = [Typeref(node.GetProperty('TYPEREF'), | 274 properties['choices'] = [Typeref(node.GetProperty('TYPEREF'), |
| 272 node, | 275 node, |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 print json.dumps(schema, indent=2) | 478 print json.dumps(schema, indent=2) |
| 476 else: | 479 else: |
| 477 contents = sys.stdin.read() | 480 contents = sys.stdin.read() |
| 478 idl = idl_parser.IDLParser().ParseData(contents, '<stdin>') | 481 idl = idl_parser.IDLParser().ParseData(contents, '<stdin>') |
| 479 schema = IDLSchema(idl).process() | 482 schema = IDLSchema(idl).process() |
| 480 print json.dumps(schema, indent=2) | 483 print json.dumps(schema, indent=2) |
| 481 | 484 |
| 482 | 485 |
| 483 if __name__ == '__main__': | 486 if __name__ == '__main__': |
| 484 Main() | 487 Main() |
| OLD | NEW |