60c256f91b 2024-06-27 1: --~ package.path = [[.\dfns_jvwg_ysaf\?.lua;]] .. package.path
60c256f91b 2024-06-27 2: --~ package.cpath = [[.\dfns_jvwg_ysaf\?.dll;]] .. package.cpath
60c256f91b 2024-06-27 3: local 字集码互转库 = require("u8_to_a")
60c256f91b 2024-06-27 4: local d_5 = {}
60c256f91b 2024-06-27 5: --~ function _G.历排(o1_11, u1, u2, u3, u4)
60c256f91b 2024-06-27 6: --~ local k1_8
60c256f91b 2024-06-27 7: --~ local k1_11
60c256f91b 2024-06-27 8: --~ k1_11 = {}
60c256f91b 2024-06-27 9: --~ for u5 = 1, #o1_11 do
60c256f91b 2024-06-27 10: --~ k1_8 = u1(o1_11[u5], u2, u3, u4)
60c256f91b 2024-06-27 11: --~ if k1_8 then
60c256f91b 2024-06-27 12: --~ k1_11[#k1_11 + 1] = k1_8
60c256f91b 2024-06-27 13: --~ end
60c256f91b 2024-06-27 14: --~ end
60c256f91b 2024-06-27 15: --~ return k1_11
60c256f91b 2024-06-27 16: --~ end
60c256f91b 2024-06-27 17: --~ function _G.历文(u1, u2, u3, u4)
60c256f91b 2024-06-27 18: --~ local k1_9
60c256f91b 2024-06-27 19: --~ k1_9 = {}
60c256f91b 2024-06-27 20: --~ for u5 in u2(u1, u3, u4) do
60c256f91b 2024-06-27 21: --~ k1_9[#k1_9 + 1] = u5
60c256f91b 2024-06-27 22: --~ end
60c256f91b 2024-06-27 23: --~ return k1_9
60c256f91b 2024-06-27 24: --~ end
60c256f91b 2024-06-27 25: --~ local 简件系库 = require("lfs")
60c256f91b 2024-06-27 26: --~ require(字集码互转库.u8_to_a("程语_月_基类_字串_内置库_加多"))
60c256f91b 2024-06-27 27: --~ 程语_月_标准库_仿照_加多_多编码_大字集_通用
60c256f91b 2024-06-27 28: function d_5.导入库_通用大字集态_八位态(modname)
60c256f91b 2024-06-27 29: return require(字集码互转库.u8_to_a(modname))
60c256f91b 2024-06-27 30: end
60c256f91b 2024-06-27 31: --~ local
60c256f91b 2024-06-27 32: do
60c256f91b 2024-06-27 33: local h1 = 0
60c256f91b 2024-06-27 34: function _G.递增示()
60c256f91b 2024-06-27 35: h1 = h1 + 1
60c256f91b 2024-06-27 36: print(h1)
60c256f91b 2024-06-27 37: end
60c256f91b 2024-06-27 38: end
60c256f91b 2024-06-27 39: --~ do
60c256f91b 2024-06-27 40: --~ local h1 = os.execute
60c256f91b 2024-06-27 41: --~ function _G.os.execute(command)
60c256f91b 2024-06-27 42: --~ return h1(字集码互转库.u2a(command))
60c256f91b 2024-06-27 43: --~ end
60c256f91b 2024-06-27 44: --~ end
60c256f91b 2024-06-27 45: function d_5.读件(u1, u2)
60c256f91b 2024-06-27 46: local h1
60c256f91b 2024-06-27 47: local k1_3
60c256f91b 2024-06-27 48: k1_3 = io.open(u1, u2 or "r")
60c256f91b 2024-06-27 49: h1 = k1_3:read("a")
60c256f91b 2024-06-27 50: k1_3:flush()
60c256f91b 2024-06-27 51: k1_3:close()
60c256f91b 2024-06-27 52: return h1
60c256f91b 2024-06-27 53: end
60c256f91b 2024-06-27 54: function d_5.读件排(o1_9, u1)
60c256f91b 2024-06-27 55: local k1_9
60c256f91b 2024-06-27 56: k1_9 = {}
60c256f91b 2024-06-27 57: for u2 = 1, #o1_9 do
60c256f91b 2024-06-27 58: k1_9[#k1_9 + 1] = d_5.读件(o1_9[u2], u1)
60c256f91b 2024-06-27 59: end
60c256f91b 2024-06-27 60: return k1_9
60c256f91b 2024-06-27 61: end
60c256f91b 2024-06-27 62: function d_5.写件(u1, u2, u3)
60c256f91b 2024-06-27 63: local k1_3
60c256f91b 2024-06-27 64: k1_3 = io.open(u1, u3 or "w")
60c256f91b 2024-06-27 65: k1_3:write(u2)
60c256f91b 2024-06-27 66: k1_3:flush()
60c256f91b 2024-06-27 67: k1_3:close()
60c256f91b 2024-06-27 68: end
60c256f91b 2024-06-27 69: function d_5.写件_一维(u1, o1_9, u2, u3)
60c256f91b 2024-06-27 70: local h1 = table.concat(o1_9, "\n")
60c256f91b 2024-06-27 71: if u3 then
60c256f91b 2024-06-27 72: h1 = u3(h1)
60c256f91b 2024-06-27 73: end
60c256f91b 2024-06-27 74: d_5.写件(u1, h1, u2)
60c256f91b 2024-06-27 75: end
60c256f91b 2024-06-27 76: function d_5.删制表符(u1)
60c256f91b 2024-06-27 77: return u1:gsub("\t", "")
60c256f91b 2024-06-27 78: end
60c256f91b 2024-06-27 79: --~ function d_5.删空白字(u1)
60c256f91b 2024-06-27 80: --~ return u1:gsub("%s", "")
60c256f91b 2024-06-27 81: --~ end
60c256f91b 2024-06-27 82: --~ function d_5.删空格与制表符(u1)
60c256f91b 2024-06-27 83: --~ u1 = d_5.删空格(u1)
60c256f91b 2024-06-27 84: --~ return d_5.删制表符(u1)
60c256f91b 2024-06-27 85: --~ end
60c256f91b 2024-06-27 86: function d_5.文转排(text)
60c256f91b 2024-06-27 87: local lines = {}
60c256f91b 2024-06-27 88: for line in text:gmatch("[^\n]+") do
60c256f91b 2024-06-27 89: table.insert(lines, line)
60c256f91b 2024-06-27 90: end
60c256f91b 2024-06-27 91: return lines
60c256f91b 2024-06-27 92: end
60c256f91b 2024-06-27 93: --~ function d_5.删前缀(u1, u2)
60c256f91b 2024-06-27 94: --~ if u1:find(u2, 1, true) then
60c256f91b 2024-06-27 95: --~ return u1:sub(#u2 + 1)
60c256f91b 2024-06-27 96: --~ end
60c256f91b 2024-06-27 97: --~ end
60c256f91b 2024-06-27 98: --~ function d_5.删后缀(u1, u2)
60c256f91b 2024-06-27 99: --~ if u1:find(u2, -1, true) then
60c256f91b 2024-06-27 100: --~ return u1:sub(1, #u1 - #u2)
60c256f91b 2024-06-27 101: --~ end
60c256f91b 2024-06-27 102: --~ end
60c256f91b 2024-06-27 103: --~ function d_5.删空行_不虑首末态(u1)
60c256f91b 2024-06-27 104: --~ return u1:gsub("\n+", "\n")
60c256f91b 2024-06-27 105: --~ end
60c256f91b 2024-06-27 106: --~ function d_5.删空行(u1)
60c256f91b 2024-06-27 107: --~ u1 = d_5.删空行_不虑首末态(u1)
60c256f91b 2024-06-27 108: --~ u1 = d_5.删前缀(u1, "\n")
60c256f91b 2024-06-27 109: --~ return d_5.删后缀(u1, "\n")
60c256f91b 2024-06-27 110: --~ end
60c256f91b 2024-06-27 111: function d_5.删空格(u1)
60c256f91b 2024-06-27 112: return u1:gsub(" ", "")
60c256f91b 2024-06-27 113: end
60c256f91b 2024-06-27 114: function d_5.筛排(o1_9, u1, u2, u3)
60c256f91b 2024-06-27 115: local k1_8
60c256f91b 2024-06-27 116: local k1_9
60c256f91b 2024-06-27 117: k1_9 = {}
60c256f91b 2024-06-27 118: for u4 = 1, #o1_9 do
60c256f91b 2024-06-27 119: k1_8 = u1(o1_9[u4], u2, u3)
60c256f91b 2024-06-27 120: if k1_8 then
60c256f91b 2024-06-27 121: k1_9[#k1_9 + 1] = k1_8
60c256f91b 2024-06-27 122: end
60c256f91b 2024-06-27 123: end
60c256f91b 2024-06-27 124: return k1_9
60c256f91b 2024-06-27 125: end
60c256f91b 2024-06-27 126: --~ function d_5.筛文(u1, u2, u3)
60c256f91b 2024-06-27 127: --~ local k1_9
60c256f91b 2024-06-27 128: --~ k1_9 = {}
60c256f91b 2024-06-27 129: --~ for u4 in u2(u1, u3) do
60c256f91b 2024-06-27 130: --~ k1_9[#k1_9 + 1] = u4
60c256f91b 2024-06-27 131: --~ end
60c256f91b 2024-06-27 132: --~ return k1_9
60c256f91b 2024-06-27 133: --~ end
60c256f91b 2024-06-27 134: --~ function d_5.判文(u1, u2, u3, u4)
60c256f91b 2024-06-27 135: --~ if u1:find(u2 or ".", u3, u4) then
60c256f91b 2024-06-27 136: --~ return u1
60c256f91b 2024-06-27 137: --~ end
60c256f91b 2024-06-27 138: --~ end
60c256f91b 2024-06-27 139: --~ function d_5.筛件径(u1, u2)
60c256f91b 2024-06-27 140: --~ local k1_9
60c256f91b 2024-06-27 141: --~ k1_9 = d_5.筛文(u1, 简件系库.dir)
60c256f91b 2024-06-27 142: --~ k1_9 = d_5.筛排(k1_9, d_5.加前缀, u1 .. "/")
60c256f91b 2024-06-27 143: --~ k1_9 = d_5.筛排(k1_9, d_5.判文, u2)
60c256f91b 2024-06-27 144: --~ return d_5.筛排(k1_9, d_5.在前后加英文双引号)
60c256f91b 2024-06-27 145: --~ end
60c256f91b 2024-06-27 146: --~ function d_5.筛单行等式(u1)
60c256f91b 2024-06-27 147: --~ return 常用库.捕排(string.gmatch, u1, "[^\n= \t]+")
60c256f91b 2024-06-27 148: --~ end
60c256f91b 2024-06-27 149: --~ function d_5.捕非空单行(u1)
60c256f91b 2024-06-27 150: --~ return 常用库.捕排(string.gmatch, u1, "[^\n]+[\n]?")
60c256f91b 2024-06-27 151: --~ end
60c256f91b 2024-06-27 152: --~ function d_5.捕非空单行(u1)
60c256f91b 2024-06-27 153: --~ return 常用库.捕排(string.gmatch, u1, "[^\n]+[\n]?")
60c256f91b 2024-06-27 154: --~ end
60c256f91b 2024-06-27 155: function d_5.排转对(o1_12, u1)
60c256f91b 2024-06-27 156: local k1_5
60c256f91b 2024-06-27 157: local k1_11
60c256f91b 2024-06-27 158: k1_11 = {}
60c256f91b 2024-06-27 159: for u2 = 1, #o1_12, u1 + 1 do
60c256f91b 2024-06-27 160: k1_5 = {}
60c256f91b 2024-06-27 161: for u3 = 1, u1 do
60c256f91b 2024-06-27 162: k1_5[u3] = o1_12[u2 + u3]
60c256f91b 2024-06-27 163: end
60c256f91b 2024-06-27 164: k1_11[o1_12[u2]] = k1_5
60c256f91b 2024-06-27 165: end
60c256f91b 2024-06-27 166: return k1_11
60c256f91b 2024-06-27 167: end
60c256f91b 2024-06-27 168: --~ function d_5.加前缀(u1, u2)
60c256f91b 2024-06-27 169: --~ return u2 .. u1
60c256f91b 2024-06-27 170: --~ end
60c256f91b 2024-06-27 171: --~ function d_5.加后缀(u1, u2)
60c256f91b 2024-06-27 172: --~ return u1 .. u2
60c256f91b 2024-06-27 173: --~ end
60c256f91b 2024-06-27 174: function d_5.filterLinesWithCharacter(text, character)
60c256f91b 2024-06-27 175: local result = {}
60c256f91b 2024-06-27 176: local lines = d_5.文转排(text)
60c256f91b 2024-06-27 177: -- 遍历每一行,检查是否包含目标字符
60c256f91b 2024-06-27 178: for i, line in ipairs(lines) do
60c256f91b 2024-06-27 179: if line:find(character, 1, true) then
60c256f91b 2024-06-27 180: table.insert(result, line)
60c256f91b 2024-06-27 181: end
60c256f91b 2024-06-27 182: end
60c256f91b 2024-06-27 183: return result
60c256f91b 2024-06-27 184: end
60c256f91b 2024-06-27 185: --~ function d_5.办令(u1)
60c256f91b 2024-06-27 186: --~ print(u1)
60c256f91b 2024-06-27 187: --~ os.execute(u1)
60c256f91b 2024-06-27 188: --~ end
60c256f91b 2024-06-27 189: --~ function d_5.在前后加英文双引号(u1)
60c256f91b 2024-06-27 190: --~ return [["]] .. u1 .. [["]]
60c256f91b 2024-06-27 191: --~ end
60c256f91b 2024-06-27 192: --~ function d_5.筛单行等式_左右值态(u1)
60c256f91b 2024-06-27 193: --~ local k1_11
60c256f91b 2024-06-27 194: --~ k1_11 = {}
60c256f91b 2024-06-27 195: --~ for u2 in k1_11:gmatch("[^\n= \t]+") do
60c256f91b 2024-06-27 196: --~ table.insert(k1_11, u2)
60c256f91b 2024-06-27 197: --~ end
60c256f91b 2024-06-27 198: --~ return u2
60c256f91b 2024-06-27 199: --~ end
60c256f91b 2024-06-27 200: return d_5
60c256f91b 2024-06-27 201: