| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 raise ValueError('Did not process %s %s' % (child.cls, child)) | 300 raise ValueError('Did not process %s %s' % (child.cls, child)) |
| 301 enum.append(enum_value) | 301 enum.append(enum_value) |
| 302 elif node.cls == 'Comment': | 302 elif node.cls == 'Comment': |
| 303 self.description = ProcessComment(node.GetName())[0] | 303 self.description = ProcessComment(node.GetName())[0] |
| 304 else: | 304 else: |
| 305 sys.exit('Did not process %s %s' % (node.cls, node)) | 305 sys.exit('Did not process %s %s' % (node.cls, node)) |
| 306 result = {'id' : self.node.GetName(), | 306 result = {'id' : self.node.GetName(), |
| 307 'description': self.description, | 307 'description': self.description, |
| 308 'type': 'string', | 308 'type': 'string', |
| 309 'enum': enum} | 309 'enum': enum} |
| 310 for property_name in ('inline_doc', 'noinline_doc', 'nodoc'): | 310 for property_name in ( |
| 311 'inline_doc', 'noinline_doc', 'nodoc', 'cpp_omit_enum_type',): |
| 311 if self.node.GetProperty(property_name): | 312 if self.node.GetProperty(property_name): |
| 312 result[property_name] = True | 313 result[property_name] = True |
| 313 return result | 314 return result |
| 314 | 315 |
| 315 | 316 |
| 316 class Namespace(object): | 317 class Namespace(object): |
| 317 ''' | 318 ''' |
| 318 Given an IDLNode representing an IDL namespace, converts into a Python | 319 Given an IDLNode representing an IDL namespace, converts into a Python |
| 319 dictionary that the JSON schema compiler expects to see. | 320 dictionary that the JSON schema compiler expects to see. |
| 320 ''' | 321 ''' |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 Dump a json serialization of parse result for the IDL files whose names | 447 Dump a json serialization of parse result for the IDL files whose names |
| 447 were passed in on the command line. | 448 were passed in on the command line. |
| 448 ''' | 449 ''' |
| 449 for filename in sys.argv[1:]: | 450 for filename in sys.argv[1:]: |
| 450 schema = Load(filename) | 451 schema = Load(filename) |
| 451 print json.dumps(schema, indent=2) | 452 print json.dumps(schema, indent=2) |
| 452 | 453 |
| 453 | 454 |
| 454 if __name__ == '__main__': | 455 if __name__ == '__main__': |
| 455 Main() | 456 Main() |
| OLD | NEW |