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

-- Formes irregulars dels verbs -néixer, -nàixer i péixer, excepte -conéixer
local export = {}

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 radicalE = mw.ustring.gsub(forma.inf, "[éà]ixer$", "e")
	local radicalA = radicalE:gsub("e$", "a")
	
	forma.part[1]["m-s"] = radicalA .. "scut"
	forma.part[1]["f-s"] = radicalA .. "scuda"
	forma.part[1]["m-p"] = radicalA .. "scuts"
	forma.part[1]["f-p"] = radicalA .. "scudes"
	if radicalA == "na" then
		forma.part[2] = {}
		forma.part[2]["m-s"] = radicalA .. "t"
		forma.part[2]["f-s"] = radicalA .. "da"
		forma.part[2]["m-p"] = radicalA .. "ts"
		forma.part[2]["f-p"] = radicalA .. "des"
	end
	
	forma["pres-ind"][1] = {}
	if zona.centr then
		forma["pres-ind"][1][1] = radicalE .. "ixo"
	end
	if zona.centr or zona.bal or zona.septr then
		forma["pres-ind"][1][2] = radicalE .. "ixes"
		forma["pres-ind"][1][3] = radicalE .. "ix"
		forma["pres-ind"][1][6] = radicalE .. "ixen"
	end
	forma["pres-ind"][1][4] = radicalA .. "ixem"
	forma["pres-ind"][1][5] = radicalA .. "ixeu"

	local fila = 2
	if zona.bal then
		forma["pres-ind"][2] = {}
		forma["pres-ind"][2][1] = radicalE .. "sc"
		forma["pres-ind"][2]["nota"] = "bal"
		forma["pres-ind"][3] = {}
		forma["pres-ind"][3][1] = radicalE .. "ix"
		forma["pres-ind"][3]["nota"] = "bal"
		fila = 4
	end
	if zona.sept then
		forma["pres-ind"][fila] = {}
		forma["pres-ind"][fila][1] = radicalE .. "ixi"
		forma["pres-ind"][fila]["nota"] = "sept"
		fila = fila + 1
	end
	if zona.occ or zona.alg then
		forma["pres-ind"][fila] = {}
		forma["pres-ind"][fila][2] = radicalA .. "ixes"
		forma["pres-ind"][fila][3] = radicalA .. "ix"
		forma["pres-ind"][fila][6] = radicalA .. "ixen"
		if zona.nocc then
			forma["pres-ind"][fila][1] = radicalA .. "ixo"
		end
		fila = fila + 1
	end
	if zona.val then
		forma["pres-ind"][fila] = {}
		forma["pres-ind"][fila][1] = radicalA .. "sc"
		forma["pres-ind"][fila]["nota"] = "val"
		fila = fila + 1
	end
	if zona.alg then
		forma["pres-ind"][fila] = {}
		forma["pres-ind"][fila][1] = radicalA .. "ix"
		forma["pres-ind"][fila]["nota"] = "alg"
	end
	
	forma.pass[2] = {}
	forma.pass[2][1] = radicalA .. "squí"
	forma.pass[2][2] = radicalA .. "squeres"
	forma.pass[2][3] = radicalA .. "squé"
	forma.pass[2][4] = radicalA .. "squérem"
	forma.pass[2][5] = radicalA .. "squéreu"
	forma.pass[2][6] = radicalA .. "squeren"
	
	forma["pres-subj"][1] = {}
	if zona.centr or zona.sept then
		forma["pres-subj"][1][1] = radicalE .. "ixi"
		forma["pres-subj"][1][2] = radicalE .. "ixis"
		forma["pres-subj"][1][3] = radicalE .. "ixi"
		forma["pres-subj"][1][6] = radicalE .. "ixin"
	end
	forma["pres-subj"][1][4] = radicalA .. "ixem"
	forma["pres-subj"][1][5] = radicalA .. "ixeu"
	
	forma["pres-subj"][2] = {}
	forma["pres-subj"][2][4] = radicalA .. "squem"
	forma["pres-subj"][2][5] = radicalA .. "squeu"
	
	fila = 3
	if zona.bal then
		forma["pres-subj"][fila] = {}
		forma["pres-subj"][fila][1] = radicalE .. "squi"
		forma["pres-subj"][fila][2] = radicalE .. "squis"
		forma["pres-subj"][fila][3] = radicalE .. "squi"
		forma["pres-subj"][fila][6] = radicalE .. "squin"
		forma["pres-subj"][fila]["nota"] = "bal"
		fila = fila + 1
	end
	
	if zona.occ then
		forma["pres-subj"][fila] = {}
		forma["pres-subj"][fila][1] = radicalA .. "sca"
		forma["pres-subj"][fila][2] = radicalA .. "sques"
		forma["pres-subj"][fila][3] = radicalA .. "sca"
		forma["pres-subj"][fila][6] = radicalA .. "squen"
		forma["pres-subj"][fila]["nota"] = "occ"
		fila = fila + 1
	end
	if zona.nocc or zona.alg then
		forma["pres-subj"][fila] = {}
		forma["pres-subj"][fila][1] = radicalA .. "ixi"
		forma["pres-subj"][fila][2] = radicalA .. "ixis"
		forma["pres-subj"][fila][3] = radicalA .. "ixi"
		forma["pres-subj"][fila][6] = radicalA .. "ixin"
		forma["pres-subj"][fila]["nota"] = llista_zones({"n-occ", "alg"}, zona)
	end
	
	forma["imperf-subj"][2][1] = radicalA .. "squés"
	forma["imperf-subj"][2][2] = radicalA .. "squessis"
	forma["imperf-subj"][2][3] = radicalA .. "squés"
	forma["imperf-subj"][2][4] = radicalA .. "squéssim"
	forma["imperf-subj"][2][5] = radicalA .. "squéssiu"
	forma["imperf-subj"][2][6] = radicalA .. "squessin"
	
	forma["imperf-subj"][3] = {}
	forma["imperf-subj"][3][2] = radicalA .. "squesses"
	forma["imperf-subj"][3][4] = radicalA .. "squéssem"
	forma["imperf-subj"][3][5] = radicalA .. "squésseu"
	forma["imperf-subj"][3][6] = radicalA .. "squessen"
	
	if zona.val then
		forma["imperf-subj"][4] = {}
		forma["imperf-subj"][4][1] = radicalA .. "squera"
		forma["imperf-subj"][4][2] = radicalA .. "squeres"
		forma["imperf-subj"][4][3] = radicalA .. "squera"
		forma["imperf-subj"][4][4] = radicalA .. "squérem"
		forma["imperf-subj"][4][5] = radicalA .. "squéreu"
		forma["imperf-subj"][4][6] = radicalA .. "squeren"
		forma["imperf-subj"][4]["nota"] = "val"
	end
	
	forma.imp[1] = {}
	if zona.sept or zona.centr or zona.bal then
		forma.imp[1][2] = radicalE .. "ix"
		forma.imp[1][3] = radicalE .. "ixi"
		forma.imp[1][6] = radicalE .. "ixin"
	end
	forma.imp[1][4] = radicalA .. "ixem"
	forma.imp[1][5] = radicalA .. "ixeu"
	forma.imp[2] = {}
	if zona.occ or zona.alg then
		forma.imp[2][2] = radicalA .. "ix"
		forma.imp[2][3] = radicalA .. "sca"
		forma.imp[2][6] = radicalA .. "squen"
	end
	forma.imp[2][4] = radicalA .. "squem"
	
	if zona.alt and (zona.centr or zona.sept) then
		forma["no-part"] = {}
		forma["no-part"]["m-s"] = radicalE .. "ixut"
		forma["no-part"]["f-s"] = radicalE .. "ixuda"
		forma["no-part"]["m-p"] = radicalE .. "ixuts"
		forma["no-part"]["f-p"] = radicalE .. "ixudes"
		forma["no-part"]["nota"] = llista_zones({"centr", "sept"}, zona)
	end
		
	forma["no-pres-ind"] = nil
	
	if zona.alg then
		forma["no-cond"] = {}
		forma["no-cond"][1] = {}
		forma["no-cond"][1][1] = radicalA .. "ixeriva"
		forma["no-cond"][1][2] = radicalA .. "ixerives"
		forma["no-cond"][1][3] = radicalA .. "ixeriva"
		forma["no-cond"][1][4] = radicalA .. "ixerivem"
		forma["no-cond"][1][5] = radicalA .. "ixeriveu"
		forma["no-cond"][1][6] = radicalA .. "ixeriven"
		forma["no-cond"][1]["nota"] = "alg"
	end
	
	forma["no-pres-subj"] = nil
	
	if zona.alg then
		forma["no-imperf-subj"][1]["nota"] = "alg"
	elseif zona.alt then
		forma["no-imperf-subj"][1] = nil
	end
		
	if zona.alt and zona.nocc then
		forma["no-imperf-subj"][2]["nota"] = "n-occ"
	elseif zona.alt then
		forma["no-imperf-subj"][2] = nil
	end
	
	if zona.alt then
		forma["no-imperf-subj"][3] = nil
	end
	
	return forma
end

return export