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

Unified Diff: mojo/public/bindings/mojo_idl.py

Issue 47543003: Mojo: Add basic IDL parser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A bit more object oriented. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/bindings/generators/__init__.py ('k') | mojo/public/bindings/parser/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/mojo_idl.py
diff --git a/mojo/public/bindings/mojo_idl.py b/mojo/public/bindings/mojo_idl.py
new file mode 100755
index 0000000000000000000000000000000000000000..dd16edda0b46db92083caba9a017fdec22d275f8
--- /dev/null
+++ b/mojo/public/bindings/mojo_idl.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""The frontend for the Mojo bindings system."""
+
+
+import sys
+from optparse import OptionParser
+from parser import mojo_parser
+from parser import mojo_translate
+from generators import mojom_data
+from generators import mojom_cpp_generator
+
+
+def Main():
+ parser = OptionParser(usage="usage: %prog [options] filename1 [filename2...]")
+ parser.add_option("-o", "--outdir", dest="outdir", default=".",
+ help="specify output directory")
+ (options, args) = parser.parse_args()
+
+ if len(args) < 1:
+ parser.print_help()
+ sys.exit(1)
+
+ for filename in args:
+ tree = mojo_parser.Parse(filename)
+ mojom = mojo_translate.Translate(tree)
+ module = mojom_data.ModuleFromData(mojom)
+ cpp = mojom_cpp_generator.CPPGenerator(module)
+ cpp.GenerateFiles(options.outdir)
+
+
+if __name__ == '__main__':
+ Main()
« no previous file with comments | « mojo/public/bindings/generators/__init__.py ('k') | mojo/public/bindings/parser/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698