Method code for $code_lib.parse_name()

[Turn on line numbering]
arg name, @def;
var article, match, flag, type, tmps, ignore;

// used to parse $has_name names and name templates
[name, flag] = (> $parse_lib.opt(name, "u?nique", "p?roper", "n?ormal", "i?gnore") <);
name = name.join();

// Parse +prop +norm +uniq and +ignore flags
if (flag) {
    def = [@def, ["p?roper", "p", 1, ""]][1];
    flag = (| flag.last() |) || def;
    if (flag[1] == "i?gnore") {
        article = 'prop;
        ignore = 1;
    } else {
        switch (flag[1]) {
            case "n?ormal":
                type = 'normal;
            case "u?nique":
                type = 'uniq;
            case "p?roper":
                type = 'prop;
        }
        article = type;
    }
} else {
    article = 'prop;
}
[name, @tmps] = name.split(" *, *");

// Check to see if the name already has articles in it.
if (!ignore) {
    if ((match = name.regexp("^the +(.*)$"))) {
        article = 'uniq;
        name = match[1];
    } else if ((match = name.regexp("^(a|an) +(.*)$"))) {
        article = 'normal;
        name = match[2];
    }

    // Complain if the flag does not agree with the given article
    if (type && article != type)
        throw(~article, "Conflicting name types " + type + " and " + article);
}
return [[name, article], tmps];

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark