Method code for $parse_lib.ref()

[Turn off line numbering]
  1: arg str, @args;
  2: var def, me, obj, reg, member, match, type, second;
  3: 
  4: [(me ?= sender())] = args;
  5: if (args.length() > 1)
  6:     match = args[2];
  7: else
  8:     match = [me, 'match_environment, []];
  9: if (str == ".") {
 10:     obj = (> match[1].(match[2])(".") <);
 11:     return ['object, obj, obj, 0, 0];
 12: }
 13: if ((reg = regexp(str, "^(.*)<([^>]*)>(.*)$"))) {
 14:     def = (> match[1].(match[2])(reg[2], @match[3]) <);
 15:     str = reg[1] + reg[3];
 16: }
 17: if ((reg = regexp(str, "([^\.,]*)([\.,]+)([^\( ]*)"))) {
 18:     obj = reg[1];
 19:     member = reg[3];
 20:     type = reg[2];
 21:     if (type.length() > 1 && type[1] == "." && !obj) {
 22:         type = type.subrange(2);
 23:         obj = (> match[1].(match[2])(".") <);
 24:     } else {
 25:         obj = obj ? (> match[1].(match[2])(obj, @match[3]) <) : me;
 26:     }
 27:     if ("." in type) {
 28:         if ("," in type)
 29:             second = 'variable;
 30:         type = 'method;
 31:     } else {
 32:         type = 'variable;
 33:     }
 34: } else {
 35:     obj = (> match[1].(match[2])(str, @match[3]) <);
 36:     type = 'object;
 37: }
 38: return [type, obj, def || obj, member, second];

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

Tlon