[Turn off line numbering]
1: arg name, @def;
2: var article, match, flag, type, tmps, ignore;
3:
4: // used to parse $has_name names and name templates
5: [name, flag] = (> $parse_lib.opt(name, "u?nique", "p?roper", "n?ormal", "i?gnore") <);
6: name = name.join();
7:
8: // Parse +prop +norm +uniq and +ignore flags
9: if (flag) {
10: def = [@def, ["p?roper", "p", 1, ""]][1];
11: flag = (| flag.last() |) || def;
12: if (flag[1] == "i?gnore") {
13: article = 'prop;
14: ignore = 1;
15: } else {
16: switch (flag[1]) {
17: case "n?ormal":
18: type = 'normal;
19: case "u?nique":
20: type = 'uniq;
21: case "p?roper":
22: type = 'prop;
23: }
24: article = type;
25: }
26: } else {
27: article = 'prop;
28: }
29: [name, @tmps] = name.split(" *, *");
30:
31: // Check to see if the name already has articles in it.
32: if (!ignore) {
33: if ((match = name.regexp("^the +(.*)$"))) {
34: article = 'uniq;
35: name = match[1];
36: } else if ((match = name.regexp("^(a|an) +(.*)$"))) {
37: article = 'normal;
38: name = match[2];
39: }
40:
41: // Complain if the flag does not agree with the given article
42: if (type && article != type)
43: throw(~article, "Conflicting name types " + type + " and " + article);
44: }
45: return [[name, article], tmps];
["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]