Commits

Michał Górny committed 0392073

Fix re-assembling split-flags into tokens.

Comments (0)

Files changed (1)

lib/flaggie/makeconf.py

 class MakeConfVariable(PackageFileSet.PackageFile.PackageEntry):
 	class MakeConfFlag(PackageFileSet.PackageFile.PackageEntry.PackageFlag):
 		def __init__(self, s, lta = []):
-			PackageFileSet.PackageFile.PackageEntry.PackageFlag.__init__(self, s)
+			self._origs = s
 			self._partialflags = lta
+			s += ''.join([x.toString() for x in lta])
+			PackageFileSet.PackageFile.PackageEntry.PackageFlag.__init__(self, s)
+
+		def toString(self):
+			return self._origs
 
 	class Whitespace(object):
 		def __init__(self, s):
 					sl = nsl
 					nt = None
 				else:
+					t.flags = []
 					sl = wsregex.split(t.data)
 					# 'flag1 flag2' -> flag1, ' ', flag2
 					# ' flag1 flag2' -> '', ' ', flag1, ' ', flag2
 					# '' -> ''
 
 				lta = []
-				t.flags = []
 				if sl[-1]:
 					while True:
 						try:
 							break
 						else:
 							nsl = wsregex.split(nt.data)
+							nt.flags = []
 							if len(nsl) == 1 and not nsl[0]:
-								nt.flags = []
+								pass
 							elif not nsl[0]: # the whitespace we were hoping for
 								break
 							else:
 								pf = self.PartialFlag(nsl[0])
-								nt.flags = [pf]
+								nt.flags.append(pf)
 								lta.append(pf)
 								if len(nsl) != 1:
 									nsl[0] = ''
 					if i%2 == 0:
 						if e:
 							if lta and i == lasti:
-								e += ''.join([x.toString() for x in lta])
 								t.flags.append(self.MakeConfFlag(e, lta))
 							else:
 								t.flags.append(self.MakeConfFlag(e))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.