Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
rpitasky authored Aug 21, 2024
1 parent ea72ad6 commit 46ad13f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 28 deletions.
9 changes: 0 additions & 9 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@
with open("built/8X.json", "w+", encoding="UTF-8") as outfile:
json.dump(to_json(root), outfile, indent=2, ensure_ascii=False)


with open("73.xml", encoding="UTF-8") as infile:
root = ET.fromstring(src := infile.read())

with open("built/73.xml", "w+", encoding="UTF-8") as outfile:
validate(root, for_73=True)
outfile.write(src)


with open(".github/workflows/tokenide.xml", encoding="UTF-8") as infile:
sheet = TokenIDESheet.from_xml_string(infile.read())

Expand Down
22 changes: 3 additions & 19 deletions scripts/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
from .parse import OsVersion, OsVersions


def validate(root: ET.Element, *, for_73: bool = False) -> int:
def validate(root: ET.Element, *) -> int:
"""
Validates a token sheet, raising an error if an invalid component is found
:param root: An XML element, which must be the root element of the sheet
:param for_73: Whether to use the 73 sheet validator (defaults to False)
:return: The number of tokens in the sheet
"""

Expand Down Expand Up @@ -83,12 +82,6 @@ def text(regex: str):
children(r"<since>(<until>)?(<lang>)+")

case "since":
if not for_73:
if (this_version := OsVersion.from_element(element)) < version:
raise ValidationError(f"version {this_version} overlaps with {version}")

version = this_version

# Workaround for nested defaultdict
all_names[version] = all_names.get(version, defaultdict(set))

Expand All @@ -98,16 +91,8 @@ def text(regex: str):
children(r"<model><os-version>")

case "lang":
if for_73:
attributes({"code": r"[a-z]{2}"})
children(r"<name>")

else:
attributes({"code": r"[a-z]{2}", "ti-ascii": r"([0-9A-F]{2})+", "display": r".+"})
children(r"<accessible>(<variant>)*")

case "name" if for_73:
text(r".+")
attributes({"code": r"[a-z]{2}", "ti-ascii": r"([0-9A-F]{2})+", "display": r".+"})
children(r"<accessible>(<variant>)*")

case "accessible":
text(r"[\u0000-\u00FF]+")
Expand Down Expand Up @@ -190,7 +175,6 @@ def to_json(element: ET.Element):
case _:
if list(element):
return {child.tag: to_json(child) for child in element}

else:
return element.text

Expand Down

0 comments on commit 46ad13f

Please sign in to comment.