| 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 re | 8 import re |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 Given an IDL dictionary or interface member, converts into a name/value pair | 124 Given an IDL dictionary or interface member, converts into a name/value pair |
| 125 where the value is a Python dictionary that the JSON schema compiler expects | 125 where the value is a Python dictionary that the JSON schema compiler expects |
| 126 to see. | 126 to see. |
| 127 ''' | 127 ''' |
| 128 def __init__(self, member_node): | 128 def __init__(self, member_node): |
| 129 self.node = member_node | 129 self.node = member_node |
| 130 | 130 |
| 131 def process(self, callbacks): | 131 def process(self, callbacks): |
| 132 properties = {} | 132 properties = {} |
| 133 name = self.node.GetName() | 133 name = self.node.GetName() |
| 134 if self.node.GetProperty('OPTIONAL'): | 134 for property_name in ('OPTIONAL', 'nodoc', 'nocompile'): |
| 135 properties['optional'] = True | 135 if self.node.GetProperty(property_name): |
| 136 if self.node.GetProperty('nodoc'): | 136 properties[property_name.lower()] = True |
| 137 properties['nodoc'] = True | |
| 138 is_function = False | 137 is_function = False |
| 139 parameter_comments = {} | 138 parameter_comments = {} |
| 140 for node in self.node.children: | 139 for node in self.node.children: |
| 141 if node.cls == 'Comment': | 140 if node.cls == 'Comment': |
| 142 (parent_comment, parameter_comments) = ProcessComment(node.GetName()) | 141 (parent_comment, parameter_comments) = ProcessComment(node.GetName()) |
| 143 properties['description'] = parent_comment | 142 properties['description'] = parent_comment |
| 144 for node in self.node.children: | 143 for node in self.node.children: |
| 145 if node.cls == 'Callspec': | 144 if node.cls == 'Callspec': |
| 146 is_function = True | 145 is_function = True |
| 147 name, parameters = Callspec(node, parameter_comments).process(callbacks) | 146 name, parameters = Callspec(node, parameter_comments).process(callbacks) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 ''' | 304 ''' |
| 306 Dump a json serialization of parse result for the IDL files whose names | 305 Dump a json serialization of parse result for the IDL files whose names |
| 307 were passed in on the command line. | 306 were passed in on the command line. |
| 308 ''' | 307 ''' |
| 309 for filename in sys.argv[1:]: | 308 for filename in sys.argv[1:]: |
| 310 schema = Load(filename) | 309 schema = Load(filename) |
| 311 print json.dumps(schema, indent=2) | 310 print json.dumps(schema, indent=2) |
| 312 | 311 |
| 313 if __name__ == '__main__': | 312 if __name__ == '__main__': |
| 314 Main() | 313 Main() |
| OLD | NEW |