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