diff options
author | 2011-06-01 16:13:13 +0200 | |
---|---|---|
committer | 2011-06-01 16:13:13 +0200 | |
commit | a480d044fa44decf5cfac2c6cda98285edfaa5a4 (patch) | |
tree | 0a2eeb7aa5c4f280b7f6f0f6883644ec59f9d22d | |
parent | I now handles ifdefs within ifdefs (diff) | |
download | ebuildgen-a480d044fa44decf5cfac2c6cda98285edfaa5a4.tar.gz ebuildgen-a480d044fa44decf5cfac2c6cda98285edfaa5a4.tar.bz2 ebuildgen-a480d044fa44decf5cfac2c6cda98285edfaa5a4.zip |
Made it append new includes again
-rw-r--r-- | scanfiles.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scanfiles.py b/scanfiles.py index 3f31dea..f9d3659 100644 --- a/scanfiles.py +++ b/scanfiles.py @@ -114,12 +114,10 @@ def scanincludes(string,inclst): includes : includes IFDEF includes ENDIF | IFDEF includes ENDIF """ - print("found ifdef!") if len(p) == 5: p[1][2] = addnewifdefs(p[1][2],{p[2] : p[3]}) p[0] = p[1] else: - print("ifdef before any includes!") ifdef = {} ifdef[p[1]] = p[2] p[0] = [set(),set(),ifdef] @@ -150,13 +148,15 @@ def scanincludes(string,inclst): yacc.yacc() - print(yacc.parse(string)) - return(inclst) + newinclst = yacc.parse(string) + newinclst = addnewincludes(newinclst,inclst) + return(newinclst) def addnewincludes(inclist1,inclist2): #come up with better names!! inclist1[0] = inclist1[0] | inclist2[0] inclist1[1] = inclist1[1] | inclist2[1] + inclist1[2] = addnewifdefs(inclist1[2],inclist2[2]) return(inclist1) def addnewifdefs(dict1,dict2): @@ -179,7 +179,7 @@ def addnewifdefs(dict1,dict2): def startscan(dir,filetypes): global_hfiles = set() local_hfiles = set() - inclst = [global_hfiles,local_hfiles] + inclst = [global_hfiles,local_hfiles,{}] for file in scandir(dir, filetypes): print(file) |