Kaydet (Commit) 8547a8d9 authored tarafından László Németh's avatar László Németh

tdf#124035 LibreLogo: support starting colon in variable names

Regression from the commit 740b9978
"tdf#120413 LibreLogo: handle complex Logo expressions".

Change-Id: Iaae54efacf86a03a6611c154a40068ed058d43e7
Reviewed-on: https://gerrit.libreoffice.org/69138
Tested-by: Jenkins
Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
üst d21aab7d
...@@ -1903,7 +1903,7 @@ def __compil__(s): ...@@ -1903,7 +1903,7 @@ def __compil__(s):
# compile to Python # compile to Python
subroutines = re.compile(r"(?iu)(?<!def )(?<![_\w])\b(%s)\b(?![\w(])" % "|".join(subnames + functions + defaultfunc)) subroutines = re.compile(r"(?iu)(?<!def )(?<![_\w])\b(%s)\b(?![\w(])" % "|".join(subnames + functions + defaultfunc))
operators = re.compile(r"(?iu)(%s)" % "(?:[ ]*([+*/<>]|//|==|<=|>=|<>|!=)[ ]*|[ ]*-[ ]+|(?<! )-[ ]*|[ ]*[*][*][ ]*)") # operators, eg. " - ", "-", "- " operators = re.compile(r"(?iu)(%s)" % "(?:[ ]*([+*/<>]|//|==|<=|>=|<>|!=)[ ]*|[ ]*-[ ]+|(?<! )-[ ]*|[ ]*[*][*][ ]*)") # operators, eg. " - ", "-", "- "
atoms = re.compile(r"(?iu)(%s)" % "[0-9]+([.,][0-9]+)?|\w+([.]\w)?") atoms = re.compile(r"(?iu)(%s)" % "[0-9]+([.,][0-9]+)?|:?\w+([.]\w)?")
# store argument numbers of all subroutines in dictionary "names" # store argument numbers of all subroutines in dictionary "names"
names = {key: 1 for key in functions + defaultfunc} names = {key: 1 for key in functions + defaultfunc}
......
...@@ -81,6 +81,7 @@ class LibreLogoCompileTest(UITestCase): ...@@ -81,6 +81,7 @@ class LibreLogoCompileTest(UITestCase):
# PROCEDURE WITH ARGUMENTS # PROCEDURE WITH ARGUMENTS
("TO x y\nLABEL y\nEND\nx 25", "global x\ndef x(y):\n __checkhalt__()\n %s\n label(y)\n %s\n%s\nx(25)" % (((self.LS),)*3)), ("TO x y\nLABEL y\nEND\nx 25", "global x\ndef x(y):\n __checkhalt__()\n %s\n label(y)\n %s\n%s\nx(25)" % (((self.LS),)*3)),
("TO x :y :z\nLABEL :y + :z\nEND\nx 25 26", "global x\ndef x(_y, _z):\n __checkhalt__()\n %s\n label(_y + _z)\n %s\n%s\nx(25, 26)" % (((self.LS),)*3)), ("TO x :y :z\nLABEL :y + :z\nEND\nx 25 26", "global x\ndef x(_y, _z):\n __checkhalt__()\n %s\n label(_y + _z)\n %s\n%s\nx(25, 26)" % (((self.LS),)*3)),
("TO x :y :z\nLABEL :y + :z\nEND\nx 25 :w", "global x\ndef x(_y, _z):\n __checkhalt__()\n %s\n label(_y + _z)\n %s\n%s\nx(25, _w)" % (((self.LS),)*3)),
# UNICODE VARIABLE NAMES # UNICODE VARIABLE NAMES
("Erdős=1", "Erd__u__0151s=1"), ("Erdős=1", "Erd__u__0151s=1"),
# STRING CONSTANTS # STRING CONSTANTS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment