Method code for $command_lib.get_argument_type()

[Turn on line numbering]
arg type;
var a, m, opts, o, result, is_list;

o = $object_lib;
is_list = 0;
if ((m = type.match_template("list *"))) {
    type = m[2];
    is_list = 1;
}
for a in (arg_types) {
    m = match_pattern(type, a);
    if (type(m) == 'list) {
        switch (a) {
            case "descendant of *":
                result = ['descendant, [(> o.to_dbref(m[1]) <)]];
            case "descendant of *:*":
                opts = ._parse_option_templates(m[2]);
                result = ['descendant, [(> o.to_dbref(m[1]) <)] + opts];
            case "number:*", "objref:*", "any:*", "object:*", "user:*":
                opts = ._parse_option_templates(m[1]);
                result = [tosym((a.explode(":"))[1] + "_opt"), opts];
            default:
                result = [tosym(a), []];
        }
        return is_list ? ['list, result] : result;
    }
}
throw(~command, "Invalid argument type \"" + type + "\"");

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon