aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/GenerateCharacterCategory.py
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-04-27 07:47:26 +1000
committerNeil <nyamatongwe@gmail.com>2021-04-27 07:47:26 +1000
commita4ef4ea3f76313f0f509d0cc6983c60ec0c5be7b (patch)
tree3a40ffd8598be18ade5638f68d6a33c37f756d52 /scripts/GenerateCharacterCategory.py
parent4dcd314b9a77c93f650f5ff4e42b3695366e0095 (diff)
downloadscintilla-mirror-a4ef4ea3f76313f0f509d0cc6983c60ec0c5be7b.tar.gz
Update Unicode code generation scripts. Update Lexilla, use pathlib, simplify.
Diffstat (limited to 'scripts/GenerateCharacterCategory.py')
-rw-r--r--scripts/GenerateCharacterCategory.py15
1 files changed, 10 insertions, 5 deletions
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")