Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/interscript/isc.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ def _render_item(item: dict, aliases: dict[str, str]) -> str:
if name == "line_end":
return "line_end"
raise UnsupportedConstruct(f"primitive {name}")
if kind == "function" and item["name"] == "any_character":
return "any_character"
if kind == "alias_ref":
name = item["name"]
if item.get("map"):
Expand Down Expand Up @@ -759,6 +761,8 @@ def _regex_of(item: dict, aliases: dict[str, str]) -> str:
"line_end": "$",
"space": " ",
}.get(item["name"], None) or _unsupported_primitive(item["name"])
if kind == "function" and item["name"] == "any_character":
return "."
if kind == "alias_ref":
name = item["name"]
if item.get("map"):
Expand Down
11 changes: 11 additions & 0 deletions tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,14 @@ def test_par_unsafe_rule_forces_megaregexp_first_wins():
' }\n}\n'
)
assert Engine(tree).transliterate("i") == "X"


@pytest.mark.skipif(not MAPS.is_dir(), reason="interscript maps repo not present")
def test_any_character_renders():
"""kp-kor hyphenates generics with before any_character +
any_character guards; the item renderer had no branch for the
any_character function item and silently dropped every such rule
(고비리 -> Kobiri instead of Kobi-ri)."""
e = _load("kp-kor-Hang-Latn-2002")
assert e.transliterate("고비리") == "Kobi-ri"
assert e.transliterate("교구동") == "Kyogu-dong"
Loading