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