diff --git a/src/release/lua/cjk_comment.lua b/src/release/lua/cjk_comment.lua index ac9f9c3..fe94066 100644 --- a/src/release/lua/cjk_comment.lua +++ b/src/release/lua/cjk_comment.lua @@ -1,57 +1,77 @@ local function cjk_comment(input,env) - if env.engine.context:get_option('cjk_comment') then --如果开启了中英文混输 + if env.engine.context:get_option('cjk_comment') then --如果开启了cjk提示 for option_ in input:iter() do --检查所有候选项 local str = option_.text if utf8.len(str)==1 then local code = utf8.codepoint(str) - if (code >= 57344 and code <= 63743) or (code >= 983040 and code <= 1048573) or (code >= 1048576 and code <= 1114109) then --(U+E000-U+F8FF)(U+F0000-U+FFFFD,U+100000-U+10FFFD) + if (code >= 0xe000 and code <= 0xf8ff) or (code >= 0xf0000 and code <= 0xffffd) or (code >= 0x100000 and code <= 0x10fffd) then option_.comment = option_.comment .. "〔PUA〕u" .. string.format("%X", code) - elseif code >= 13312 and code <= 19893 then + -- elseif code >= 0x4e00 and code <= 0x9f5a then + -- option_.comment = option_.comment .. "〔基本区〕u" .. string.format("%X", code) .. "" + elseif code >= 0x9FA6 and code <= 0x9FBB then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. "[4.1 2003]" + elseif code >= 0x9FBC and code <= 0x9FC3 then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. "[5.1 2003]" + elseif code >= 0x9FC4 and code <= 0x9FCB then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. "[5.2 2003]" + elseif code == 0x9FCC then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. " [6.1 2012]" + elseif code >= 0x9FCD and code <= 0x9FD5 then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. "[8.0 2015]" + elseif code >= 0x9FD6 and code <= 0x9FEA then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. "[10.0 2017]" + elseif code >= 0x9FEB and code <= 0x9FEF then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. " [11.0 2018]" + elseif code >= 0x9FF0 and code <= 0x9FFC then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. " [13.0 2020]" + elseif code >= 0x9FFD and code <= 0x9FFF then + option_.comment = option_.comment .. "〔基本区补充〕u" .. string.format("%X", code) .. "[14.0 2021]" + elseif code >= 0x3400 and code <= 0x4DB5 then option_.comment = option_.comment .. "〔扩A〕u" .. string.format("%X", code) .. " [3.0 2000]" - elseif code >= 131072 and code <= 173782 then + elseif code >= 0x4DB6 and code <= 0x4DBF then + option_.comment = option_.comment .. "〔扩A补充〕u" .. string.format("%X", code) .. " [13.0 2020]" + elseif code >= 0x20000 and code <= 0x2A6D6 then option_.comment = option_.comment .. "〔扩B〕u" .. string.format("%X", code) .. " [3.1 2001]" - elseif (code >= 40870 and code <= 40883) or (code >= 40884 and code <= 40891) then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [4.1 2003]" - elseif code >= 40892 and code <= 40899 then - option_.comment = option_.comment .. "〔增改〕u" .. string.format("%X", code) .. " [5.1 2003]" - elseif code >= 173824 and code <= 177972 then + elseif code >= 0x2A6D7 and code <= 0x2A6DD then + option_.comment = option_.comment .. "〔扩B补充〕u" .. string.format("%X", code) .. " [13.0 2020]" + elseif code >= 0x2A6DE and code <= 0x2A6DF then + option_.comment = option_.comment .. "〔扩B补充〕u" .. string.format("%X", code) .. " [14.0 2021]" + elseif code >= 0x2A700 and code <= 0x2B734 then option_.comment = option_.comment .. "〔扩C〕u" .. string.format("%X", code) .. " [5.2 2003]" - elseif code >= 40900 and code <= 40907 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [5.2 2003]" - elseif code >= 177984 and code <= 178205 then + elseif code >= 0x2B735 and code <= 0x2B738 then + option_.comment = option_.comment .. "〔扩C补充〕u" .. string.format("%X", code) .. " [14.0 2021]" + elseif code == 0x2B739 then + option_.comment = option_.comment .. "〔扩C补充〕u" .. string.format("%X", code) .. " [15.0 2022]" + elseif code >= 0x2B740 and code <= 0x2B81D then option_.comment = option_.comment .. "〔扩D〕u" .. string.format("%X", code) .. " [6.0 2010]" - elseif code == 40908 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [6.1 2012]" - elseif code >= 178208 and code <= 183969 then + elseif code >= 0x2B820 and code <= 0x2CEA1 then option_.comment = option_.comment .. "〔扩E〕u" .. string.format("%X", code) .. " [8.0 2015]" - elseif code >= 40909 and code <= 40917 then - option_.comment = option_.comment .. "〔急用〕u" .. string.format("%X", code) .. " [8.0 2015]" - elseif code >= 183984 and code <= 191456 then + elseif code >= 0x2CEB0 and code <= 0x2EBE0 then option_.comment = option_.comment .. "〔扩F〕u" .. string.format("%X", code) .. " [10.0 2017]" - elseif code >= 40918 and code <= 40938 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [10.0 2017]" - elseif code >= 40939 and code <= 40943 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [11.0 2018]" - elseif code >= 196608 and code <= 201546 then + elseif code >= 0x30000 and code <= 0x3134A then option_.comment = option_.comment .. "〔扩G〕u" .. string.format("%X", code) .. " [13.0 2020]" - elseif code >= 40944 and code <= 40956 then - option_.comment = option_.comment .. "〔急用〕u" .. string.format("%X", code) .. " [13.0 2020]" - elseif code >= 19894 and code <= 19903 then - option_.comment = option_.comment .. "〔增改〕u" .. string.format("%X", code) .. " [13.0 2020]" - elseif code >= 173783 and code <= 173789 then - option_.comment = option_.comment .. "〔工尺〕u" .. string.format("%X", code) .. " [13.0 2020]" - elseif code >= 40957 and code <= 40959 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [14.0 2021]" - elseif code == 173790 or code == 173791 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [14.0 2021]" - elseif code >= 177973 and code <= 177976 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [14.0 2021]" - elseif code >= 201552 and code <= 205743 then + elseif code >= 0x31350 and code <= 0x323AF then option_.comment = option_.comment .. "〔扩H〕u" .. string.format("%X", code) .. " [15.0 2022]" - elseif code == 177977 then - option_.comment = option_.comment .. "〔增补〕u" .. string.format("%X", code) .. " [15.0 2022]" - elseif code >= 191472 and code <= 192093 then + elseif code >= 0x2EBF0 and code <= 0x2EE5D then option_.comment = option_.comment .. "〔扩I〕u" .. string.format("%X", code) .. " [15.1 2023]" + elseif code >= 0x2E80 and code <= 0x2EF3 then + option_.comment = option_.comment .. "〔部首补充〕u" .. string.format("%X", code) .. " [3.0 2000]" + elseif code >= 0x2F00 and code <= 0x2FD5 then + option_.comment = option_.comment .. "〔康熙部首〕u" .. string.format("%X", code) .. " [3.0 2000]" + elseif code >= 0xF900 and code <= 0xFAFF then + option_.comment = option_.comment .. "〔CJK兼容〕u" .. string.format("%X", code) .. "" + elseif code >= 0x2F800 and code <= 0x2FA1F then + option_.comment = option_.comment .. "〔兼容补充〕u" .. string.format("%X", code) .. " [3.1 2001]" + elseif code >= 0x31C0 and code <= 0x31EF then + option_.comment = option_.comment .. "〔CJK笔画〕u" .. string.format("%X", code) .. "" + elseif code >= 0x2FF0 and code <= 0x2FFF or code == 0x31EF then + option_.comment = option_.comment .. "〔表意文字描述〕u" .. string.format("%X", code) .. "" + elseif code >= 0x3105 and code <= 0x312F then + option_.comment = option_.comment .. "〔注音符号〕u" .. string.format("%X", code) .. "" + elseif code >= 0x31A0 and code <= 0x31BF then + option_.comment = option_.comment .. "〔注音扩展〕u" .. string.format("%X", code) .. "" + elseif code >= 0x3000 and code <= 0x303F then + option_.comment = option_.comment .. "〔标点符号〕u" .. string.format("%X", code) .. "" end end yield(option_)