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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 Dump a json serialization of parse result for the IDL files whose names | 470 Dump a json serialization of parse result for the IDL files whose names |
468 were passed in on the command line. | 471 were passed in on the command line. |
469 ''' | 472 ''' |
470 for filename in sys.argv[1:]: | 473 for filename in sys.argv[1:]: |
471 schema = Load(filename) | 474 schema = Load(filename) |
472 print json.dumps(schema, indent=2) | 475 print json.dumps(schema, indent=2) |
473 | 476 |
474 | 477 |
475 if __name__ == '__main__': | 478 if __name__ == '__main__': |
476 Main() | 479 Main() |
OLD | NEW |