aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2011-06-19 19:30:55 +0200
committerSebastian Parborg <darkdefende@gmail.com>2011-06-19 19:30:55 +0200
commit7feadd529c924b8993a74a38823e1f56c21e19dd (patch)
tree278aa6ceb59799a4e515e7d05cdc43ec3b5767e9
parentAdded a stub to function inside "$()" (diff)
downloadebuildgen-7feadd529c924b8993a74a38823e1f56c21e19dd.tar.gz
ebuildgen-7feadd529c924b8993a74a38823e1f56c21e19dd.tar.bz2
ebuildgen-7feadd529c924b8993a74a38823e1f56c21e19dd.zip
Made command interp handle mixed strings and vars
-rw-r--r--filetypes/makefilecom.py12
-rw-r--r--filetypes/makefiles.py13
2 files changed, 12 insertions, 13 deletions
diff --git a/filetypes/makefilecom.py b/filetypes/makefilecom.py
index e83930f..71adab9 100644
--- a/filetypes/makefilecom.py
+++ b/filetypes/makefilecom.py
@@ -79,7 +79,7 @@ def com_interp(string,variables):
return t
def t_TEXT(t):
- r"[^ \n\t:=\)\}\\\$,]+"
+ r"[^ \n\t:=\)\}\(\}\\\$,]+"
return t
def t_SPACE(t):
@@ -113,11 +113,17 @@ def com_interp(string,variables):
"""
complst : complst BEGINCOM textstr ENDCOM
| BEGINCOM textstr ENDCOM
+ | complst textstr
+ | textstr
"""
if len(p) == 4:
p[0] = expand(variables[p[2]],variables)
- else:
+ elif len(p) == 5:
p[0] = [p[1][0] + expand(variables[p[3]],variables)[0]]
+ elif len(p) == 3:
+ p[0] = [p[1][0] + p[2]]
+ else:
+ p[0] = [p[1]]
def p_tonewstr(p):
"""
@@ -275,4 +281,4 @@ def com_interp(string,variables):
return retlst
-#print(com_interp("(y$(y))",{"x":["y"], "y":["z"], "z":["u"],"yz":["u","v"]}))
+#print(com_interp("(y)y(y)",{"x":["y"], "y":["z"], "z":["u"],"yz":["u","v"]}))
diff --git a/filetypes/makefiles.py b/filetypes/makefiles.py
index be0009f..09719cf 100644
--- a/filetypes/makefiles.py
+++ b/filetypes/makefiles.py
@@ -84,14 +84,6 @@ def scanmakefile(makefile):
r"\%"
return t
- def t_var_TEXT(t):
- r"[^ \n\t\$\\,]+"
- return t
-
- def t_var_SPACE(t):
- r"[ \t]"
- return t
-
def t_EQ(t):
r"=[ \t]*"
t.lexer.begin('var')
@@ -130,9 +122,9 @@ def scanmakefile(makefile):
r","
return t
- def t_spacetab(t):
+ def t_SPACE(t):
r"[ \t]"
- pass
+ return t
def t_ENDTAB(t):
r"\n\t"
@@ -251,6 +243,7 @@ def scanmakefile(makefile):
"""
end : end END
| end spacestr END
+ | end spacestr
| END
"""