La documentació d'ús d'aquest mòdul es pot crear a Mòdul:ca-verb/fer/ús

-- Formes irregulars del verb fer i compostos -fer.
local export = {}

local function llista_zones(llista, zona)
	local zones = {}
	for k, v in pairs(llista) do
		if zona[v == "or" and "ori" or v == "n-occ" and "nocc" or v] then
			table.insert(zones, v)
		end
	end
	return #zones > 3 and "" or table.concat(zones, ", ")
end

function export.make_irregulars(forma, zona)
	local radical = forma.inf:gsub("fer$", "f")
	local monosil = radical == "f"
	
	forma.part[1]["m-s"] = radical .. "et"
	forma.part[1]["f-s"] = radical .. "eta"
	forma.part[1]["m-p"] = radical .. "ets"
	forma.part[1]["f-p"] = radical .. "etes"

	forma["pres-ind"][1][1] = radical .. "aig"
	forma["pres-ind"][1][2] = radical .. (monosil and "as" or "às")
	forma["pres-ind"][1][3] = radical .. (monosil and "a" or "à")
	forma["pres-ind"][1][6] = radical .. "an"
	
	forma["pres-ind"][2] = nil
	forma["pres-ind"][3] = nil
	fila = 2
	if zona.val or zona.bal or zona.alg then
		forma["pres-ind"][2] = {}
		forma["pres-ind"][2][1] = radical .. "aç"
		forma["pres-ind"][2]["nota"] = llista_zones({"val", "bal", "alg"}, zona)
		fila = 3
	end
	if zona.bal then
		forma["pres-ind"][fila] = {}
		forma["pres-ind"][fila][4] = radical .. "eim"
		forma["pres-ind"][fila][5] = radical .. "eis"
		forma["pres-ind"][fila]["nota"] = "bal"
	end
	
	forma["imperf-ind"][1][1] = radical .. "eia"
	forma["imperf-ind"][1][2] = radical .. "eies"
	forma["imperf-ind"][1][3] = radical .. "eia"
	forma["imperf-ind"][1][4] = radical .. "èiem"
	forma["imperf-ind"][1][5] = radical .. "èieu"
	forma["imperf-ind"][1][6] = radical .. "eien"
	if zona.val then
		forma["imperf-ind"][2] = {}
		forma["imperf-ind"][2][4] = radical .. "éiem"
		forma["imperf-ind"][2][5] = radical .. "éieu"
		forma["imperf-ind"][2]["nota"] = "val"
	end
	
	forma.pass[1][1] = radical .. "iu"
	forma.pass[1][3] = radical .. (monosil and "eu" or "éu")

	if zona.bal then
		forma.pass[2] = {}
		forma.pass[2][3] = radical .. (monosil and "e" or "é")
		forma.pass[2]["nota"] = "bal"
	end
	
	forma.fut[1][1] = radical .. "aré"
	forma.fut[1][2] = radical .. "aràs"
	forma.fut[1][3] = radical .. "arà"
	forma.fut[1][4] = radical .. "arem"
	forma.fut[1][5] = radical .. "areu"
	forma.fut[1][6] = radical .. "aran"
	
	forma.cond[1][1] = radical .. "aria"
	forma.cond[1][2] = radical .. "aries"
	forma.cond[1][3] = radical .. "aria"
	forma.cond[1][4] = radical .. "aríem"
	forma.cond[1][5] = radical .. "aríeu"
	forma.cond[1][6] = radical .. "arien"
	
	forma["pres-subj"][1][1] = radical .. "aci"
	forma["pres-subj"][1][2] = radical .. "acis"
	forma["pres-subj"][1][3] = radical .. "aci"
	forma["pres-subj"][1][6] = radical .. "acin"
	
	forma["pres-subj"][2] = {}
	forma["pres-subj"][2][1] = radical .. "aça"
	forma["pres-subj"][2][2] = radical .. "aces"
	forma["pres-subj"][2][3] = radical .. "aça"
	forma["pres-subj"][2][6] = radical .. "acen"

	if zona.bal or zona.alg then
		forma["pres-subj"][3] = {}
		forma["pres-subj"][3][4] = radical .. "acem"
		forma["pres-subj"][3][5] = radical .. "aceu"
		forma["pres-subj"][3]["nota"] = llista_zones({"bal", "alg"}, zona)
	end
	
	forma["imperf-subj"][1][1] = radical .. (monosil and "es" or "és")
	forma["imperf-subj"][1][3] = radical .. (monosil and "es" or "és")

	forma.imp[1][2] = radical .. (monosil and "es" or "és")
	forma.imp[1][3] = radical .. "aci"
	forma.imp[1][6] = radical .. "acin"
	
	forma.imp[2] = {}
	forma.imp[2][3] = radical .. "aça"
	forma.imp[2][6] = radical .. "acen"

	if zona.bal then
		forma.imp[3] = {}
		forma.imp[3][2] = radical .. (monosil and "e" or "é")
		forma.imp[3][4] = radical .. "acem"
		forma.imp[3][5] = radical .. "eis"
		forma.imp[fila]["nota"] = "bal"
	end
	
	forma["no-pres-ind"] = nil
	
	if (zona.nocc and zona.alt) or zona.alg then
		forma["no-imperf-ind"] = {}
		forma["no-imperf-ind"][1] = {}
		forma["no-imperf-ind"][1][1] = radical .. "eva"
		forma["no-imperf-ind"][1][2] = radical .. "eves"
		forma["no-imperf-ind"][1][3] = radical .. "eva"
		forma["no-imperf-ind"][1][4] = radical .. "évem"
		forma["no-imperf-ind"][1][5] = radical .. "éveu"
		forma["no-imperf-ind"][1][6] = radical .. "even"
		forma["no-imperf-ind"][1]["nota"] = llista_zones({"n-occ", "alg"}, zona)
	end
	
	if zona.alg then
		forma["no-cond"] = {}
		forma["no-cond"][1] = {}
		forma["no-cond"][1][1] = radical .. "ariva"
		forma["no-cond"][1][2] = radical .. "arives"
		forma["no-cond"][1][3] = radical .. "ariva"
		forma["no-cond"][1][4] = radical .. "arívem"
		forma["no-cond"][1][5] = radical .. "aríveu"
		forma["no-cond"][1][6] = radical .. "ariven"
		forma["no-cond"][1]["nota"] = "alg"
	end
	
	forma["no-pres-subj"] = nil
	
	fila = 1
	if zona.alt and (zona.sept or zona.centr or zona.nocc or zona.bal) then
		forma["no-imperf-subj"] = {}
		forma["no-imperf-subj"][1] = {}
		forma["no-imperf-subj"][1][1] = radical .. "acés"
		forma["no-imperf-subj"][1][3] = radical .. "acés"
		forma["no-imperf-subj"][1]["nota"] = llista_zones({"sept", "centr", "n-occ", "bal"}, zona)
		fila = 2
	end
	
	if zona.alg then
		forma["no-imperf-subj"][fila] = {}
		forma["no-imperf-subj"][fila][1] = radical .. "acessi"
		forma["no-imperf-subj"][fila][3] = radical .. "acessi"
		forma["no-imperf-subj"][fila]["nota"] = "alg"
		fila = fila + 1
	end
	
	if (zona.alt and (zona.sept or zona.centr or zona.bal)) or zona.alg then
		forma["no-imperf-subj"][fila] = {}
		forma["no-imperf-subj"][fila][2] = radical .. "acessis"
		forma["no-imperf-subj"][fila][4] = radical .. "acéssim"
		forma["no-imperf-subj"][fila][5] = radical .. "acéssiu"
		forma["no-imperf-subj"][fila][6] = radical .. "acessin"
		forma["no-imperf-subj"][fila]["nota"] = llista_zones({"sept", "centr", "bal", "alg"}, zona)
		fila = fila + 1
	end
	
	if zona.nocc and zona.alt then
		forma["no-imperf-subj"][fila] = {}
		forma["no-imperf-subj"][fila][1] = radical .. "essa"
		forma["no-imperf-subj"][fila][4] = radical .. "éssom"
		forma["no-imperf-subj"][fila][5] = radical .. "éssou"
		forma["no-imperf-subj"][fila]["nota"] = "n-occ"
	end
	
	return forma
end

return export