Strip "#ident" when parsing C

This commit is contained in:
Simon Lindholm
2023-05-15 23:44:16 +02:00
parent 756eb0fe95
commit 3f8a292ed0
+1
View File
@@ -125,6 +125,7 @@ def extract_fn(ast: ca.FileAST, fn_name: str) -> Tuple[ca.FuncDef, int]:
def parse_c(source: str, *, from_import: bool = False) -> ca.FileAST:
source = re.sub(r"^#ident.*", "", source, flags=re.MULTILINE)
try:
parser = CParser()
return parser.parse(source, "<source>")