OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 'No definition found in %s' % idl_filename) | 68 'No definition found in %s' % idl_filename) |
69 return | 69 return |
70 target = targets[0] | 70 target = targets[0] |
71 if not target.is_partial and target.name != idl_file_basename: | 71 if not target.is_partial and target.name != idl_file_basename: |
72 raise Exception( | 72 raise Exception( |
73 'Definition name "{0}" disagrees with IDL file basename "{1}".' | 73 'Definition name "{0}" disagrees with IDL file basename "{1}".' |
74 .format(target.name, idl_file_basename)) | 74 .format(target.name, idl_file_basename)) |
75 | 75 |
76 | 76 |
77 class IdlReader(object): | 77 class IdlReader(object): |
| 78 # FIXMEDART: Added multi_interface argument and property for IdlReader class
. |
78 def __init__(self, interfaces_info=None, outputdir='', multi_interface=False
): | 79 def __init__(self, interfaces_info=None, outputdir='', multi_interface=False
): |
79 self.multi_interface = multi_interface | 80 self.multi_interface = multi_interface |
80 self.extended_attribute_validator = IDLExtendedAttributeValidator() | 81 self.extended_attribute_validator = IDLExtendedAttributeValidator() |
81 self.interfaces_info = interfaces_info | 82 self.interfaces_info = interfaces_info |
82 | 83 |
83 if interfaces_info: | 84 if interfaces_info: |
84 self.interface_dependency_resolver = InterfaceDependencyResolver(int
erfaces_info, self) | 85 self.interface_dependency_resolver = InterfaceDependencyResolver(int
erfaces_info, self) |
85 else: | 86 else: |
86 self.interface_dependency_resolver = None | 87 self.interface_dependency_resolver = None |
87 | 88 |
(...skipping 19 matching lines...) Expand all Loading... |
107 | 108 |
108 The IdlDefinitions object is guaranteed to contain a single | 109 The IdlDefinitions object is guaranteed to contain a single |
109 IdlInterface; it may also contain other definitions, such as | 110 IdlInterface; it may also contain other definitions, such as |
110 callback functions and enumerations.""" | 111 callback functions and enumerations.""" |
111 ast = blink_idl_parser.parse_file(self.parser, idl_filename) | 112 ast = blink_idl_parser.parse_file(self.parser, idl_filename) |
112 if not ast: | 113 if not ast: |
113 raise Exception('Failed to parse %s' % idl_filename) | 114 raise Exception('Failed to parse %s' % idl_filename) |
114 idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename)) | 115 idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename)) |
115 definitions = IdlDefinitions(idl_file_basename, ast) | 116 definitions = IdlDefinitions(idl_file_basename, ast) |
116 | 117 |
| 118 # FIXMEDART: Added multi_interface. |
117 if not self.multi_interface: | 119 if not self.multi_interface: |
118 validate_blink_idl_definitions(idl_filename, idl_file_basename, defi
nitions) | 120 validate_blink_idl_definitions(idl_filename, idl_file_basename, defi
nitions) |
119 else: | 121 else: |
120 if len(definitions.interfaces) > 1: | 122 if len(definitions.interfaces) > 1: |
121 print '----- Supplemental interfaces %s' % len(definitions.inter
faces) | 123 print '----- Supplemental interfaces %s' % len(definitions.inter
faces) |
122 | 124 |
123 # Validate extended attributes | 125 # Validate extended attributes |
124 if not self.extended_attribute_validator: | 126 if not self.extended_attribute_validator: |
125 return definitions | 127 return definitions |
126 | 128 |
127 try: | 129 try: |
128 self.extended_attribute_validator.validate_extended_attributes(defin
itions) | 130 self.extended_attribute_validator.validate_extended_attributes(defin
itions) |
129 except IDLInvalidExtendedAttributeError as error: | 131 except IDLInvalidExtendedAttributeError as error: |
130 raise IDLInvalidExtendedAttributeError(""" | 132 raise IDLInvalidExtendedAttributeError(""" |
131 IDL ATTRIBUTE ERROR in file: | 133 IDL ATTRIBUTE ERROR in file: |
132 %s: | 134 %s: |
133 %s | 135 %s |
134 If you want to add a new IDL extended attribute, please add it to: | 136 If you want to add a new IDL extended attribute, please add it to: |
135 %s | 137 %s |
136 and add an explanation to the Blink IDL documentation at: | 138 and add an explanation to the Blink IDL documentation at: |
137 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes | 139 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes |
138 """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH)) | 140 """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH)) |
139 | 141 |
140 return definitions | 142 return definitions |
OLD | NEW |