Skip to content

Commit b5bac4f

Browse files
committed
[bind.py] add bind and _parse function
1 parent f43cc13 commit b5bac4f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

clang_bind/bind.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pathlib import Path
22

33
from clang_bind.cmake_frontend import CMakeFileAPI
4+
from clang_bind.parse import Parse
45

56

67
class Bind:
@@ -76,3 +77,19 @@ def _set_inclusion_sources(self):
7677
sources = CMakeFileAPI(self.build_dir).get_sources(module)
7778
cpp_sources = list(filter(lambda x: x.endswith(".cpp"), sources))
7879
self.inclusion_sources += list(set(sources) - set(cpp_sources))
80+
81+
def _parse(self):
82+
"""For all input files, get the parsed tree and update the db."""
83+
for module_db in self.binding_db.values():
84+
for db in module_db:
85+
db.update(
86+
{
87+
"parsed_tree": Parse(
88+
db.get("source_path"), self.inclusion_sources
89+
).get_tree()
90+
}
91+
)
92+
93+
def bind(self):
94+
"""Function to bind the input files."""
95+
self._parse()

0 commit comments

Comments
 (0)