const maxNonStarters … const maxBufferSize … const maxNFCExpansion … const maxNFKCExpansion … const maxByteBufferSize … type ssState … const ssSuccess … const ssStarter … const ssOverflow … type streamSafe … // first inserts the first rune of a segment. It is a faster version of next if // it is known p represents the first rune in a segment. func (ss *streamSafe) first(p Properties) { … } // insert returns a ssState value to indicate whether a rune represented by p // can be inserted. func (ss *streamSafe) next(p Properties) ssState { … } // backwards is used for checking for overflow and segment starts // when traversing a string backwards. Users do not need to call first // for the first rune. The state of the streamSafe retains the count of // the non-starters loaded. func (ss *streamSafe) backwards(p Properties) ssState { … } func (ss streamSafe) isMax() bool { … } const GraphemeJoiner … type reorderBuffer … func (rb *reorderBuffer) init(f Form, src []byte) { … } func (rb *reorderBuffer) initString(f Form, src string) { … } func (rb *reorderBuffer) setFlusher(out []byte, f func(*reorderBuffer) bool) { … } // reset discards all characters from the buffer. func (rb *reorderBuffer) reset() { … } func (rb *reorderBuffer) doFlush() bool { … } // appendFlush appends the normalized segment to rb.out. func appendFlush(rb *reorderBuffer) bool { … } // flush appends the normalized segment to out and resets rb. func (rb *reorderBuffer) flush(out []byte) []byte { … } // flushCopy copies the normalized segment to buf and resets rb. // It returns the number of bytes written to buf. func (rb *reorderBuffer) flushCopy(buf []byte) int { … } // insertOrdered inserts a rune in the buffer, ordered by Canonical Combining Class. // It returns false if the buffer is not large enough to hold the rune. // It is used internally by insert and insertString only. func (rb *reorderBuffer) insertOrdered(info Properties) { … } type insertErr … const iSuccess … const iShortDst … const iShortSrc … // insertFlush inserts the given rune in the buffer ordered by CCC. // If a decomposition with multiple segments are encountered, they leading // ones are flushed. // It returns a non-zero error code if the rune was not inserted. func (rb *reorderBuffer) insertFlush(src input, i int, info Properties) insertErr { … } // insertUnsafe inserts the given rune in the buffer ordered by CCC. // It is assumed there is sufficient space to hold the runes. It is the // responsibility of the caller to ensure this. This can be done by checking // the state returned by the streamSafe type. func (rb *reorderBuffer) insertUnsafe(src input, i int, info Properties) { … } // insertDecomposed inserts an entry in to the reorderBuffer for each rune // in dcomp. dcomp must be a sequence of decomposed UTF-8-encoded runes. // It flushes the buffer on each new segment start. func (rb *reorderBuffer) insertDecomposed(dcomp []byte) insertErr { … } // insertSingle inserts an entry in the reorderBuffer for the rune at // position i. info is the runeInfo for the rune at position i. func (rb *reorderBuffer) insertSingle(src input, i int, info Properties) { … } // insertCGJ inserts a Combining Grapheme Joiner (0x034f) into rb. func (rb *reorderBuffer) insertCGJ() { … } // appendRune inserts a rune at the end of the buffer. It is used for Hangul. func (rb *reorderBuffer) appendRune(r rune) { … } // assignRune sets a rune at position pos. It is used for Hangul and recomposition. func (rb *reorderBuffer) assignRune(pos int, r rune) { … } // runeAt returns the rune at position n. It is used for Hangul and recomposition. func (rb *reorderBuffer) runeAt(n int) rune { … } // bytesAt returns the UTF-8 encoding of the rune at position n. // It is used for Hangul and recomposition. func (rb *reorderBuffer) bytesAt(n int) []byte { … } const hangulBase … const hangulBase0 … const hangulBase1 … const hangulBase2 … const hangulEnd … const hangulEnd0 … const hangulEnd1 … const hangulEnd2 … const jamoLBase … const jamoLBase0 … const jamoLBase1 … const jamoLEnd … const jamoVBase … const jamoVEnd … const jamoTBase … const jamoTEnd … const jamoTCount … const jamoVCount … const jamoVTCount … const jamoLVTCount … const hangulUTF8Size … func isHangul(b []byte) bool { … } func isHangulString(b string) bool { … } // Caller must ensure len(b) >= 2. func isJamoVT(b []byte) bool { … } func isHangulWithoutJamoT(b []byte) bool { … } // decomposeHangul writes the decomposed Hangul to buf and returns the number // of bytes written. len(buf) should be at least 9. func decomposeHangul(buf []byte, r rune) int { … } // decomposeHangul algorithmically decomposes a Hangul rune into // its Jamo components. // See https://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul. func (rb *reorderBuffer) decomposeHangul(r rune) { … } // combineHangul algorithmically combines Jamo character components into Hangul. // See https://unicode.org/reports/tr15/#Hangul for details on combining Hangul. func (rb *reorderBuffer) combineHangul(s, i, k int) { … } // compose recombines the runes in the buffer. // It should only be used to recompose a single segment, as it will not // handle alternations between Hangul and non-Hangul characters correctly. func (rb *reorderBuffer) compose() { … }