fix: reject unsupported SKK expressions

This commit is contained in:
2026-08-12 17:39:09 +09:00
parent bae39c0188
commit 1f9af6ee3e
4 changed files with 13 additions and 4 deletions

View File

@@ -32,9 +32,9 @@ the normal build image.
`skk2ktrans` accepts one or more EUC-JP SKK files (or standard input), writes
UTF-8 tab-separated rows, and merges input in command-line and source order.
It strips annotations, deduplicates candidates, and omits expressions and
candidates containing whitespace. Escaped candidate delimiters are rejected;
rewrite or omit those entries before import.
It strips annotations, deduplicates candidates, and omits candidates containing
whitespace. Rows containing expressions or escaped candidate delimiters are
rejected; rewrite or omit those rows before import.
`verifymap.py` checks UTF-8, row structure, unique keys, 64-rune keys and
values, canonical candidate spacing, and duplicate dictionary candidates.

View File

@@ -34,6 +34,8 @@ function add(k, v, id) {
fail("invalid row")
if(field ~ /\\/)
fail("escaped candidates are unsupported")
if(field ~ /\/[([#]/)
fail("expression candidates are unsupported")
n = split(substr(field, 2, length(field)-2), value, "/")
for(i = 1; i <= n; i++)
add(key, value[i])

View File

@@ -3,4 +3,4 @@
えがお /笑顔;face/
かんじ /感じ/漢字;duplicate/
きごう /記号;symbol/普通/
むこう /候補 with space/(concat "式" "候補")/[無効]/#0/
むこう /候補 with space/

View File

@@ -36,6 +36,13 @@ class Skk2KtransTest(unittest.TestCase):
self.assertNotEqual(result.returncode, 0)
self.assertIn(b"escaped candidates are unsupported", result.stderr)
def test_expression_candidate_is_rejected(self):
source = b'key /(concat "a/b")/literal/\n'
result = subprocess.run(
[CONVERTER], input=source, capture_output=True, check=False)
self.assertNotEqual(result.returncode, 0)
self.assertIn(b"expression candidates are unsupported", result.stderr)
if __name__ == "__main__":
unittest.main()