using selfhost.shared.common.string_helpers as Str static box RuleUsingQuotedBox { apply(text, path, out) { local lines = text.split("\n") local i = 0 while i < lines.size() { local ln = me._ltrim(lines.get(i)) if ln.indexOf("using ") == 0 { if ln.indexOf('using "') != 0 { out.push("[HC003] using must be quoted: " + path + ":" + Str.int_to_str(i+1)) } } i = i + 1 } } _ltrim(s) { return me._ltrim_chars(s, " \t") } _ltrim_chars(s, cs) { local n = Str.len(s); local head = 0 local i = 0 while i < n { local ch = s.substring(i,i+1) if ch != " " && ch != "\t" { head = i; break } if i == n-1 { head = n } i = i + 1 } return s.substring(head) } } static box RuleUsingQuotedMain { method main(args) { return 0 } }