Skip to content

Commit

Permalink
Add warning messages for missing arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nightlark committed Oct 7, 2023
1 parent c32c6cd commit 5b62c2c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/bindingGenerators/clangParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json
import logging
import os
import sys
from typing import List

import clang.cindex as cidx
Expand Down Expand Up @@ -191,3 +192,13 @@ def parseCHeaderFiles(self, headers: List[str], ignoredMacros: List[str]) -> Non
del self.parsedInfo[key]
clangLogger.info("Clang successfully parsed the C header files!")
clangLogger.debug(f"The clang parser result:\n{json.dumps(self.parsedInfo, indent=4, sort_keys=True)}\n{json.dumps(CHeaderParser._types, indent=4, sort_keys=True)}")

if len(sys.argv) < 2:
print("At least one header file must be provided as an input argument.")
exit(1)

with open("ast.json", "w+") as f:
json.dump(CHeaderParser(sys.argv[1:]).parsedInfo, f, indent=4, sort_keys=False)

with open("types.json", "w+") as f:
json.dump(CHeaderParser(sys.argv[1:])._types, f, indent=4, sort_keys=False)

0 comments on commit 5b62c2c

Please sign in to comment.