This module is used to create inflection tables for Proto-Germanic verbs.


local m_utilities = require("Module:utilities")
local com = require("Module:gem-common")

local export = {}

local lang = require("Module:languages").getByCode("gem-pro")

-- Within this module, conjugations are the functions that do the actual
-- conjugating by creating the forms of a basic verb (not prefixed or
-- separable). They are defined further down.
local conjugations = {}

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
    local conj_type = frame.args[1] or error("Conjugation type has not been specified. Please pass parameter 1 to the module invocation.")
    local args = frame:getParent().args
    SUBPAGENAME = mw.title.getCurrentTitle().subpageText
    NAMESPACE = mw.title.getCurrentTitle().nsText
    
    local forms, title, categories
    
    if conjugations[conj_type] then
        forms, title, categories = conjugations[conj_type](args)
    else
        error("Unknown conjugation type '" .. conj_type .. "'")
    end
    
    return make_table(forms, title) .. m_utilities.format_categories(categories, lang)
end


--[=[
    *** STRONG VERBS ***
]=]--

-- Conjugate a strong verb
conjugations["strong"] = function(args)
    local forms = {}
    local class = args["class"] or ""; if class ~= "" then class = " class " .. class end
    local categories = {"Proto-Germanic" .. class .. " strong verbs"}
    local title = "strong" .. class
    
    local pres_stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    local past_sg_stem = args[2] or (NAMESPACE == "Template" and "(2)") or error("The second parameter is missing")
    local past_stem = args[3] or (NAMESPACE == "Template" and "(3)") or error("The third parameter is missing")
    local past_part_stem = args[4] or (NAMESPACE == "Template" and "(4)") or error("The fourth parameter is missing")
    local past_indc_stem = args["past_indc_stem"] or past_stem
    
    present_strong(forms, pres_stem)
    past_strong(forms, past_stem, past_sg_stem, past_indc_stem)
    forms["past_ptc"] = past_part_stem .. "anaz"
    
    return forms, title, categories
end

-- Conjugate a strong j-present verb
conjugations["strong-j"] = function(args)
    local forms = {}
    local class = args["class"] or ""; if class ~= "" then class = " class " .. class end
    local categories = {"Proto-Germanic" .. class .. " strong j-present verbs"}
    local title = "strong" .. class .. " j-present"
    
    local pres_stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    local past_sg_stem = args[2] or (NAMESPACE == "Template" and "(2)") or error("The second parameter is missing")
    local past_stem = args[3] or (NAMESPACE == "Template" and "(3)") or error("The third parameter is missing")
    local past_part_stem = args[4] or (NAMESPACE == "Template" and "(4)") or error("The fourth parameter is missing")
    local past_indc_stem = args["past_indc_stem"] or past_stem
    local j = args["j"] or (NAMESPACE == "Template" and "j") or error("The parameter j= is missing")
    
    present_weak1(forms, pres_stem, j)
    past_strong(forms, past_stem, past_sg_stem, past_indc_stem)
    forms["past_ptc"] = past_part_stem .. "anaz"
    
    return forms, title, categories
end

