aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/GenerateCaseConvert.py2
-rw-r--r--scripts/GenerateCharacterCategory.py15
2 files changed, 11 insertions, 6 deletions
diff --git a/scripts/GenerateCaseConvert.py b/scripts/GenerateCaseConvert.py
index 9b3e9fb52..7a0f473f7 100644
--- a/scripts/GenerateCaseConvert.py
+++ b/scripts/GenerateCaseConvert.py
@@ -17,7 +17,7 @@
# strings with original, folded, upper, and lower separated by '|'.
# There are 126 complex cases.
-import codecs, itertools, os, string, sys, unicodedata
+import itertools, string, sys
from FileGenerator import Regenerate
diff --git a/scripts/GenerateCharacterCategory.py b/scripts/GenerateCharacterCategory.py
index 355322992..271381064 100644
--- a/scripts/GenerateCharacterCategory.py
+++ b/scripts/GenerateCharacterCategory.py
@@ -4,15 +4,15 @@
# Requires Python 3.3 or later
# Should not be run with old versions of Python.
-import codecs, os, platform, sys, unicodedata
+import pathlib, platform, sys, unicodedata
from FileGenerator import Regenerate
def findCategories(filename):
- with codecs.open(filename, "r", "UTF-8") as infile:
+ with filename.open(encoding="UTF-8") as infile:
lines = [x.strip() for x in infile.readlines() if "\tcc" in x]
values = "".join(lines).replace(" ","").split(",")
- print(values)
+ print("Categrories:", values)
return [v[2:] for v in values]
def updateCharacterCategory(filename):
@@ -42,6 +42,11 @@ def updateCharacterCategory(filename):
Regenerate(filename, "//", values)
-categories = findCategories("../lexlib/CharacterCategory.h")
-updateCharacterCategory("../lexlib/CharacterCategory.cxx")
+scintillaDirectory = pathlib.Path(__file__).resolve().parent.parent
+
+categories = findCategories(scintillaDirectory / "src" / "CharacterCategory.h")
+
+updateCharacterCategory(scintillaDirectory / "src" / "CharacterCategory.cxx")
+
+updateCharacterCategory(scintillaDirectory.parent / "lexilla" / "lexlib" / "CharacterCategory.cxx")