From a4ef4ea3f76313f0f509d0cc6983c60ec0c5be7b Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 27 Apr 2021 07:47:26 +1000 Subject: Update Unicode code generation scripts. Update Lexilla, use pathlib, simplify. --- scripts/GenerateCaseConvert.py | 2 +- scripts/GenerateCharacterCategory.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'scripts') 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") -- cgit v1.2.3