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

Side by Side Diff: Source/bindings/scripts/idl_reader.py

Issue 18190004: Add Python flow to bindings generation, move dummy-generating IDL files over (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revision 4 (IdlDocument -> IdlDefinitions) Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 """Read an IDL file or complete IDL interface, producing an IdlDefinitions objec t.
30
31 FIXME: Currently a stub, as part of landing the parser incrementally.
32 Just create dummy IdlDefinitions objects (no parsing or object building done),
33 and resolve dependencies.
34 The interface reader should always return None, indicating that bindings should
35 not be generated, since the code generator has also not landed yet.
36 """
37
38 import os.path
39
40 import interface_dependency_resolver
41
42
43 class IdlDefinitions():
haraken 2013/07/10 07:13:46 Your comment makes sense. IdlDefinitions sounds be
44 """Top-level IDL class.
45
46 In Web IDL spec terms, represents a set of definitions, obtained by parsing
47 a set of IDL fragments (i.e., the contents of .idl files).
48 See: http://www.w3.org/TR/WebIDL/#idl
49 """
50 # FIXME: Dummy class; full class hierarchy will be added with parser
51 pass
52
53
54 def read_idl_interface(idl_filename, interface_dependencies_filename, additional _idl_filenames):
haraken 2013/07/10 07:13:46 You might want to rename it to read_idl_definition
Nils Barth (inactive) 2013/07/10 07:35:36 Good point, done.
55 """Returns an IdlDefinitions object for an IDL interface, including all depe ndencies."""
haraken 2013/07/10 07:13:46 for an IDL interface => for a given IDL file As I
Nils Barth (inactive) 2013/07/10 07:35:36 Done.
56 basename = os.path.basename(idl_filename)
57
58 idl_definitions = read_idl_file(idl_filename)
59 should_generate_bindings = interface_dependency_resolver.merge_interface_dep endencies(idl_definitions, idl_filename, interface_dependencies_filename, additi onal_idl_filenames)
60 if not should_generate_bindings:
61 return None
62 # FIXME: turn on validator
63 # idl_validator.validate_extended_attributes(idl_definitions, basename, opti ons.idl_attributes_file)
64 return idl_definitions
65
66
67 def read_idl_file(idl_filename, verbose=False):
68 """Returns an IdlDefinitions object for an IDL file, without any dependencie s."""
69 # FIXME: Currently returns dummy object, as parser not present yet.
70 # parser = BlinkIDLParser(verbose=verbose)
71 # file_node = blink_idl_parser.parse_file(parser, idl_filename)
72 # return idl_object_builder.file_node_to_idl_definitions(file_node)
73 return IdlDefinitions()
OLDNEW
« no previous file with comments | « Source/bindings/scripts/idl_compiler.py ('k') | Source/bindings/scripts/interface_dependency_resolver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698