Fix bug defining string initial value using quotes
authorLaurent Bessard
Mon, 15 Apr 2013 00:32:16 +0200
changeset 1032 c4989e53f9c3
parent 1031 5743398071eb
child 1033 1eec9b855e47
Fix bug defining string initial value using quotes
PLCGenerator.py
--- a/PLCGenerator.py	Mon Apr 15 00:27:30 2013 +0200
+++ b/PLCGenerator.py	Mon Apr 15 00:32:16 2013 +0200
@@ -106,9 +106,9 @@
     # Compute value according to type given
     def ComputeValue(self, value, var_type):
         base_type = self.Controler.GetBaseType(var_type)
-        if base_type == "STRING":
+        if base_type == "STRING" and not value.startswith("'") and not value.endswith("'"):
             return "'%s'"%value
-        elif base_type == "WSTRING":
+        elif base_type == "WSTRING" and not value.startswith('"') and not value.endswith('"'):
             return "\"%s\""%value
         return value