| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 import os.path | 31 import os.path |
| 32 | 32 |
| 33 import blink_idl_parser | 33 import blink_idl_parser |
| 34 import idl_definitions_builder | 34 import idl_definitions_builder |
| 35 import idl_validator | 35 import idl_validator |
| 36 import interface_dependency_resolver | 36 import interface_dependency_resolver |
| 37 | 37 |
| 38 | 38 |
| 39 class IdlReader: | 39 class IdlReader: |
| 40 def __init__(self, interface_dependencies_filename=None, additional_idl_file
names=None, idl_attributes_filename=None, outputdir='', verbose=False): | 40 def __init__(self, interfaces_filename=None, additional_idl_filenames=None,
idl_attributes_filename=None, outputdir='', verbose=False): |
| 41 if idl_attributes_filename: | 41 if idl_attributes_filename: |
| 42 self.extended_attribute_validator = idl_validator.IDLExtendedAttribu
teValidator(idl_attributes_filename) | 42 self.extended_attribute_validator = idl_validator.IDLExtendedAttribu
teValidator(idl_attributes_filename) |
| 43 else: | 43 else: |
| 44 self.extended_attribute_validator = None | 44 self.extended_attribute_validator = None |
| 45 | 45 |
| 46 if interface_dependencies_filename: | 46 if interfaces_filename: |
| 47 self.interface_dependency_resolver = interface_dependency_resolver.I
nterfaceDependencyResolver(interface_dependencies_filename, additional_idl_filen
ames, self) | 47 self.interface_dependency_resolver = interface_dependency_resolver.I
nterfaceDependencyResolver(interfaces_filename, additional_idl_filenames, self) |
| 48 else: | 48 else: |
| 49 self.interface_dependency_resolver = None | 49 self.interface_dependency_resolver = None |
| 50 | 50 |
| 51 self.parser = blink_idl_parser.BlinkIDLParser(outputdir=outputdir, verbo
se=verbose) | 51 self.parser = blink_idl_parser.BlinkIDLParser(outputdir=outputdir, verbo
se=verbose) |
| 52 | 52 |
| 53 def read_idl_definitions(self, idl_filename): | 53 def read_idl_definitions(self, idl_filename): |
| 54 """Returns an IdlDefinitions object for an IDL file, including all depen
dencies.""" | 54 """Returns an IdlDefinitions object for an IDL file, including all depen
dencies.""" |
| 55 basename = os.path.basename(idl_filename) | 55 basename = os.path.basename(idl_filename) |
| 56 interface_name, _ = os.path.splitext(basename) | 56 interface_name, _ = os.path.splitext(basename) |
| 57 definitions = self.read_idl_file(idl_filename) | 57 definitions = self.read_idl_file(idl_filename) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 71 except idl_validator.IDLInvalidExtendedAttributeError as error: | 71 except idl_validator.IDLInvalidExtendedAttributeError as error: |
| 72 raise idl_validator.IDLInvalidExtendedAttributeError("""IDL ATTR
IBUTE ERROR in file %s: | 72 raise idl_validator.IDLInvalidExtendedAttributeError("""IDL ATTR
IBUTE ERROR in file %s: |
| 73 %s | 73 %s |
| 74 If you want to add a new IDL extended attribute, please add it to | 74 If you want to add a new IDL extended attribute, please add it to |
| 75 bindings/IDLExtendedAttributes.txt | 75 bindings/IDLExtendedAttributes.txt |
| 76 and add an explanation to the Blink IDL documentation at: | 76 and add an explanation to the Blink IDL documentation at: |
| 77 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes | 77 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes |
| 78 """ % (idl_filename, str(error))) | 78 """ % (idl_filename, str(error))) |
| 79 | 79 |
| 80 return definitions | 80 return definitions |
| OLD | NEW |