1module util
2
3[inline]
4pub fn is_name_char(c byte) bool {
5	return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || c == `_`
6}
7
8[inline]
9pub fn is_func_char(c byte) bool {
10	return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || c == `_` || c.is_digit()
11}
12
13[inline]
14pub fn is_nl(c byte) bool {
15	return c == `\r` || c == `\n`
16}
17
18pub fn contains_capital(s string) bool {
19	for c in s {
20		if c >= `A` && c <= `Z` {
21			return true
22		}
23	}
24	return false
25}
26
27// HTTPRequest  bad
28// HttpRequest  good
29pub fn good_type_name(s string) bool {
30	if s.len < 4 {
31		return true
32	}
33	for i in 2 .. s.len {
34		if s[i].is_capital() && s[i - 1].is_capital() && s[i - 2].is_capital() {
35			return false
36		}
37	}
38	return true
39}
40
41pub fn cescaped_path(s string) string {
42	return s.replace('\\', '\\\\')
43}
44