local U = mw.ustring.char
local virAma = U(0x0DCA)
local s1con = 'කඛගඝඞචඡජඣඤටඨඩඪණතථදධනපඵබභමයරලවළශෂසහ' -- Basic consonants
local s2con = s1con .. 'ඥඟඦඬඳඹ' -- Add in single characters composed of 2 SLP1 characters.
local repha_source = 'ර්()'
local pattern1 = '()'..virAma..'()'
local pattern2 = '()'..virAma..'()'
local liga = U(0x0DCA, 0x200D) -- 'Conjuncts' in Unicode-speak
local abut = U(0x200D, 0x0DCA) -- Make touching consonants
local conj = {
-- = 'ඟ', = 'ඦ', = 'ඬ', = 'ඳ', = 'ඹ', -- prenasalised in Sinhalese
= 'ඥ', -- jñ
--Shared with Pali:
= 'ක්ව', -- kv
= 'ත්ථ', -- tth
= 'ත්ව', -- tv
= 'න්ථ', -- nth
= 'න්ද', -- nd.
= 'න්ධ', -- ndh
= 'න්ව', -- nv
-- Similar
= 'ක්ෂ', --kṣ
= 'ග්ධ', -- ɡdh
-- Using sanyaka and not listed above
= 'ඤ්ච', -- ñc
= 'ඤ්ඡ', -- ñch -- ill-supported.
= 'ට්ඨ', -- ṭṭh
-- = 'ද්ධ', -- ddh -- Minority taste.
= 'ද්ව', -- dv
}
local function select(a, b)
local merged = conj
return merged or a..abut..b
end
local fixes = {
{'ය්ය', 'ය්ය'}, -- Pairs of ය touch Triple ය does not occur.
{virAma..'()', liga..'%1'}, -- ය and ර ligate with preceding.
{repha_source, 'ර'..liga..'%1'}, -- Form repha.
{pattern1, select},
{pattern2, select},
}
return fixes