Skip to content

Commit

Permalink
Improve child iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Dec 20, 2023
1 parent 95a70b1 commit 5a13f45
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/tokenide.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TokenIDESheet:
NAMESPACE = "http://merthsoft.com/Tokens"

STARTERS = [b'\x2A']
TERMINATORS = [b'\x04', b'*', b'\x3F']
TERMINATORS = [b'\x04', b'\x2A', b'\x3F']

def __init__(self, sheet: dict[str] = None):
self.sheet = sheet or {"tokens": {}, "meta": []}
Expand Down Expand Up @@ -111,8 +111,8 @@ def build_page(element: ET.Element, byte: str, dct: dict):
for name in dct.get("variants", set()):
element.append(ET.Element("Alt", string=name))

for child in dict(sorted(dct.get("tokens", {}).items())):
build_page(element, child, dct["tokens"][child])
for child_byte, child_dct in sorted(dct.get("tokens", {}).items()):
build_page(element, child_byte, child_dct)

build_page(sheet, "", self.sheet)
return sheet
Expand Down

0 comments on commit 5a13f45

Please sign in to comment.