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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if node.cls == 'EnumItem': | 290 if node.cls == 'EnumItem': |
291 enum.append(node.GetName()) | 291 enum.append(node.GetName()) |
292 elif node.cls == 'Comment': | 292 elif node.cls == 'Comment': |
293 self.description = ProcessComment(node.GetName())[0] | 293 self.description = ProcessComment(node.GetName())[0] |
294 else: | 294 else: |
295 sys.exit('Did not process %s %s' % (node.cls, node)) | 295 sys.exit('Did not process %s %s' % (node.cls, node)) |
296 result = {'id' : self.node.GetName(), | 296 result = {'id' : self.node.GetName(), |
297 'description': self.description, | 297 'description': self.description, |
298 'type': 'string', | 298 'type': 'string', |
299 'enum': enum} | 299 'enum': enum} |
300 for property_name in ('inline_doc', 'nodoc'): | 300 for property_name in ('inline_doc', 'noinline_doc', 'nodoc'): |
301 if self.node.GetProperty(property_name): | 301 if self.node.GetProperty(property_name): |
302 result[property_name] = True | 302 result[property_name] = True |
303 return result | 303 return result |
304 | 304 |
305 | 305 |
306 class Namespace(object): | 306 class Namespace(object): |
307 ''' | 307 ''' |
308 Given an IDLNode representing an IDL namespace, converts into a Python | 308 Given an IDLNode representing an IDL namespace, converts into a Python |
309 dictionary that the JSON schema compiler expects to see. | 309 dictionary that the JSON schema compiler expects to see. |
310 ''' | 310 ''' |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 ''' | 406 ''' |
407 Dump a json serialization of parse result for the IDL files whose names | 407 Dump a json serialization of parse result for the IDL files whose names |
408 were passed in on the command line. | 408 were passed in on the command line. |
409 ''' | 409 ''' |
410 for filename in sys.argv[1:]: | 410 for filename in sys.argv[1:]: |
411 schema = Load(filename) | 411 schema = Load(filename) |
412 print json.dumps(schema, indent=2) | 412 print json.dumps(schema, indent=2) |
413 | 413 |
414 if __name__ == '__main__': | 414 if __name__ == '__main__': |
415 Main() | 415 Main() |
OLD | NEW |