-- Conjugate a weak verb with no suffix
conjugations["weak-nosuff"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic suffixless weak verbs"}
    local title = "weak suffixless"
    
    local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    local past_stem = args[2]; if not past_stem or past_stem == "" then past_stem = stem .. "d" end
    
    present_strong(forms, stem)    
    past_weak(forms, past_stem)
    
    return forms, title, categories
end

-- Conjugate a weak class 1 verb
conjugations["weak1"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic class 1 weak verbs"}
    local title = "weak class 1"
    
    local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    local j = args["j"] or (NAMESPACE == "Template" and "j") or error("The parameter j= is missing")
    
    present_weak1(forms, stem, j)
    past_weak(forms, stem .. "id")
    
    return forms, title, categories
end

-- Conjugate a weak class 1 j-present verb
conjugations["weak1-j"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic class 1 weak j-present verbs"}
    local title = "weak class 1 j-present"
    
    local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    local j = args["j"] or (NAMESPACE == "Template" and "j") or error("The parameter j= is missing")
    
    present_weak1(forms, stem, j)    
    past_weak(forms, com.add_t(stem))
    forms["past_ptc"] = stem .. "idaz"
    
    return forms, title, categories
end

-- Conjugate a weak class 2 verb
conjugations["weak2"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic class 2 weak verbs"}
    local title = "weak class 2"
    
    local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    
    present_weak2(forms, stem)    
    past_weak(forms, stem .. "ōd")
    
    return forms, title, categories
end

-- Conjugate a weak class 3 verb
conjugations["weak3"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic class 3 weak verbs"}
    local title = "weak class 3"
    
    local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    
    present_weak3_a(forms, stem)
    past_weak(forms, stem .. "ad")
    
    return forms, title, categories
end

-- Conjugate a weak class 3 j-present verb
conjugations["weak3-j"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic class 3 weak j-present verbs"}
    local title = "weak class 3 j-present"
    
    local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    local j = args["j"] or (NAMESPACE == "Template" and "j") or error("The parameter j= is missing")
    
    present_weak3_ja(forms, stem, j)
    past_weak(forms, stem .. (j == "i" and "ī" or "") .. "d")
    
    return forms, title, categories
end

-- Conjugate a weak class 4 verb
conjugations["weak4"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic class 4 weak verbs"}
    local title = "weak class 4"
    
    local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    
    present_weak4(forms, stem)    
    past_weak(forms, stem .. "ōd")
    forms["past_ptc"] = ""
    
    return forms, title, categories
end

-- Conjugate a preterite-present verb
conjugations["pp"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic preterite-present verbs"}
    local title = "[[preterite-present verb|preterite-present]]"
    
    local pres_stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
    local pres_sg_stem = args[2] or (NAMESPACE == "Template" and "(2)") or error("The second parameter is missing")
    local past_stem = args[3] or (NAMESPACE == "Template" and "(3)") or error("The third parameter is missing")
    
    present_pp(forms, pres_stem, pres_sg_stem)
    past_weak(forms, past_stem)
    
    return forms, title, categories
end


--[=[
    *** IRREGULAR VERBS ***
]=]--

conjugations["aiganą"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs"}
    local title = "irregular"

    past_weak(forms, "aiht")
    forms["pres_ptc"] = "aigandz"
    forms["infinitive"] = "aiganą"
    forms["past_ptc"] = "aiganaz"
    
    -- Indicative
    forms["pres_indc_1sg"] = "aih"
    forms["pres_indc_2sg"] = "aiht"
    forms["pres_indc_3sg"] = "aih"
    forms["pres_indc_1du"] = "aigū"
    forms["pres_indc_2du"] = "aigudiz"
    forms["pres_indc_1pl"] = "aigum"
    forms["pres_indc_2pl"] = "aigud"
    forms["pres_indc_3pl"] = "aigun"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = "aigį̄"
    forms["pres_subj_2sg"] = "aigīz"
    forms["pres_subj_3sg"] = "aigī"
    forms["pres_subj_1du"] = "aigīw"
    forms["pres_subj_2du"] = "aigīdiz"
    forms["pres_subj_1pl"] = "aigīm"
    forms["pres_subj_2pl"] = "aigīd"
    forms["pres_subj_3pl"] = "aigīn"
    
    -- Imperative active
    forms["impr_1sg"] = ""
    forms["impr_2sg"] = ""
    forms["impr_3sg"] = ""
    forms["impr_1du"] = ""
    forms["impr_2du"] = ""
    forms["impr_1pl"] = ""
    forms["impr_2pl"] = ""
    forms["impr_3pl"] = ""
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""

    return forms, title, categories
end

conjugations["beuną"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs", "Proto-Germanic suppletive verbs"}
    local title = "irregular, suppletive"
    
    past_strong(forms, "wēz", "was")
    forms["infinitive"] = "beuną"
    forms["pres_ptc"] = "wesandz"
    forms["past_ptc"] = ""
    
    -- Indicative
    forms["pres_indc_1sg"] = "biumi"
    forms["pres_indc_2sg"] = "biusi"
    forms["pres_indc_3sg"] = "biuþi"
    forms["pres_indc_1du"] = "beū?"
    forms["pres_indc_2du"] = "biuþiz"
    forms["pres_indc_1pl"] = "beum"
    forms["pres_indc_2pl"] = "beud"
    forms["pres_indc_3pl"] = "biunþi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = "biwjǭ?"
    forms["pres_subj_2sg"] = "biwjēs?"
    forms["pres_subj_3sg"] = "biwjē?"
    forms["pres_subj_1du"] = "biwīw"
    forms["pres_subj_2du"] = "biwīþiz"
    forms["pres_subj_1pl"] = "biwīm"
    forms["pres_subj_2pl"] = "biwīþ"
    forms["pres_subj_3pl"] = "biwīn"

    -- Imperative
    forms["impr_2sg"] = "beu"
    forms["impr_3sg"] = "beuþau"
    forms["impr_2du"] = "biudiz"
    forms["impr_2pl"] = "beuþ"
    forms["impr_3pl"] = "beunþau"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""

    return forms, title, categories
end

conjugations["dōną"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs"}
    local title = "irregular"
    
    present_weak2(forms, "d")
    past_weak(forms, "d")
    forms["pres_indc_1sg"] = "dōmi"
    forms["past_indc_1sg"] = "dedǭ"
    forms["past_indc_2sg"] = "dedēz"
    forms["past_indc_3sg"] = "dedē"
    forms["past_ptc"] = "dēnaz"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""

    return forms, title, categories
end

conjugations["gāną"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs", "Proto-Germanic suppletive verbs"}
    local title = "irregular, suppletive"
    
    present_weak3_a(forms, "g")
    past_weak(forms, "ijj")
    forms["past_ptc"] = "gānaz"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""

    return forms, title, categories
end

conjugations["stāną"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs"}
    local title = "irregular"
    
    present_weak3_a(forms, "st")
    past_strong(forms, "stōd", "stōþ")
    forms["past_ptc"] = "stadanaz"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""

    return forms, title, categories
end

conjugations["wesaną"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs", "Proto-Germanic suppletive verbs"}
    local title = "irregular, suppletive"
    
    present_strong(forms, "wes")
    past_strong(forms, "wēz", "was")
    forms["past_ptc"] = ""
    
    -- Indicative
    forms["pres_indc_1sg"] = "immi"
    forms["pres_indc_2sg"] = "izi"
    forms["pres_indc_3sg"] = "isti"
    forms["pres_indc_1du"] = "izū"
    forms["pres_indc_2du"] = "izudiz"
    forms["pres_indc_1pl"] = "izum"
    forms["pres_indc_2pl"] = "izud"
    forms["pres_indc_3pl"] = "sindi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = "sijǭ"
    forms["pres_subj_2sg"] = "sijēs"
    forms["pres_subj_3sg"] = "sijē"
    forms["pres_subj_1du"] = "sīw"
    forms["pres_subj_2du"] = "sīþiz"
    forms["pres_subj_1pl"] = "sīm"
    forms["pres_subj_2pl"] = "sīþ"
    forms["pres_subj_3pl"] = "sīn"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""

    return forms, title, categories
end

conjugations["wiljaną"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs", "Proto-Germanic defective verbs"}
    local title = "irregular, defective"
    
    -- Indicative
    forms["pres_indc_1sg"] = ""
    forms["pres_indc_2sg"] = ""
    forms["pres_indc_3sg"] = ""
    forms["pres_indc_1du"] = ""
    forms["pres_indc_2du"] = ""
    forms["pres_indc_1pl"] = ""
    forms["pres_indc_2pl"] = ""
    forms["pres_indc_3pl"] = ""
    
    -- Subjunctive
    forms["pres_subj_1sg"] = "wiljų"
    forms["pres_subj_2sg"] = "wilīz"
    forms["pres_subj_3sg"] = "wilī"
    forms["pres_subj_1du"] = "wilīw"
    forms["pres_subj_2du"] = "wilīdiz"
    forms["pres_subj_1pl"] = "wilīm"
    forms["pres_subj_2pl"] = "wilīd"
    forms["pres_subj_3pl"] = "wilīn"
    
    -- Imperative
    forms["impr_2sg"] = ""
    forms["impr_3sg"] = ""
    forms["impr_2du"] = ""
    forms["impr_2pl"] = ""
    forms["impr_3pl"] = ""
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""
    
    forms["infinitive"] = "wiljaną"
    forms["pres_ptc"] = "wiljandz"
    
    past_weak(forms, "weld")
    forms["past_ptc"] = ""
    
    return forms, title, categories
end

conjugations["waldaną2"] = function(args)
    local forms = {}
    local categories = {"Proto-Germanic irregular verbs", "Proto-Germanic defective verbs"}
    local title = "irregular, defective"
    
    -- Indicative
    forms["pres_indc_1sg"] = ""
    forms["pres_indc_2sg"] = ""
    forms["pres_indc_3sg"] = ""
    forms["pres_indc_1du"] = ""
    forms["pres_indc_2du"] = ""
    forms["pres_indc_1pl"] = ""
    forms["pres_indc_2pl"] = ""
    forms["pres_indc_3pl"] = ""
    
    -- Subjunctive
    forms["pres_subj_1sg"] = ""
    forms["pres_subj_2sg"] = ""
    forms["pres_subj_3sg"] = ""
    forms["pres_subj_1du"] = ""
    forms["pres_subj_2du"] = ""
    forms["pres_subj_1pl"] = ""
    forms["pres_subj_2pl"] = ""
    forms["pres_subj_3pl"] = ""
    
    -- Imperative
    forms["impr_2sg"] = ""
    forms["impr_3sg"] = ""
    forms["impr_2du"] = ""
    forms["impr_2pl"] = ""
    forms["impr_3pl"] = ""
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""
    
    forms["infinitive"] = ""
    forms["pres_ptc"] = ""
    
    past_weak(forms, "wulþ")
    forms["past_ptc"] = "wulþaz"
    
    return forms, title, categories
end

--[=[
    *** HELPER FUNCTIONS ***
]=]--

function present_strong(forms, stem)
    local i_stem = com.i_mutation(stem) .. "i"
    
    -- Indicative
    forms["pres_indc_1sg"] = stem .. "ō"
    forms["pres_indc_2sg"] = i_stem .. "zi"
    forms["pres_indc_3sg"] = i_stem .. "di"
    forms["pres_indc_1du"] = stem .. "ōz"
    forms["pres_indc_2du"] = stem .. "adiz"
    forms["pres_indc_1pl"] = stem .. "amaz"
    forms["pres_indc_2pl"] = i_stem .. "d"
    forms["pres_indc_3pl"] = stem .. "andi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = stem .. "aų"
    forms["pres_subj_2sg"] = stem .. "aiz"
    forms["pres_subj_3sg"] = stem .. "ai"
    forms["pres_subj_1du"] = stem .. "aiw"
    forms["pres_subj_2du"] = stem .. "aidiz"
    forms["pres_subj_1pl"] = stem .. "aim"
    forms["pres_subj_2pl"] = stem .. "aid"
    forms["pres_subj_3pl"] = stem .. "ain"
    
    -- Imperative
    forms["impr_2sg"] = stem
    forms["impr_3sg"] = stem .. "adau"
    forms["impr_2du"] = stem .. "adiz"
    forms["impr_2pl"] = i_stem .. "d"
    forms["impr_3pl"] = stem .. "andau"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = stem .. "ai"
    forms["pasv_indc_2sg"] = stem .. "azai"
    forms["pasv_indc_3sg"] = stem .. "adai"
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = stem .. "andai"
    forms["pasv_indc_2pl"] = stem .. "andai"
    forms["pasv_indc_3pl"] = stem .. "andai"
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = "?"
    forms["pasv_subj_2sg"] = stem .. "aizau"
    forms["pasv_subj_3sg"] = stem .. "aidau"
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = stem .. "aindau"
    forms["pasv_subj_2pl"] = stem .. "aindau"
    forms["pasv_subj_3pl"] = stem .. "aindau"
    
    forms["infinitive"] = stem .. "aną"
    forms["pres_ptc"] = stem .. "andz"
end

function present_weak1(forms, stem, j)
    local i_stem = stem .. (j == "j" and "i" or "ī")
    stem = stem .. j
    
    -- Indicative
    forms["pres_indc_1sg"] = stem .. "ō"
    forms["pres_indc_2sg"] = i_stem .. "si"
    forms["pres_indc_3sg"] = i_stem .. "þi"
    forms["pres_indc_1du"] = stem .. "ōs"
    forms["pres_indc_2du"] = stem .. "aþiz"
    forms["pres_indc_1pl"] = stem .. "amaz"
    forms["pres_indc_2pl"] = i_stem .. "þ"
    forms["pres_indc_3pl"] = stem .. "anþi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = stem .. "aų"
    forms["pres_subj_2sg"] = stem .. "ais"
    forms["pres_subj_3sg"] = stem .. "ai"
    forms["pres_subj_1du"] = stem .. "aiw"
    forms["pres_subj_2du"] = stem .. "aiþiz"
    forms["pres_subj_1pl"] = stem .. "aim"
    forms["pres_subj_2pl"] = stem .. "aiþ"
    forms["pres_subj_3pl"] = stem .. "ain"
    
    -- Imperative
    forms["impr_2sg"] = i_stem
    forms["impr_3sg"] = stem .. "aþau"
    forms["impr_2du"] = stem .. "aþiz"
    forms["impr_2pl"] = i_stem .. "þ"
    forms["impr_3pl"] = stem .. "anþau"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = stem .. "ai"
    forms["pasv_indc_2sg"] = stem .. "asai"
    forms["pasv_indc_3sg"] = stem .. "aþai"
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = stem .. "anþai"
    forms["pasv_indc_2pl"] = stem .. "anþai"
    forms["pasv_indc_3pl"] = stem .. "anþai"
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = "?"
    forms["pasv_subj_2sg"] = stem .. "aisau"
    forms["pasv_subj_3sg"] = stem .. "aiþau"
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = stem .. "ainþau"
    forms["pasv_subj_2pl"] = stem .. "ainþau"
    forms["pasv_subj_3pl"] = stem .. "ainþau"
    
    forms["infinitive"] = stem .. "aną"
    forms["pres_ptc"] = stem .. "andz"
end

function present_weak2(forms, stem)
    -- Indicative
    forms["pres_indc_1sg"] = stem .. "ō"
    forms["pres_indc_2sg"] = stem .. "ōsi"
    forms["pres_indc_3sg"] = stem .. "ōþi"
    forms["pres_indc_1du"] = stem .. "ōs"
    forms["pres_indc_2du"] = stem .. "ōþiz"
    forms["pres_indc_1pl"] = stem .. "ōmaz"
    forms["pres_indc_2pl"] = stem .. "ōþ"
    forms["pres_indc_3pl"] = stem .. "ōnþi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = stem .. "ǭ"
    forms["pres_subj_2sg"] = stem .. "ōs"
    forms["pres_subj_3sg"] = stem .. "ō"
    forms["pres_subj_1du"] = stem .. "ōw"
    forms["pres_subj_2du"] = stem .. "ōþiz"
    forms["pres_subj_1pl"] = stem .. "ōm"
    forms["pres_subj_2pl"] = stem .. "ōþ"
    forms["pres_subj_3pl"] = stem .. "ōn"
    
    -- Imperative
    forms["impr_2sg"] = stem .. "ō"
    forms["impr_3sg"] = stem .. "ōþau"
    forms["impr_2du"] = stem .. "ōþiz"
    forms["impr_2pl"] = stem .. "ōþ"
    forms["impr_3pl"] = stem .. "ōnþau"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = stem .. "ōi"
    forms["pasv_indc_2sg"] = stem .. "ōsai"
    forms["pasv_indc_3sg"] = stem .. "ōþai"
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = stem .. "ōnþai"
    forms["pasv_indc_2pl"] = stem .. "ōnþai"
    forms["pasv_indc_3pl"] = stem .. "ōnþai"
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = "?"
    forms["pasv_subj_2sg"] = stem .. "ōsau"
    forms["pasv_subj_3sg"] = stem .. "ōþau"
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = stem .. "ōnþau"
    forms["pasv_subj_2pl"] = stem .. "ōnþau"
    forms["pasv_subj_3pl"] = stem .. "ōnþau"
    
    forms["infinitive"] = stem .. "ōną"
    forms["pres_ptc"] = stem .. "ōndz"
end

function present_weak3_ja(forms, stem, j)
    local i_stem = stem .. (j == "i" and "ij" or "") .. "ai"
    stem = stem .. (j == "i" and "ij" or j)
    
    -- Indicative
    forms["pres_indc_1sg"] = stem .. "ō"
    forms["pres_indc_2sg"] = i_stem .. "si"
    forms["pres_indc_3sg"] = i_stem .. "þi"
    forms["pres_indc_1du"] = stem .. "ōs"
    forms["pres_indc_2du"] = stem .. "aþiz"
    forms["pres_indc_1pl"] = stem .. "amaz"
    forms["pres_indc_2pl"] = i_stem .. "þ"
    forms["pres_indc_3pl"] = stem .. "anþi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = stem .. "aų"
    forms["pres_subj_2sg"] = stem .. "ais"
    forms["pres_subj_3sg"] = stem .. "ai"
    forms["pres_subj_1du"] = stem .. "aiw"
    forms["pres_subj_2du"] = stem .. "aiþiz"
    forms["pres_subj_1pl"] = stem .. "aim"
    forms["pres_subj_2pl"] = stem .. "aiþ"
    forms["pres_subj_3pl"] = stem .. "ain"
    
    -- Imperative
    forms["impr_2sg"] = i_stem
    forms["impr_3sg"] = stem .. "aþau"
    forms["impr_2du"] = stem .. "aþiz"
    forms["impr_2pl"] = i_stem .. "þ"
    forms["impr_3pl"] = stem .. "anþau"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""
    
    forms["infinitive"] = stem .. "aną"
    forms["pres_ptc"] = stem .. "andz"
end

function present_weak3_a(forms, stem)
    -- Indicative
    forms["pres_indc_1sg"] = stem .. "ō"
    forms["pres_indc_2sg"] = stem .. "aisi"
    forms["pres_indc_3sg"] = stem .. "aiþi"
    forms["pres_indc_1du"] = stem .. "ōs"
    forms["pres_indc_2du"] = stem .. "āþiz"
    forms["pres_indc_1pl"] = stem .. "āmaz"
    forms["pres_indc_2pl"] = stem .. "aiþ"
    forms["pres_indc_3pl"] = stem .. "ānþi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = "?"
    forms["pres_subj_2sg"] = "?"
    forms["pres_subj_3sg"] = "?"
    forms["pres_subj_1du"] = "?"
    forms["pres_subj_2du"] = "?"
    forms["pres_subj_1pl"] = "?"
    forms["pres_subj_2pl"] = "?"
    forms["pres_subj_3pl"] = "?"
    
    -- Imperative
    forms["impr_2sg"] = stem .. "ai"
    forms["impr_3sg"] = stem .. "āþau"
    forms["impr_2du"] = stem .. "āþiz"
    forms["impr_2pl"] = stem .. "aiþ"
    forms["impr_3pl"] = stem .. "ānþau"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = "?"
    forms["pasv_indc_2sg"] = stem .. "āsai"
    forms["pasv_indc_3sg"] = stem .. "āþai"
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = stem .. "ānþai"
    forms["pasv_indc_2pl"] = stem .. "ānþai"
    forms["pasv_indc_3pl"] = stem .. "ānþai"
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = "?"
    forms["pasv_subj_2sg"] = "?"
    forms["pasv_subj_3sg"] = "?"
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = "?"
    forms["pasv_subj_2pl"] = "?"
    forms["pasv_subj_3pl"] = "?"
    
    forms["infinitive"] = stem .. "āną"
    forms["pres_ptc"] = stem .. "āndz"
end

function present_weak4(forms, stem)
    -- Indicative
    forms["pres_indc_1sg"] = stem .. "ō"
    forms["pres_indc_2sg"] = stem .. "ōsi"
    forms["pres_indc_3sg"] = stem .. "ōþi"
    forms["pres_indc_1du"] = stem .. "ōs"
    forms["pres_indc_2du"] = stem .. "aþiz"
    forms["pres_indc_1pl"] = stem .. "amaz"
    forms["pres_indc_2pl"] = stem .. "aþ"
    forms["pres_indc_3pl"] = stem .. "anþi"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = stem .. "aų"
    forms["pres_subj_2sg"] = stem .. "ais"
    forms["pres_subj_3sg"] = stem .. "ai"
    forms["pres_subj_1du"] = stem .. "aiw"
    forms["pres_subj_2du"] = stem .. "aiþiz"
    forms["pres_subj_1pl"] = stem .. "aim"
    forms["pres_subj_2pl"] = stem .. "aiþ"
    forms["pres_subj_3pl"] = stem .. "ain"
    
    -- Imperative
    forms["impr_2sg"] = stem .. "ō"
    forms["impr_3sg"] = stem .. "ōþau"
    forms["impr_2du"] = stem .. "aþiz"
    forms["impr_2pl"] = stem .. "aþ"
    forms["impr_3pl"] = stem .. "anþau"
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""
    
    forms["infinitive"] = stem .. "aną"
    forms["pres_ptc"] = stem .. "andz"
end

-- Create preterite-present present forms
function present_pp(forms, stem, sg_stem)
    -- Indicative
    forms["pres_indc_1sg"] = sg_stem
    forms["pres_indc_2sg"] = com.add_t(sg_stem)
    forms["pres_indc_3sg"] = sg_stem
    forms["pres_indc_1du"] = stem .. "ū"
    forms["pres_indc_2du"] = stem .. "udiz"
    forms["pres_indc_1pl"] = stem .. "um"
    forms["pres_indc_2pl"] = stem .. "ud"
    forms["pres_indc_3pl"] = stem .. "un"
    
    -- Subjunctive
    forms["pres_subj_1sg"] = stem .. "į̄"
    forms["pres_subj_2sg"] = stem .. "īz"
    forms["pres_subj_3sg"] = stem .. "ī"
    forms["pres_subj_1du"] = stem .. "īw"
    forms["pres_subj_2du"] = stem .. "īdiz"
    forms["pres_subj_1pl"] = stem .. "īm"
    forms["pres_subj_2pl"] = stem .. "īd"
    forms["pres_subj_3pl"] = stem .. "īn"
    
    -- Imperative
    forms["impr_2sg"] = ""
    forms["impr_3sg"] = ""
    forms["impr_2du"] = ""
    forms["impr_2pl"] = ""
    forms["impr_3pl"] = ""
    
    -- Indicative passive
    forms["pasv_indc_1sg"] = ""
    forms["pasv_indc_2sg"] = ""
    forms["pasv_indc_3sg"] = ""
    forms["pasv_indc_1du"] = ""
    forms["pasv_indc_2du"] = ""
    forms["pasv_indc_1pl"] = ""
    forms["pasv_indc_2pl"] = ""
    forms["pasv_indc_3pl"] = ""
    
    -- Subjunctive passive
    forms["pasv_subj_1sg"] = ""
    forms["pasv_subj_2sg"] = ""
    forms["pasv_subj_3sg"] = ""
    forms["pasv_subj_1du"] = ""
    forms["pasv_subj_2du"] = ""
    forms["pasv_subj_1pl"] = ""
    forms["pasv_subj_2pl"] = ""
    forms["pasv_subj_3pl"] = ""

    forms["infinitive"] = stem .. "aną"
    forms["pres_ptc"] = stem .. "andz"
end

-- Create strong past-tense forms
function past_strong(forms, stem, sg_stem, indc_stem)
    forms["past_indc_1sg"] = sg_stem
    forms["past_indc_2sg"] = com.add_t(sg_stem)
    forms["past_indc_3sg"] = sg_stem
    
    past_generic(forms, stem, indc_stem)
end

-- Create weak past-tense forms
function past_weak(forms, stem)
    forms["past_indc_1sg"] = stem .. "ǭ"
    forms["past_indc_2sg"] = stem .. "ēz"
    forms["past_indc_3sg"] = stem .. "ē"
    
    past_generic(forms, stem .. "ēd")
    
    forms["past_ptc"] = stem .. "az"
end

-- Create general past-tense forms
function past_generic(forms, stem, indc_stem)
    indc_stem = indc_stem or stem
    
    -- Nonsingular indicative
    forms["past_indc_1du"] = indc_stem .. "ū"
    forms["past_indc_2du"] = indc_stem .. "udiz"
    forms["past_indc_1pl"] = indc_stem .. "um"
    forms["past_indc_2pl"] = indc_stem .. "ud"
    forms["past_indc_3pl"] = indc_stem .. "un"
    
    -- Subjunctive
    forms["past_subj_1sg"] = stem .. "į̄"
    forms["past_subj_2sg"] = stem .. "īz"
    forms["past_subj_3sg"] = stem .. "ī"
    forms["past_subj_1du"] = stem .. "īw"
    forms["past_subj_2du"] = stem .. "īdiz"
    forms["past_subj_1pl"] = stem .. "īm"
    forms["past_subj_2pl"] = stem .. "īd"
    forms["past_subj_3pl"] = stem .. "īn"
end

-- Make the table
function make_table(forms, title)
    -- Make links out of all forms
    for key, form in pairs(forms) do
    	if form ~= '?' then
	        forms[key] = com.link_form(form)
        end
    end
    
    return [=[
<div class="NavFrame">
<div class="NavHead" style="text-align: left">Conjugation of '']=] .. forms["infinitive"] .. "''" .. (title and " (" .. title .. ")" or "") .. [=[</div>
<div class="NavContent">
{| class="wikitable inflection-table" style="text-align: left; width: 100%; line-height: 125%; margin: 0;"
|-
| colspan="1" |
! colspan="3" | [[active&nbsp;voice]]
! colspan="2" | [[passive&nbsp;voice]]
|-
! [[present&nbsp;tense]]
! style="width: 20%;" | [[indicative mood|indicative]]
! style="width: 20%;" | [[subjunctive mood|subjunctive]]
! style="width: 20%;" | [[imperative mood|imperative]]
! style="width: 20%;" | [[indicative mood|indicative]]
! style="width: 20%;" | [[subjunctive mood|subjunctive]]
|-
! [[first person|1st]]&nbsp;[[singular]]
| ]=] .. forms["pres_indc_1sg"] .. " || " .. forms["pres_subj_1sg"] .. " || &mdash; || " .. forms["pasv_indc_1sg"] .. " || " .. forms["pasv_subj_1sg"] .. [=[

|-
! [[second person|2nd]]&nbsp;[[singular]]
| ]=] .. forms["pres_indc_2sg"] .. " || " .. forms["pres_subj_2sg"] .. " || " .. forms["impr_2sg"] .. " || " .. forms["pasv_indc_2sg"] .. " || " .. forms["pasv_subj_2sg"] .. [=[

|-
! [[third person|3rd]]&nbsp;[[singular]]
| ]=] .. forms["pres_indc_3sg"] .. " || " .. forms["pres_subj_3sg"] .. " || " .. forms["impr_3sg"] .. " || " .. forms["pasv_indc_3sg"] .. " || " .. forms["pasv_subj_3sg"] .. [=[

|-
! [[first person|1st]]&nbsp;[[dual]]
| ]=] .. forms["pres_indc_1du"] .. " || " .. forms["pres_subj_1du"] .. " || &mdash; || " .. forms["pasv_indc_1du"] .. " || " .. forms["pasv_subj_1du"] .. [=[

|-
! [[second person|2nd]]&nbsp;[[dual]]
| ]=] .. forms["pres_indc_2du"] .. " || " .. forms["pres_subj_2du"] .. " || " .. forms["impr_2du"] .. " || " .. forms["pasv_indc_2du"] .. " || " .. forms["pasv_subj_2du"] .. [=[

|-
! [[first person|1st]]&nbsp;[[plural]]
| ]=] .. forms["pres_indc_1pl"] .. " || " .. forms["pres_subj_1pl"] .. " || &mdash; || " .. forms["pasv_indc_1pl"] .. " || " .. forms["pasv_subj_1pl"] .. [=[

|-
! [[second person|2nd]]&nbsp;[[plural]]
| ]=] .. forms["pres_indc_2pl"] .. " || " .. forms["pres_subj_2pl"] .. " || " .. forms["impr_2pl"] .. " || " .. forms["pasv_indc_2pl"] .. " || " .. forms["pasv_subj_2pl"] .. [=[

|-
! [[third person|3rd]]&nbsp;[[plural]]
| ]=] .. forms["pres_indc_3pl"] .. " || " .. forms["pres_subj_3pl"] .. " || " .. forms["impr_3pl"] .. " || " .. forms["pasv_indc_3pl"] .. " || " .. forms["pasv_subj_3pl"] .. [=[

|-
| colspan="6" |
|-
! colspan="1" | [[past&nbsp;tense]]
! style="width: 20%;" | [[indicative mood|indicative]]
! style="width: 20%;" | [[subjunctive mood|subjunctive]]
| colspan="3" rowspan="9" |
|-
! [[first person|1st]]&nbsp;[[singular]]
| ]=] .. forms["past_indc_1sg"] .. " || " .. forms["past_subj_1sg"] .. [=[

|-
! [[second person|2nd]]&nbsp;[[singular]]
| ]=] .. forms["past_indc_2sg"] .. " || " .. forms["past_subj_2sg"] .. [=[

|-
! [[third person|3rd]]&nbsp;[[singular]]
| ]=] .. forms["past_indc_3sg"] .. " || " .. forms["past_subj_3sg"] .. [=[

|-
! [[first person|1st]]&nbsp;[[dual]]
| ]=] .. forms["past_indc_1du"] .. " || " .. forms["past_subj_1du"] .. [=[

|-
! [[second person|2nd]]&nbsp;[[dual]]
| ]=] .. forms["past_indc_2du"] .. " || " .. forms["past_subj_2du"] .. [=[

|-
! [[first person|1st]]&nbsp;[[plural]]
| ]=] .. forms["past_indc_1pl"] .. " || " .. forms["past_subj_1pl"] .. [=[

|-
! [[second person|2nd]]&nbsp;[[plural]]
| ]=] .. forms["past_indc_2pl"] .. " || " .. forms["past_subj_2pl"] .. [=[

|-
! [[third person|3rd]]&nbsp;[[plural]]
| ]=] .. forms["past_indc_3pl"] .. " || " .. forms["past_subj_3pl"] .. [=[

|-
| colspan="6" |
|-
|
! [[present tense|present]]
! [[past tense|past]]
| colspan="3" rowspan="2" |
|-
! [[participles]]
| ]=] .. forms["pres_ptc"] .. " || " .. forms["past_ptc"] .. [=[

|}</div></div>]=]
end

function make_bot_list(forms, hasSep)
    local ret = ""
    
    if hasSep then
        ret = ret .. "* sep=1\n"
    end
    
    for key, form in pairs(forms) do
        ret = ret .. "* " .. key .. "=" .. form .. "\n"
    end
    
    return ret
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:gem-verb&oldid=164076" වෙතින් සම්ප්‍රවේශනය කෙරිණි