--- a/editors/TextViewer.py Mon Mar 27 10:19:14 2023 +0200
+++ b/editors/TextViewer.py Fri Oct 28 12:39:15 2022 +0800
@@ -23,8 +23,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-from __future__ import absolute_import
-from __future__ import division
+
+
import re
from functools import reduce
@@ -43,17 +43,17 @@
NEWLINE = "\n"
-NUMBERS = [str(i) for i in xrange(10)]
+NUMBERS = [str(i) for i in range(10)]
LETTERS = ['_']
-for i in xrange(26):
+for i in range(26):
LETTERS.append(chr(ord('a') + i))
LETTERS.append(chr(ord('A') + i))
[STC_PLC_WORD, STC_PLC_COMMENT, STC_PLC_NUMBER, STC_PLC_STRING,
STC_PLC_VARIABLE, STC_PLC_PARAMETER, STC_PLC_FUNCTION, STC_PLC_JUMP,
STC_PLC_ERROR, STC_PLC_SEARCH_RESULT,
- STC_PLC_EMPTY] = range(11)
-[SPACE, WORD, NUMBER, STRING, WSTRING, COMMENT, PRAGMA, DPRAGMA] = range(8)
+ STC_PLC_EMPTY] = list(range(11))
+[SPACE, WORD, NUMBER, STRING, WSTRING, COMMENT, PRAGMA, DPRAGMA] = list(range(8))
re_texts = {}
re_texts["letter"] = "[A-Za-z]"
@@ -70,7 +70,7 @@
def LineStartswith(line, symbols):
- return reduce(lambda x, y: x or y, map(line.startswith, symbols), False)
+ return reduce(lambda x, y: x or y, list(map(line.startswith, symbols)), False)
class TextViewer(EditorPanel):
@@ -496,7 +496,7 @@
for category in self.Controler.GetBlockTypes(self.TagName, self.Debug):
for blocktype in category["list"]:
blockname = blocktype["name"].upper()
- if blocktype["type"] == "function" and blockname not in self.Keywords and blockname not in self.Variables.keys():
+ if blocktype["type"] == "function" and blockname not in self.Keywords and blockname not in list(self.Variables.keys()):
interface = dict([(name, {}) for name, _type, _modifier in blocktype["inputs"] + blocktype["outputs"] if name != ''])
for param in ["EN", "ENO"]:
if param not in interface:
@@ -899,9 +899,9 @@
elif words[0].upper() in ["JMP", "JMPC", "JMPNC"]:
kw = self.Jumps
else:
- kw = self.Variables.keys()
- else:
- kw = self.Keywords + self.Variables.keys() + self.Functions.keys()
+ kw = list(self.Variables.keys())
+ else:
+ kw = self.Keywords + list(self.Variables.keys()) + list(self.Functions.keys())
if len(kw) > 0:
if len(words[-1]) > 0:
kw = [keyword for keyword in kw if keyword.startswith(words[-1])]