Module:pollasena-roots: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
local m_iut = require("Module:inflection utilities")
local m_put = require("Module:parse utilities")
local m_table = require("Module:table")
local m_table = require("Module:table")


Line 38: Line 38:
for i, item in ipairs(args[a]) do
for i, item in ipairs(args[a]) do
if item:find("<") and not item:find("^[^<]*<[a-z]*[^a-z:]") then
if item:find("<") and not item:find("^[^<]*<[a-z]*[^a-z:]") then
local run = m_iut.parse_balanced_segment_run(item, "<", ">")
local run = m_put.parse_balanced_segment_run
local orig_param = i + 1
local function parse_err(msg)
term = run[1]
error(msg .. ": " .. orig_param .. "= " .. table.concat(run))
end
local termobj = {term = {}}
termobj.term.lang = lang
termobj.term.term = run[1]


for j = 2, #run - 1, 2 do
for j = 2, #run - 1, 2 do
if run[j + 1] ~= "" then
parse_err("Extraneous text '" .. run[j + 1] .. "' after modifier")
end
local modtext = run[j]:match("^<(.*)>$")
local modtext = run[j]:match("^<(.*)>$")
if not modtext then
parse_err("Internal error: Modifier '" .. modtext .. "' isn't surrounded by angle brackets")
end
local prefix, arg = modtext:match("^([a-z]+):(.*)$")
local prefix, arg = modtext:match("^([a-z]+):(.*)$")
if not prefix then
parse_err("Modifier " .. run[j] .. " lacks a prefix, should begin with one of '" ..
alt = prefix == "a" and arg or nil
table.concat(param_mods, ":', '") .. ":'")
cat = prefix == "c" and arg or nil
end
if param_mod_set[prefix] then
table.insert(links, link(term, alt))
local obj = termobj.term
table.insert(categories, "Soc'ul' terms inherited from Wascotl *" .. (cat or term))
if obj[prefix] then
parse_err("Modifier '" .. prefix .. "' occurs twice, second occurrence " .. run[j])
end
table.insert(links, link(obj.term, obj["alt"]))
table.insert(categories, "Soc'ul' terms inherited from Wascotl *" .. (obj["cat"] or obj.term))
else
parse_err("Unrecognized prefix '" .. prefix .. "' in modifier " .. run[j])
end
end
end
args[a][i] = termobj
end
end
end
end

Navigation menu