[Turn off line numbering]1: arg code, method, warn; 2: var l, line, m, warns, isadmin, msg; 3: 4: warns = []; 5: method = "\." + tostr(method) + "\("; 6: isadmin = sender().is($admin); 7: for l in [1 .. code.length()] { 8: line = code[l]; 9: 10: // if its in a comment, ignore it 11: if (match_begin(line, "//")) 12: continue; 13: 14: // required warnings, sorry 15: if ((m = line.match_regexp("[^._]anticipate_assignment\("))) 16: warns += .point_to_line("WARNING: call to anticipate_assignment()", m[1][1] + 2, m[1][2] - 2, l, line); 17: if ((m = line.match_regexp("(!)[a-z0-9_]+ in "))) { 18: warns += ["WARNING: possible ambiguity, line " + l]; 19: warns += .point_to_line("WARNING: parenthesis suggested around followup expression to '!'", m[2][1] + 1, m[2][2], l, line); 20: } 21: if ((m = line.match_regexp("(if *\(|&&|\|\|) *[a-z0-9_]+ *(=)[^=]"))) 22: warns += .point_to_line("WARNING: parenthesis suggested around assignment expression", m[3][1] + 1, m[3][2], l, line); 23: 24: // optional warnings 25: if (warn && (m = line.match_regexp(method))) 26: warns += .point_to_line("WARNING: Possible Recursion", m[1][1] + 2, m[1][2] - 2, l, line); 27: refresh(); 28: } 29: return warns;
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit