diff --git a/markdown.dtx b/markdown.dtx index 6f3df3fa..f4ac3f86 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -26630,6 +26630,12 @@ parsers.punctuation = {} [[Could not locate file "UnicodeData.txt"]]) local file = assert(io.open(pathname, "r"), [[Could not open file "UnicodeData.txt"]]) + local output = { + [1] = assert(io.open("parsers.punctuation.1.txt", "w")), + [2] = assert(io.open("parsers.punctuation.2.txt", "w")), + [3] = assert(io.open("parsers.punctuation.3.txt", "w")), + [4] = assert(io.open("parsers.punctuation.4.txt", "w")), + } for line in file:lines() do local codepoint, major_category = line:match("^(%x+);[^;]*;(%a)") if major_category == "P" or major_category == "S" then @@ -26638,14 +26644,19 @@ parsers.punctuation = {} parsers.punctuation[#code] = parsers.fail end local code_parser = parsers.succeed + local code_parser_text = string.format("U+%04X", tonumber(codepoint, 16)) + .. " = parsers.succeed" for i = 1, #code do local byte = code:sub(i, i) local byte_parser = S(byte) code_parser = code_parser * byte_parser + code_parser_text = code_parser_text + .. " * S(" .. string.format("%02X", byte:byte()) .. ")" end parsers.punctuation[#code] = parsers.punctuation[#code] + code_parser + output[#code]:write(code_parser_text .. "\n") end end assert(file:close())