diff --git a/clang_bind/bind.py b/clang_bind/bind.py index c1fe6b8..2850af4 100644 --- a/clang_bind/bind.py +++ b/clang_bind/bind.py @@ -1,6 +1,7 @@ from pathlib import Path from clang_bind.cmake_frontend import CMakeFileAPI +from clang_bind.parse import Parse class Bind: @@ -76,3 +77,19 @@ def _set_inclusion_sources(self): sources = CMakeFileAPI(self.build_dir).get_sources(module) cpp_sources = list(filter(lambda x: x.endswith(".cpp"), sources)) self.inclusion_sources += list(set(sources) - set(cpp_sources)) + + def _parse(self): + """For all input files, get the parsed tree and update the db.""" + for module_db in self.binding_db.values(): + for db in module_db: + db.update( + { + "parsed_tree": Parse( + db.get("source_path"), self.inclusion_sources + ).get_tree() + } + ) + + def bind(self): + """Function to bind the input files.""" + self._parse()