Module:User:Rua

local m_debug = require("Module:debug")

local export = {}

local scons = { [1] = {		{"^[bdđfghjlmnŋprsšŧvzž]$"}, {"^nj$"}, },	[2] = {		{"^dj$", "j", "ddj"}, {"^([đflmnŋrsšŧv])%1$", "%1", "%1ˈ%1"}, {"^hc$", "z", "hcc"}, {"^hč$", "ž", "hčč"}, {"^hk$", "g", "hkk"}, {"^hp$", "b", "hpp"}, {"^ht$", "đ", "htt"}, {"^h([jlmnr])%1$", "h%1", "h%1ˈ%1"}, {"^kŋ$", "ŋ", "gŋ"}, {"^pm$", "m", "bm"}, {"^tn(j?)$", "n%1", "dn%1"}, {"^nnj$", "nj", "nˈnj"}, {"^cc$"}, {"^čč$"}, {"^pp$"}, {"^tt$"}, {"^lj$"}, {"^i([bdgmnŋpsv])%1$"}, {"^l([bčdgkmŋv])%1$"}, {"^lstt$"}, {"^n([c])%1$"}, {"^ŋ([k])%1$"}, {"^s([kt])%1$"}, {"^r([bdgjkv])%1$"}, {"^rpm$"}, {"^rtn$"}, {"^t([k])%1$"}, {"^v([cčdgklnprst])%1$"}, {"^vnnj$"}, },	[3] = {		{"^bb$", "pp"}, {"^dd$", "tt"}, {"^gg$", "kk"}, {"^zz$", "cc"}, {"^žž$", "čč"}, {"^bm$", "pm"}, {"^dn(j?)$", "tn%1"}, {"^gŋ$", "kŋ"}, {"^([dl])%1j$", "%1j"}, {"^([đflmnŋrsšŧv])ˈ%1$", "%1%1"}, {"^h([cčkpt])%1$", "h%1"}, {"^h([jlmnr])ˈ%1$", "h%1%1"}, {"^nˈnj$", "nnj"}, -- Clusters {"^lˈj$", "ljj"}, {"^rbm$", "rpm"}, {"^rdn$", "rtn"}, {"^rdnj$", "rtnj"}, {"^rgŋ$", "rkŋ"}, {"^k(.*)(.)$", "v%1%2%2"}, {"(.)bm$", "%1mm"}, {"(.)dn(j?)$", "%1nn%2"}, {"(.)gŋ$", "%1ŋŋ"}, --{"(.)(.)$", "%1%2%2"},		{"^đ([bgjv])$", "i%1%1"}, {"^i([bcdgklprstv])$", "i%1%1"}, {"^ih([mn])$", "ih%1%1"}, {"^is([kmt])$", "is%1%1"}, {"^l([bcčdfgkpstv])$", "l%1%1"}, {"^ls([t])$", "ls%1%1"}, {"^m([bpsš])$", "m%1%1"}, {"^n([cčdsštzž])$", "n%1%1"}, {"^ŋ([gk])$", "ŋ%1%1"}, {"^p([t])$", "r%1%1"}, {"^r([bcčdfgjkpsštv])$", "r%1%1"}, {"^rs([k])$", "rs%1%1"}, {"^s([bfkmptv])$", "s%1%1"}, {"^š([kmpt])$", "s%1%1"}, {"^t([km])$", "t%1%1"}, {"^v([dgjklprstzž])$", "v%1%1"}, {"^vh([l])$", "vh%1%1"}, {"^ij$"}, {"^lfr$"}, }, }

function export.test(frame) for _, pattern in ipairs(scons[2]) do		if pattern[2] then local i = 1 local newpattern = pattern[2] if pattern[1]:sub(1, 1) == "^" then newpattern = "^" .. newpattern end if pattern[1]:sub(-1) == "$" then newpattern = newpattern .. "$"			end for match in mw.ustring.gmatch(pattern[1], "%([^]+%)") do newpattern = mw.ustring.gsub(newpattern, "%%" .. i, match, 1) i = i + 1 end table.insert(scons[1], {newpattern}) end end return require("Module:debug").dump(scons[1]) end

return export