summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2014-03-31 11:12:57 +0200
committerLászló Németh <nemeth@numbertext.org>2014-03-31 11:15:10 +0200
commit2fc50ff8bea6f64b367d44a1760b8dd9fb69a401 (patch)
tree59422eecac8b308b5f312b32de0029e51caa9273
parent6ef6e882f9dc802ad1e07e9424d5479549a61f9a (diff)
fdo#75109 librelogo: fix localized procedures
Change-Id: Ia6edb02b871a41828758ba5fd5376c811c4084cc
-rw-r--r--librelogo/source/LibreLogo/LibreLogo.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index 665ec74df83f..a923e0eb16ce 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -1703,11 +1703,16 @@ def __compil__(s):
if len(subnames) > 0:
globs = "global %s" % ", ".join(subnames)
# search user functions (function calls with two or more arguments need explicite Python parentheses)
+ ends = __l12n__(_.lng)["END"] # support multiple names of "END"
+ firstend = ends.split("|")[0]
+ s = re.sub(r"(?<!:)\b(?:%s)\b" % ends, firstend, s)
+ __l12n__(_.lng)["END"] = firstend
functions += [ re.findall("(?u)\w+",i[0])[0] for i in re.findall(r"""(?iu)(?<=__def__ )([^\n]*)\n # beginning of a procedure
(?:[^\n]*(?<!\b(%(END)s))\n)* # 0 or more lines (not END)
[^\n]*\b(?:%(OUTPUT)s)\b[^\n]*\n # line with OUTPUT (functions = procedures with OUTPUT)
(?:[^\n]*(?<!\b(?:%(END)s))\n)* # 0 or more lines (not END)
- [ \t]*\b(?:%(END)s)\b""" % __l12n__(_.lng), s, re.X) ] # final END (XXX multiple names of "END" doesn't supported)
+ [ \t]*\b(?:%(END)s)\b""" % __l12n__(_.lng), s, re.X) ]
+ __l12n__(_.lng)["END"] = ends
# add line breaks before procedure calls
procedures = set(subnames) - set(functions)
if len(procedures) > 0: