(lines []string)
| 122 | } |
| 123 | |
| 124 | func GuessIndentation(lines []string) int { |
| 125 | const MAX_SMI_X86 int = 0x3fff_ffff |
| 126 | indentation := MAX_SMI_X86 |
| 127 | for _, line := range lines { |
| 128 | if len(line) == 0 { |
| 129 | continue |
| 130 | } |
| 131 | i := 0 |
| 132 | for i < len(line) && i < indentation { |
| 133 | ch, size := utf8.DecodeRuneInString(line[i:]) |
| 134 | if !IsWhiteSpaceLike(ch) { |
| 135 | break |
| 136 | } |
| 137 | i += size |
| 138 | } |
| 139 | if i < indentation { |
| 140 | indentation = i |
| 141 | } |
| 142 | if indentation == 0 { |
| 143 | return 0 |
| 144 | } |
| 145 | } |
| 146 | if indentation == MAX_SMI_X86 { |
| 147 | return 0 |
| 148 | } |
| 149 | return indentation |
| 150 | } |
| 151 | |
| 152 | // https://tc39.es/ecma262/multipage/global-object.html#sec-encodeuri-uri |
| 153 | func EncodeURI(s string) string { |
no test coverage detected