summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librelogo/source/LibreLogo/LibreLogo.py6
-rw-r--r--sw/qa/uitest/librelogo/compile.py1
2 files changed, 4 insertions, 3 deletions
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index d4fa0cfea340..e58537b2338a 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -1764,10 +1764,10 @@ def __l2p__(i, par, insub, inarray):
for j in range(par["names"][subname]):
# add commas, except if already added, eg. with special RANGE
# (variable argument counts: RANGE 1 or RANGE 1 100 or RANGE 1 100 10)
- if j > 0 and par["out"][-1] != ",":
- par["out"] = re.sub("( *),$",",\\1", par["out"] + ",")
+ if j > 0 and par["out"].rstrip()[-1] != ",":
+ par["out"] = re.sub("( +),$",",\\1", par["out"] + ",")
__l2p__(i, par, True, False)
- par["out"] = re.sub("( *)\\)$", ")\\1", par["out"] + ")")
+ par["out"] = re.sub("( +)\\)$", ")\\1", par["out"] + ")")
# operators
elif pos in par["op"]:
op = i[pos:par["op"][pos]]
diff --git a/sw/qa/uitest/librelogo/compile.py b/sw/qa/uitest/librelogo/compile.py
index 28905a36b897..89e538b8c926 100644
--- a/sw/qa/uitest/librelogo/compile.py
+++ b/sw/qa/uitest/librelogo/compile.py
@@ -74,6 +74,7 @@ class LibreLogoCompileTest(UITestCase):
("WHILE REPCOUNT < 10 [ ]", "REPCOUNT2 = 1\nwhile REPCOUNT2 < 10 :\n __checkhalt__()\n REPCOUNT = REPCOUNT2\n REPCOUNT2 += 1"),
# for
("FOR i in [1, 2, 3] [ ]", "REPCOUNT4 = 1\nfor i in [1, 2, 3] :\n __checkhalt__()\n REPCOUNT = REPCOUNT4\n REPCOUNT4 += 1"),
+ ("FOR i IN RANGE COUNT 'letters' [ ]", "REPCOUNT6 = 1\nfor i in range(len(u'letters'),) :\n __checkhalt__()\n REPCOUNT = REPCOUNT6\n REPCOUNT6 += 1"),
# PROCEDURE
("TO x\nLABEL 2\nEND", "global x\ndef x():\n __checkhalt__()\n %s\n label(2)\n %s" % (((self.LS),)*2)),
# FUNCTION