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

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

Issue 9491002: json_schema_compiler: any, additionalProperties, functions on types (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add any in arrays to util.h Created 8 years, 9 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 """Server for viewing the compiled C++ code from tools/json_schema_compiler. 6 """Server for viewing the compiled C++ code from tools/json_schema_compiler.
7 """ 7 """
8 8
9 import cc_generator 9 import cc_generator
10 import code 10 import code
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 try: 189 try:
190 # Get main json file 190 # Get main json file
191 with open(json_file_path) as json_file: 191 with open(json_file_path) as json_file:
192 api_defs = json.loads(json_file.read()) 192 api_defs = json.loads(json_file.read())
193 namespace = api_model.AddNamespace(api_defs[0], json_file_path) 193 namespace = api_model.AddNamespace(api_defs[0], json_file_path)
194 if not namespace: 194 if not namespace:
195 body.concat("<pre>Target file %s is marked nocompile</pre>" % 195 body.concat("<pre>Target file %s is marked nocompile</pre>" %
196 json_file_path) 196 json_file_path)
197 return 197 return
198 type_generator = cpp_type_generator.CppTypeGenerator( 198 type_generator = cpp_type_generator.CppTypeGenerator(
199 'preview::api', namespace, cpp_util.Classname(filename).lower()) 199 'preview::api', namespace, namespace.unix_name)
200 200
201 # Get json file depedencies 201 # Get json file depedencies
202 for dependency in api_defs[0].get('dependencies', []): 202 for dependency in api_defs[0].get('dependencies', []):
203 json_file_path = os.path.join(filedir, dependency + '.json') 203 json_file_path = os.path.join(filedir, dependency + '.json')
204 with open(json_file_path) as json_file: 204 with open(json_file_path) as json_file:
205 api_defs = json.loads(json_file.read()) 205 api_defs = json.loads(json_file.read())
206 referenced_namespace = api_model.AddNamespace(api_defs[0], 206 referenced_namespace = api_model.AddNamespace(api_defs[0],
207 json_file_path) 207 json_file_path)
208 if referenced_namespace: 208 if referenced_namespace:
209 type_generator.AddNamespace(referenced_namespace, 209 type_generator.AddNamespace(referenced_namespace,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 print('') 329 print('')
330 server = PreviewHTTPServer(int(opts.port), CompilerHandler, 330 server = PreviewHTTPServer(int(opts.port), CompilerHandler,
331 { 331 {
332 'pygments': pygments_highlighter.PygmentsHighlighter(), 332 'pygments': pygments_highlighter.PygmentsHighlighter(),
333 'hilite': hilite_me_highlighter.HiliteMeHighlighter(), 333 'hilite': hilite_me_highlighter.HiliteMeHighlighter(),
334 'none': none_highlighter.NoneHighlighter(), 334 'none': none_highlighter.NoneHighlighter(),
335 }) 335 })
336 server.serve_forever() 336 server.serve_forever()
337 except KeyboardInterrupt: 337 except KeyboardInterrupt:
338 server.socket.close() 338 server.socket.close()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/model_test.py ('k') | tools/json_schema_compiler/test/additionalProperties.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698