diff options
author | Neil <nyamatongwe@gmail.com> | 2021-04-27 07:47:26 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-04-27 07:47:26 +1000 |
commit | a4ef4ea3f76313f0f509d0cc6983c60ec0c5be7b (patch) | |
tree | 3a40ffd8598be18ade5638f68d6a33c37f756d52 | |
parent | 4dcd314b9a77c93f650f5ff4e42b3695366e0095 (diff) | |
download | scintilla-mirror-a4ef4ea3f76313f0f509d0cc6983c60ec0c5be7b.tar.gz |
Update Unicode code generation scripts. Update Lexilla, use pathlib, simplify.
-rw-r--r-- | scripts/GenerateCaseConvert.py | 2 | ||||
-rw-r--r-- | scripts/GenerateCharacterCategory.py | 15 |
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") |