Browse Source

c_2_ast.py - clang arguments -std=c99 (TODO:move to cfg file)

master
heck 4 years ago
parent
commit
c213425cf9
  1. 12
      pEpACIDgen/c_2_ast.py

12
pEpACIDgen/c_2_ast.py

@ -18,7 +18,7 @@ class C2AST:
def parse(self, filename, content=None, follow_includes=False): def parse(self, filename, content=None, follow_includes=False):
index = clang.cindex.Index.create() index = clang.cindex.Index.create()
arguments = ["-x", "c", "-I/Users/heck/local-default/include/"] arguments = [ "-std=c99","-I/Users/heck/local-default/include/"]
options = clang.cindex.TranslationUnit.PARSE_SKIP_FUNCTION_BODIES options = clang.cindex.TranslationUnit.PARSE_SKIP_FUNCTION_BODIES
if content: if content:
content = [(filename, content)] content = [(filename, content)]
@ -57,11 +57,11 @@ class C2AST:
} }
# generic info for all CursorKinds # generic info for all CursorKinds
if str(cursor.get_tokens()): # if str(cursor.get_tokens()):
str_tok = "" # str_tok = ""
for tok in cursor.get_tokens(): # for tok in cursor.get_tokens():
str_tok += tok.spelling + " " # str_tok += tok.spelling + " "
item["tokens"] = str_tok.rstrip() # item["tokens"] = str_tok.rstrip()
if str(cursor.kind): if str(cursor.kind):
item["kind"] = str(cursor.kind) item["kind"] = str(cursor.kind)

Loading…
Cancel
Save