diff options
author | László Németh <nemeth@numbertext.org> | 2019-04-17 00:37:54 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-04-25 20:21:16 +0200 |
commit | 0718458f1ae80c798c13400fd87c989faba01937 (patch) | |
tree | fc28530783bd3775a23d844101e67c97919e3e8e /librelogo | |
parent | c379ba47a786a6a7422c8fcdbfec32ddbcf88b90 (diff) |
LibreLogo: fix RANGE with a single function argument
in a FOR loop, by removing the range(x,,)-like double
commas in this case, too, during program compilation.
Previous empty (missing) argument of RANGE was checked
by the terminating comma, but it can be a white space
after it, as in the following example:
FOR i IN RANGE COUNT 'letter' [ PRINT i ]
Change-Id: I67d0a4f089be06f30003d1b979b8f1801dbfa2e9
Reviewed-on: https://gerrit.libreoffice.org/71263
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'librelogo')
-rw-r--r-- | librelogo/source/LibreLogo/LibreLogo.py | 6 |
1 files changed, 3 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]] |