Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: trunk/src/tools/json_schema_compiler/idl_schema.py

Issue 47403003: Revert 231982 "Docserver: Display enum value descriptions in API..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 schema compiler expects to see. 285 schema compiler expects to see.
286 ''' 286 '''
287 def __init__(self, enum_node): 287 def __init__(self, enum_node):
288 self.node = enum_node 288 self.node = enum_node
289 self.description = '' 289 self.description = ''
290 290
291 def process(self, callbacks): 291 def process(self, callbacks):
292 enum = [] 292 enum = []
293 for node in self.node.children: 293 for node in self.node.children:
294 if node.cls == 'EnumItem': 294 if node.cls == 'EnumItem':
295 enum_value = {'name': node.GetName()} 295 enum.append(node.GetName())
296 for child in node.children:
297 if child.cls == 'Comment':
298 enum_value['description'] = ProcessComment(child.GetName())[0]
299 else:
300 raise ValueError('Did not process %s %s' % (child.cls, child))
301 enum.append(enum_value)
302 elif node.cls == 'Comment': 296 elif node.cls == 'Comment':
303 self.description = ProcessComment(node.GetName())[0] 297 self.description = ProcessComment(node.GetName())[0]
304 else: 298 else:
305 sys.exit('Did not process %s %s' % (node.cls, node)) 299 sys.exit('Did not process %s %s' % (node.cls, node))
306 result = {'id' : self.node.GetName(), 300 result = {'id' : self.node.GetName(),
307 'description': self.description, 301 'description': self.description,
308 'type': 'string', 302 'type': 'string',
309 'enum': enum} 303 'enum': enum}
310 for property_name in ('inline_doc', 'noinline_doc', 'nodoc'): 304 for property_name in ('inline_doc', 'noinline_doc', 'nodoc'):
311 if self.node.GetProperty(property_name): 305 if self.node.GetProperty(property_name):
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 Dump a json serialization of parse result for the IDL files whose names 427 Dump a json serialization of parse result for the IDL files whose names
434 were passed in on the command line. 428 were passed in on the command line.
435 ''' 429 '''
436 for filename in sys.argv[1:]: 430 for filename in sys.argv[1:]:
437 schema = Load(filename) 431 schema = Load(filename)
438 print json.dumps(schema, indent=2) 432 print json.dumps(schema, indent=2)
439 433
440 434
441 if __name__ == '__main__': 435 if __name__ == '__main__':
442 Main() 436 Main()
OLDNEW
« no previous file with comments | « trunk/src/tools/json_schema_compiler/cpp_type_generator.py ('k') | trunk/src/tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698