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 json | 6 import json |
7 import os.path | 7 import os.path |
8 import sys | 8 import sys |
9 import re | 9 import re |
10 | 10 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if sibling.cls == 'Array' and sibling.GetName() == self.parent.GetName(): | 154 if sibling.cls == 'Array' and sibling.GetName() == self.parent.GetName(): |
155 properties['type'] = 'array' | 155 properties['type'] = 'array' |
156 properties['items'] = {} | 156 properties['items'] = {} |
157 properties = properties['items'] | 157 properties = properties['items'] |
158 break | 158 break |
159 | 159 |
160 if self.typeref == 'DOMString': | 160 if self.typeref == 'DOMString': |
161 properties['type'] = 'string' | 161 properties['type'] = 'string' |
162 elif self.typeref == 'boolean': | 162 elif self.typeref == 'boolean': |
163 properties['type'] = 'boolean' | 163 properties['type'] = 'boolean' |
| 164 elif self.typeref == 'double': |
| 165 properties['type'] = 'number' |
164 elif self.typeref == 'long': | 166 elif self.typeref == 'long': |
165 properties['type'] = 'integer' | 167 properties['type'] = 'integer' |
166 elif self.typeref == 'any': | 168 elif self.typeref == 'any': |
167 properties['type'] = 'any' | 169 properties['type'] = 'any' |
168 elif self.typeref == 'object': | 170 elif self.typeref == 'object': |
169 properties['type'] = 'object' | 171 properties['type'] = 'object' |
170 if 'additionalProperties' not in properties: | 172 if 'additionalProperties' not in properties: |
171 properties['additionalProperties'] = {} | 173 properties['additionalProperties'] = {} |
172 properties['additionalProperties']['type'] = 'any' | 174 properties['additionalProperties']['type'] = 'any' |
173 instance_of = self.parent.GetProperty('instanceOf') | 175 instance_of = self.parent.GetProperty('instanceOf') |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 ''' | 276 ''' |
275 Dump a json serialization of parse result for the IDL files whose names | 277 Dump a json serialization of parse result for the IDL files whose names |
276 were passed in on the command line. | 278 were passed in on the command line. |
277 ''' | 279 ''' |
278 for filename in sys.argv[1:]: | 280 for filename in sys.argv[1:]: |
279 schema = Load(filename) | 281 schema = Load(filename) |
280 print json.dumps(schema, indent=2) | 282 print json.dumps(schema, indent=2) |
281 | 283 |
282 if __name__ == '__main__': | 284 if __name__ == '__main__': |
283 Main() | 285 Main() |
OLD | NEW |