[Turn on line numbering]arg code, method, warn; var l, line, m, warns, isadmin, msg; warns = []; method = "\." + tostr(method) + "\("; isadmin = sender().is($admin); for l in [1 .. code.length()] { line = code[l]; // if its in a comment, ignore it if (match_begin(line, "//")) continue; // required warnings, sorry if ((m = line.match_regexp("[^._]anticipate_assignment\("))) warns += .point_to_line("WARNING: call to anticipate_assignment()", m[1][1] + 2, m[1][2] - 2, l, line); if ((m = line.match_regexp("(!)[a-z0-9_]+ in "))) { warns += ["WARNING: possible ambiguity, line " + l]; warns += .point_to_line("WARNING: parenthesis suggested around followup expression to '!'", m[2][1] + 1, m[2][2], l, line); } if ((m = line.match_regexp("(if *\(|&&|\|\|) *[a-z0-9_]+ *(=)[^=]"))) warns += .point_to_line("WARNING: parenthesis suggested around assignment expression", m[3][1] + 1, m[3][2], l, line); // optional warnings if (warn && (m = line.match_regexp(method))) warns += .point_to_line("WARNING: Possible Recursion", m[1][1] + 2, m[1][2] - 2, l, line); refresh(); } return warns;
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit