1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 skipNonStarter(p int) int
12 appendSlice(buf []byte, s, e int) []byte
13 copySlice(buf []byte, s, e int)
14 charinfo(p int) (uint16, int)
15 decomposeNFC(p int) uint16
16 decomposeNFKC(p int) uint16
20 type inputString string
22 func (s inputString) skipASCII(p int) int {
23 for ; p < len(s) && s[p] < utf8.RuneSelf; p++ {
28 func (s inputString) skipNonStarter(p int) int {
29 for ; p < len(s) && !utf8.RuneStart(s[p]); p++ {
34 func (s inputString) appendSlice(buf []byte, b, e int) []byte {
35 for i := b; i < e; i++ {
36 buf = append(buf, s[i])
41 func (s inputString) copySlice(buf []byte, b, e int) {
45 func (s inputString) charinfo(p int) (uint16, int) {
46 return charInfoTrie.lookupString(string(s[p:]))
49 func (s inputString) decomposeNFC(p int) uint16 {
50 return nfcDecompTrie.lookupStringUnsafe(string(s[p:]))
53 func (s inputString) decomposeNFKC(p int) uint16 {
54 return nfkcDecompTrie.lookupStringUnsafe(string(s[p:]))
57 func (s inputString) hangul(p int) uint32 {
58 if !isHangulString(string(s[p:])) {
61 rune, _ := utf8.DecodeRuneInString(string(s[p:]))
65 type inputBytes []byte
67 func (s inputBytes) skipASCII(p int) int {
68 for ; p < len(s) && s[p] < utf8.RuneSelf; p++ {
73 func (s inputBytes) skipNonStarter(p int) int {
74 for ; p < len(s) && !utf8.RuneStart(s[p]); p++ {
79 func (s inputBytes) appendSlice(buf []byte, b, e int) []byte {
80 return append(buf, s[b:e]...)
83 func (s inputBytes) copySlice(buf []byte, b, e int) {
87 func (s inputBytes) charinfo(p int) (uint16, int) {
88 return charInfoTrie.lookup(s[p:])
91 func (s inputBytes) decomposeNFC(p int) uint16 {
92 return nfcDecompTrie.lookupUnsafe(s[p:])
95 func (s inputBytes) decomposeNFKC(p int) uint16 {
96 return nfkcDecompTrie.lookupUnsafe(s[p:])
99 func (s inputBytes) hangul(p int) uint32 {
100 if !isHangul(s[p:]) {
103 rune, _ := utf8.DecodeRune(s[p:])