Skip to content

Commit

Permalink
[bind.py] add bind and _parse function
Browse files Browse the repository at this point in the history
  • Loading branch information
diivm committed Aug 15, 2021
1 parent f43cc13 commit b5bac4f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions clang_bind/bind.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path

from clang_bind.cmake_frontend import CMakeFileAPI
from clang_bind.parse import Parse


class Bind:
Expand Down Expand Up @@ -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()

0 comments on commit b5bac4f

Please sign in to comment.