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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 def read_idl_file(self, idl_filename): | 104 def read_idl_file(self, idl_filename): |
105 """Returns an IdlDefinitions object for an IDL file, without any depende
ncies. | 105 """Returns an IdlDefinitions object for an IDL file, without any depende
ncies. |
106 | 106 |
107 The IdlDefinitions object is guaranteed to contain a single | 107 The IdlDefinitions object is guaranteed to contain a single |
108 IdlInterface; it may also contain other definitions, such as | 108 IdlInterface; it may also contain other definitions, such as |
109 callback functions and enumerations.""" | 109 callback functions and enumerations.""" |
110 ast = blink_idl_parser.parse_file(self.parser, idl_filename) | 110 ast = blink_idl_parser.parse_file(self.parser, idl_filename) |
111 if not ast: | 111 if not ast: |
112 raise Exception('Failed to parse %s' % idl_filename) | 112 raise Exception('Failed to parse %s' % idl_filename) |
113 idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename)) | 113 idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename)) |
114 definitions = IdlDefinitions(idl_file_basename, ast) | 114 definitions = IdlDefinitions(ast) |
115 | 115 |
116 validate_blink_idl_definitions( | 116 validate_blink_idl_definitions( |
117 idl_filename, idl_file_basename, definitions) | 117 idl_filename, idl_file_basename, definitions) |
118 | 118 |
119 # Validate extended attributes | 119 # Validate extended attributes |
120 if not self.extended_attribute_validator: | 120 if not self.extended_attribute_validator: |
121 return definitions | 121 return definitions |
122 | 122 |
123 try: | 123 try: |
124 self.extended_attribute_validator.validate_extended_attributes(defin
itions) | 124 self.extended_attribute_validator.validate_extended_attributes(defin
itions) |
125 except IDLInvalidExtendedAttributeError as error: | 125 except IDLInvalidExtendedAttributeError as error: |
126 raise IDLInvalidExtendedAttributeError(""" | 126 raise IDLInvalidExtendedAttributeError(""" |
127 IDL ATTRIBUTE ERROR in file: | 127 IDL ATTRIBUTE ERROR in file: |
128 %s: | 128 %s: |
129 %s | 129 %s |
130 If you want to add a new IDL extended attribute, please add it to: | 130 If you want to add a new IDL extended attribute, please add it to: |
131 %s | 131 %s |
132 and add an explanation to the Blink IDL documentation at: | 132 and add an explanation to the Blink IDL documentation at: |
133 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes | 133 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes |
134 """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH)) | 134 """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH)) |
135 | 135 |
136 return definitions | 136 return definitions |
OLD | NEW |