[Turn off line numbering]1: arg code, object, options; 2: var line, object_parse, results, obj_regexp, meth_regexp, chunk, word, method_parse, last_word, mode, chunk_out, meth_r2; 3: 4: obj_regexp = "\$[a-zA-Z0-9_]+"; 5: meth_regexp = "((^)|[ (!])\.[a-zA-Z0-9_]+\("; 6: meth_r2 = "^(\.[a-zA-Z0-9_]+\()(.*)$"; 7: results = []; 8: for line in (code) { 9: if (match_regexp(line, "^ *//")) { 10: results += ["<font color=\"#a0a0a0\">" + line + "</font>"]; 11: } else { 12: object_parse = line.global_regexp(obj_regexp); 13: last_word = 0; 14: chunk_out = ""; 15: while (object_parse) { 16: [chunk, (word ?= 0), @object_parse] = object_parse; 17: if (last_word && (method_parse = chunk.regexp(meth_r2))) { 18: chunk_out += ._do_method_href(method_parse[1], last_word, options); 19: chunk = method_parse[2]; 20: } 21: method_parse = chunk.global_regexp(meth_regexp); 22: mode = 0; 23: chunk_out += map chunk in (method_parse) to ((mode = !mode) ? chunk : ._do_method_href(chunk, object, options)).join(""); 24: if (word) { 25: last_word = word; 26: if ((| $object_lib.to_dbref(word) |)) 27: chunk_out += "<A HREF=\"/bin/display?target=" + (last_word = word).subrange(2) + "\">" + word + "</A>"; 28: else 29: chunk_out += word; 30: } 31: } 32: results += [chunk_out + object_parse.join("")]; 33: } 34: } 35: return results;
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit