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

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

Issue 12041098: Initial commit of the Dart Chrome Extension APIs generators (Closed) Base URL: http://git.chromium.org/chromium/src.git@file_path_bugfix
Patch Set: Kalman fixes 2 (nocompile ignored in bundle mode) Created 7 years, 10 months 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
« no previous file with comments | « tools/json_schema_compiler/h_generator.py ('k') | tools/json_schema_compiler/json_schema.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Given an IDL dictionary or interface member, converts into a name/value pair 143 Given an IDL dictionary or interface member, converts into a name/value pair
144 where the value is a Python dictionary that the JSON schema compiler expects 144 where the value is a Python dictionary that the JSON schema compiler expects
145 to see. 145 to see.
146 ''' 146 '''
147 def __init__(self, member_node): 147 def __init__(self, member_node):
148 self.node = member_node 148 self.node = member_node
149 149
150 def process(self, callbacks): 150 def process(self, callbacks):
151 properties = OrderedDict() 151 properties = OrderedDict()
152 name = self.node.GetName() 152 name = self.node.GetName()
153 for property_name in ('OPTIONAL', 'nodoc', 'nocompile'): 153 for property_name in ('OPTIONAL', 'nodoc', 'nocompile', 'nodart'):
154 if self.node.GetProperty(property_name): 154 if self.node.GetProperty(property_name):
155 properties[property_name.lower()] = True 155 properties[property_name.lower()] = True
156 is_function = False 156 is_function = False
157 parameter_comments = OrderedDict() 157 parameter_comments = OrderedDict()
158 for node in self.node.children: 158 for node in self.node.children:
159 if node.cls == 'Comment': 159 if node.cls == 'Comment':
160 (parent_comment, parameter_comments) = ProcessComment(node.GetName()) 160 (parent_comment, parameter_comments) = ProcessComment(node.GetName())
161 properties['description'] = parent_comment 161 properties['description'] = parent_comment
162 elif node.cls == 'Callspec': 162 elif node.cls == 'Callspec':
163 is_function = True 163 is_function = True
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 ''' 373 '''
374 Dump a json serialization of parse result for the IDL files whose names 374 Dump a json serialization of parse result for the IDL files whose names
375 were passed in on the command line. 375 were passed in on the command line.
376 ''' 376 '''
377 for filename in sys.argv[1:]: 377 for filename in sys.argv[1:]:
378 schema = Load(filename) 378 schema = Load(filename)
379 print json.dumps(schema, indent=2) 379 print json.dumps(schema, indent=2)
380 380
381 if __name__ == '__main__': 381 if __name__ == '__main__':
382 Main() 382 Main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/h_generator.py ('k') | tools/json_schema_compiler/json_schema.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698