Commits

Michał Górny committed 6927dfb

Quote UnquotedWords when to append flags to them.

  • Participants
  • Parent commits 09bdc1e

Comments (0)

Files changed (1)

File lib/flaggie/makeconf.py

 			return self._token.flags
 
 		def append(self, flag):
-			assert(not isinstance(self._token, MakeConf.MakeConfFile.UnquotedWord))
+			if isinstance(self._token, MakeConf.MakeConfFile.UnquotedWord):
+				self._token.quoted = True
 
 			if not isinstance(flag, self.MakeConfFlag):
 				flag = self.MakeConfFlag(flag)
 				return '\n' in self.data
 
 		class UnquotedWord(Token):
-			pass
+			quoted = False
+
+			def toString(self):
+				if self.quoted:
+					return '"%s"' % self.data
+				else:
+					return self.data
 
 		class VariableRef(UnquotedWord):
 			def toString(self):