norm

Imports

Imports #

"unicode/utf8"
"golang.org/x/text/transform"
"sync"
"sync"
"sync"
"sync"
"unicode/utf8"
"golang.org/x/text/transform"
"encoding/binary"
"fmt"
"unicode/utf8"
"io"
"sync"
"sync"
"unicode/utf8"
"unicode/utf8"

Constants & Variables

GraphemeJoiner const #

GraphemeJoiner is inserted after maxNonStarters non-starter runes.

const GraphemeJoiner = "\u034F"

MaxSegmentSize const #

MaxSegmentSize is the maximum size of a byte buffer needed to consider any sequence of starter and non-starter runes for the purpose of normalization.

const MaxSegmentSize = maxByteBufferSize

MaxTransformChunkSize const #

MaxTransformChunkSize indicates the maximum number of bytes that Transform may need to write atomically for any Form. Making a destination buffer at least this size ensures that Transform can always make progress and that the user does not need to grow the buffer on an ErrShortDst.

const MaxTransformChunkSize = *ast.BinaryExpr

MaxTransformChunkSize const #

MaxTransformChunkSize indicates the maximum number of bytes that Transform may need to write atomically for any Form. Making a destination buffer at least this size ensures that Transform can always make progress and that the user does not need to grow the buffer on an ErrShortDst.

const MaxTransformChunkSize = *ast.BinaryExpr

MaxTransformChunkSize const #

MaxTransformChunkSize indicates the maximum number of bytes that Transform may need to write atomically for any Form. Making a destination buffer at least this size ensures that Transform can always make progress and that the user does not need to grow the buffer on an ErrShortDst.

const MaxTransformChunkSize = *ast.BinaryExpr

MaxTransformChunkSize const #

MaxTransformChunkSize indicates the maximum number of bytes that Transform may need to write atomically for any Form. Making a destination buffer at least this size ensures that Transform can always make progress and that the user does not need to grow the buffer on an ErrShortDst.

const MaxTransformChunkSize = *ast.BinaryExpr

MaxTransformChunkSize const #

MaxTransformChunkSize indicates the maximum number of bytes that Transform may need to write atomically for any Form. Making a destination buffer at least this size ensures that Transform can always make progress and that the user does not need to grow the buffer on an ErrShortDst.

const MaxTransformChunkSize = *ast.BinaryExpr

MaxTransformChunkSize const #

MaxTransformChunkSize indicates the maximum number of bytes that Transform may need to write atomically for any Form. Making a destination buffer at least this size ensures that Transform can always make progress and that the user does not need to grow the buffer on an ErrShortDst.

const MaxTransformChunkSize = *ast.BinaryExpr

NFC const #

const NFC Form = iota

NFD const #

const NFD

NFKC const #

const NFKC

NFKD const #

const NFKD

Version const #

Version is the Unicode edition from which the tables are derived.

const Version = "12.0.0"

Version const #

Version is the Unicode edition from which the tables are derived.

const Version = "11.0.0"

Version const #

Version is the Unicode edition from which the tables are derived.

const Version = "10.0.0"

Version const #

Version is the Unicode edition from which the tables are derived.

const Version = "13.0.0"

Version const #

Version is the Unicode edition from which the tables are derived.

const Version = "15.0.0"

Version const #

Version is the Unicode edition from which the tables are derived.

const Version = "9.0.0"

ccc var #

var ccc = [55]uint8{...}

ccc var #

var ccc = [56]uint8{...}

ccc var #

var ccc = [55]uint8{...}

ccc var #

var ccc = [55]uint8{...}

ccc var #

var ccc = [56]uint8{...}

ccc var #

var ccc = [55]uint8{...}

decomps var #

decomps: 19128 bytes

var decomps = [...]byte{...}

decomps var #

decomps: 19105 bytes

var decomps = [...]byte{...}

decomps var #

decomps: 19426 bytes

var decomps = [...]byte{...}

decomps var #

decomps: 19105 bytes

var decomps = [...]byte{...}

decomps var #

decomps: 19108 bytes

var decomps = [...]byte{...}

decomps var #

decomps: 19105 bytes

var decomps = [...]byte{...}

endMulti const #

const endMulti = 0x2F77

endMulti const #

const endMulti = 0x2F60

endMulti const #

const endMulti = 0x2F60

endMulti const #

const endMulti = 0x30A1

endMulti const #

const endMulti = 0x2F63

endMulti const #

const endMulti = 0x2F60

errs var #

var errs = []error{...}

firstCCC const #

const firstCCC = 0x2C9E

firstCCC const #

const firstCCC = 0x2DD5

firstCCC const #

const firstCCC = 0x2C9E

firstCCC const #

const firstCCC = 0x2CAB

firstCCC const #

const firstCCC = 0x2CA1

firstCCC const #

const firstCCC = 0x2C9E

firstCCCZeroExcept const #

const firstCCCZeroExcept = 0x4A78

firstCCCZeroExcept const #

const firstCCCZeroExcept = 0x4A78

firstCCCZeroExcept const #

const firstCCCZeroExcept = 0x4A7B

firstCCCZeroExcept const #

const firstCCCZeroExcept = 0x4A78

firstCCCZeroExcept const #

const firstCCCZeroExcept = 0x4A8F

firstCCCZeroExcept const #

const firstCCCZeroExcept = 0x4BB9

firstLeadingCCC const #

const firstLeadingCCC = 0x49AE

firstLeadingCCC const #

const firstLeadingCCC = 0x49AE

firstLeadingCCC const #

const firstLeadingCCC = 0x4AEF

firstLeadingCCC const #

const firstLeadingCCC = 0x49AE

firstLeadingCCC const #

const firstLeadingCCC = 0x49C5

firstLeadingCCC const #

const firstLeadingCCC = 0x49B1

firstMulti const #

const firstMulti = 0x199A

firstMulti const #

const firstMulti = 0x186D

firstMulti const #

const firstMulti = 0x186D

firstMulti const #

const firstMulti = 0x1870

firstMulti const #

const firstMulti = 0x186D

firstMulti const #

const firstMulti = 0x186D

firstStarterWithNLead const #

const firstStarterWithNLead = 0x4A9F

firstStarterWithNLead const #

const firstStarterWithNLead = 0x4A9F

firstStarterWithNLead const #

const firstStarterWithNLead = 0x4BE0

firstStarterWithNLead const #

const firstStarterWithNLead = 0x4A9F

firstStarterWithNLead const #

const firstStarterWithNLead = 0x4AB6

firstStarterWithNLead const #

const firstStarterWithNLead = 0x4AA2

formTable var #

var formTable = []*formInfo{...}

hangulBase const #

For Hangul we combine algorithmically, instead of using tables.

const hangulBase = 0xAC00

hangulBase0 const #

For Hangul we combine algorithmically, instead of using tables.

const hangulBase0 = 0xEA

hangulBase1 const #

For Hangul we combine algorithmically, instead of using tables.

const hangulBase1 = 0xB0

hangulBase2 const #

For Hangul we combine algorithmically, instead of using tables.

const hangulBase2 = 0x80

hangulEnd const #

For Hangul we combine algorithmically, instead of using tables.

const hangulEnd = *ast.BinaryExpr

hangulEnd0 const #

For Hangul we combine algorithmically, instead of using tables.

const hangulEnd0 = 0xED

hangulEnd1 const #

For Hangul we combine algorithmically, instead of using tables.

const hangulEnd1 = 0x9E

hangulEnd2 const #

For Hangul we combine algorithmically, instead of using tables.

const hangulEnd2 = 0xA4

hangulUTF8Size const #

const hangulUTF8Size = 3

headerFlagsMask const #

const headerFlagsMask = 0xC0

headerLenMask const #

const headerLenMask = 0x3F

iShortDst const #

const iShortDst

iShortSrc const #

const iShortSrc

iSuccess const #

const iSuccess insertErr = *ast.UnaryExpr

jamoLBase const #

For Hangul we combine algorithmically, instead of using tables.

const jamoLBase = 0x1100

jamoLBase0 const #

For Hangul we combine algorithmically, instead of using tables.

const jamoLBase0 = 0xE1

jamoLBase1 const #

For Hangul we combine algorithmically, instead of using tables.

const jamoLBase1 = 0x84

jamoLEnd const #

For Hangul we combine algorithmically, instead of using tables.

const jamoLEnd = 0x1113

jamoLVTCount const #

For Hangul we combine algorithmically, instead of using tables.

const jamoLVTCount = *ast.BinaryExpr

jamoTBase const #

For Hangul we combine algorithmically, instead of using tables.

const jamoTBase = 0x11A7

jamoTCount const #

For Hangul we combine algorithmically, instead of using tables.

const jamoTCount = 28

jamoTEnd const #

For Hangul we combine algorithmically, instead of using tables.

const jamoTEnd = 0x11C3

jamoVBase const #

For Hangul we combine algorithmically, instead of using tables.

const jamoVBase = 0x1161

jamoVCount const #

For Hangul we combine algorithmically, instead of using tables.

const jamoVCount = 21

jamoVEnd const #

For Hangul we combine algorithmically, instead of using tables.

const jamoVEnd = 0x1176

jamoVTCount const #

For Hangul we combine algorithmically, instead of using tables.

const jamoVTCount = *ast.BinaryExpr

lastDecomp const #

const lastDecomp = 0x4AA4

lastDecomp const #

const lastDecomp = 0x4AA1

lastDecomp const #

const lastDecomp = 0x4AA1

lastDecomp const #

const lastDecomp = 0x4AB8

lastDecomp const #

const lastDecomp = 0x4BE2

lastDecomp const #

const lastDecomp = 0x4AA1

maxBufferSize const #

The maximum number of characters needed for a buffer is maxNonStarters + 1 for the starter + 1 for the GCJ

const maxBufferSize = *ast.BinaryExpr

maxByteBufferSize const #

const maxByteBufferSize = *ast.BinaryExpr

maxDecomp const #

const maxDecomp = 0x8000

maxDecomp const #

const maxDecomp = 0x8000

maxDecomp const #

const maxDecomp = 0x8000

maxDecomp const #

const maxDecomp = 0x8000

maxDecomp const #

const maxDecomp = 0x8000

maxDecomp const #

const maxDecomp = 0x8000

maxNFCExpansion const #

const maxNFCExpansion = 3

maxNFKCExpansion const #

const maxNFKCExpansion = 18

maxNonStarters const #

const maxNonStarters = 30

nfcData var #

var nfcData = *ast.CallExpr

nfcIndex var #

nfcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfcIndex = [1408]uint8{...}

nfcIndex var #

nfcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfcIndex = [1408]uint8{...}

nfcIndex var #

nfcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfcIndex = [1408]uint8{...}

nfcIndex var #

nfcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfcIndex = [1408]uint8{...}

nfcIndex var #

nfcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfcIndex = [1408]uint8{...}

nfcIndex var #

nfcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfcIndex = [1408]uint8{...}

nfcSparse var #

var nfcSparse = sparseBlocks{...}

nfcSparseOffset var #

nfcSparseOffset: 151 entries, 302 bytes

var nfcSparseOffset = []uint16{...}

nfcSparseOffset var #

nfcSparseOffset: 142 entries, 284 bytes

var nfcSparseOffset = []uint16{...}

nfcSparseOffset var #

nfcSparseOffset: 163 entries, 326 bytes

var nfcSparseOffset = []uint16{...}

nfcSparseOffset var #

nfcSparseOffset: 149 entries, 298 bytes

var nfcSparseOffset = []uint16{...}

nfcSparseOffset var #

nfcSparseOffset: 156 entries, 312 bytes

var nfcSparseOffset = []uint16{...}

nfcSparseOffset var #

nfcSparseOffset: 145 entries, 290 bytes

var nfcSparseOffset = []uint16{...}

nfcSparseValues var #

nfcSparseValues: 684 entries, 2736 bytes

var nfcSparseValues = [684]valueRange{...}

nfcSparseValues var #

nfcSparseValues: 689 entries, 2756 bytes

var nfcSparseValues = [689]valueRange{...}

nfcSparseValues var #

nfcSparseValues: 688 entries, 2752 bytes

var nfcSparseValues = [688]valueRange{...}

nfcSparseValues var #

nfcSparseValues: 730 entries, 2920 bytes

var nfcSparseValues = [730]valueRange{...}

nfcSparseValues var #

nfcSparseValues: 704 entries, 2816 bytes

var nfcSparseValues = [704]valueRange{...}

nfcSparseValues var #

nfcSparseValues: 682 entries, 2728 bytes

var nfcSparseValues = [682]valueRange{...}

nfcValues var #

nfcValues: 48 blocks, 3072 entries, 6144 bytes The third block is the zero block.

var nfcValues = [3072]uint16{...}

nfcValues var #

nfcValues: 46 blocks, 2944 entries, 5888 bytes The third block is the zero block.

var nfcValues = [2944]uint16{...}

nfcValues var #

nfcValues: 47 blocks, 3008 entries, 6016 bytes The third block is the zero block.

var nfcValues = [3008]uint16{...}

nfcValues var #

nfcValues: 48 blocks, 3072 entries, 6144 bytes The third block is the zero block.

var nfcValues = [3072]uint16{...}

nfcValues var #

nfcValues: 48 blocks, 3072 entries, 6144 bytes The third block is the zero block.

var nfcValues = [3072]uint16{...}

nfcValues var #

nfcValues: 48 blocks, 3072 entries, 6144 bytes The third block is the zero block.

var nfcValues = [3072]uint16{...}

nfkcData var #

var nfkcData = *ast.CallExpr

nfkcIndex var #

nfkcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfkcIndex = [1408]uint8{...}

nfkcIndex var #

nfkcIndex: 22 blocks, 1408 entries, 2816 bytes Block 0 is the zero block.

var nfkcIndex = [1408]uint16{...}

nfkcIndex var #

nfkcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfkcIndex = [1408]uint8{...}

nfkcIndex var #

nfkcIndex: 22 blocks, 1408 entries, 2816 bytes Block 0 is the zero block.

var nfkcIndex = [1408]uint16{...}

nfkcIndex var #

nfkcIndex: 22 blocks, 1408 entries, 1408 bytes Block 0 is the zero block.

var nfkcIndex = [1408]uint8{...}

nfkcIndex var #

nfkcIndex: 22 blocks, 1408 entries, 2816 bytes Block 0 is the zero block.

var nfkcIndex = [1408]uint16{...}

nfkcSparse var #

var nfkcSparse = sparseBlocks{...}

nfkcSparseOffset var #

nfkcSparseOffset: 158 entries, 316 bytes

var nfkcSparseOffset = []uint16{...}

nfkcSparseOffset var #

nfkcSparseOffset: 176 entries, 352 bytes

var nfkcSparseOffset = []uint16{...}

nfkcSparseOffset var #

nfkcSparseOffset: 170 entries, 340 bytes

var nfkcSparseOffset = []uint16{...}

nfkcSparseOffset var #

nfkcSparseOffset: 155 entries, 310 bytes

var nfkcSparseOffset = []uint16{...}

nfkcSparseOffset var #

nfkcSparseOffset: 162 entries, 324 bytes

var nfkcSparseOffset = []uint16{...}

nfkcSparseOffset var #

nfkcSparseOffset: 164 entries, 328 bytes

var nfkcSparseOffset = []uint16{...}

nfkcSparseValues var #

nfkcSparseValues: 877 entries, 3508 bytes

var nfkcSparseValues = [877]valueRange{...}

nfkcSparseValues var #

nfkcSparseValues: 869 entries, 3476 bytes

var nfkcSparseValues = [869]valueRange{...}

nfkcSparseValues var #

nfkcSparseValues: 895 entries, 3580 bytes

var nfkcSparseValues = [895]valueRange{...}

nfkcSparseValues var #

nfkcSparseValues: 875 entries, 3500 bytes

var nfkcSparseValues = [875]valueRange{...}

nfkcSparseValues var #

nfkcSparseValues: 919 entries, 3676 bytes

var nfkcSparseValues = [919]valueRange{...}

nfkcSparseValues var #

nfkcSparseValues: 871 entries, 3484 bytes

var nfkcSparseValues = [871]valueRange{...}

nfkcValues var #

nfkcValues: 94 blocks, 6016 entries, 12032 bytes The third block is the zero block.

var nfkcValues = [6016]uint16{...}

nfkcValues var #

nfkcValues: 92 blocks, 5888 entries, 11776 bytes The third block is the zero block.

var nfkcValues = [5888]uint16{...}

nfkcValues var #

nfkcValues: 94 blocks, 6016 entries, 12032 bytes The third block is the zero block.

var nfkcValues = [6016]uint16{...}

nfkcValues var #

nfkcValues: 93 blocks, 5952 entries, 11904 bytes The third block is the zero block.

var nfkcValues = [5952]uint16{...}

nfkcValues var #

nfkcValues: 94 blocks, 6016 entries, 12032 bytes The third block is the zero block.

var nfkcValues = [6016]uint16{...}

nfkcValues var #

nfkcValues: 97 blocks, 6208 entries, 12416 bytes The third block is the zero block.

var nfkcValues = [6208]uint16{...}

qcInfoMask const #

const qcInfoMask = 0x3F

recompMap var #

recompMap: 7520 bytes (entries only)

var recompMap map[uint32]rune

recompMap var #

recompMap: 7520 bytes (entries only)

var recompMap map[uint32]rune

recompMap var #

recompMap: 7520 bytes (entries only)

var recompMap map[uint32]rune

recompMap var #

recompMap: 7528 bytes (entries only)

var recompMap map[uint32]rune

recompMap var #

recompMap: 7520 bytes (entries only)

var recompMap map[uint32]rune

recompMap var #

recompMap: 7528 bytes (entries only)

var recompMap map[uint32]rune

recompMapOnce var #

var recompMapOnce sync.Once

recompMapOnce var #

var recompMapOnce sync.Once

recompMapOnce var #

var recompMapOnce sync.Once

recompMapOnce var #

var recompMapOnce sync.Once

recompMapOnce var #

var recompMapOnce sync.Once

recompMapOnce var #

var recompMapOnce sync.Once

recompMapPacked const #

const recompMapPacked = *ast.BinaryExpr

recompMapPacked const #

const recompMapPacked = *ast.BinaryExpr

recompMapPacked const #

const recompMapPacked = *ast.BinaryExpr

recompMapPacked const #

const recompMapPacked = *ast.BinaryExpr

recompMapPacked const #

const recompMapPacked = *ast.BinaryExpr

recompMapPacked const #

const recompMapPacked = *ast.BinaryExpr

ssOverflow const #

Indicates a rune caused a segment overflow and a CGJ should be inserted.

const ssOverflow

ssStarter const #

Indicates a rune starts a new segment and should not be added.

const ssStarter

ssSuccess const #

Indicates a rune was successfully added to the segment.

const ssSuccess ssState = iota

Type Aliases

Form type #

A Form denotes a canonical representation of Unicode code points. The Unicode-defined normalization and equivalence forms are: NFC Unicode Normalization Form C NFD Unicode Normalization Form D NFKC Unicode Normalization Form KC NFKD Unicode Normalization Form KD For a Form f, this documentation uses the notation f(x) to mean the bytes or string x converted to the given form. A position n in x is called a boundary if conversion to the form can proceed independently on both sides: f(x) == append(f(x[0:n]), f(x[n:])...) References: https://unicode.org/reports/tr15/ and https://unicode.org/notes/tn5/.

type Form int

insertErr type #

insertErr is an error code returned by insert. Using this type instead of error improves performance up to 20% for many of the benchmarks.

type insertErr int

iterFunc type #

type iterFunc func(*Iter) []byte

lookupFunc type #

functions dispatchable per form

type lookupFunc func(b input, i int) Properties

qcInfo type #

We pack quick check data in 4 bits: 5: Combines forward (0 == false, 1 == true) 4..3: NFC_QC Yes(00), No (10), or Maybe (11) 2: NFD_QC Yes (0) or No (1). No also means there is a decomposition. 1..0: Number of trailing non-starters. When all 4 bits are zero, the character is inert, meaning it is never influenced by normalization.

type qcInfo uint8

ssState type #

ssState is used for reporting the segment state after inserting a rune. It is returned by streamSafe.next.

type ssState int

streamSafe type #

streamSafe implements the policy of when a CGJ should be inserted.

type streamSafe uint8

Structs

Iter struct #

An Iter iterates over a string or byte slice, while normalizing it to a given Form.

type Iter struct {
rb reorderBuffer
buf [maxByteBufferSize]byte
info Properties
next iterFunc
asciiF iterFunc
p int
multiSeg []byte
}

Properties struct #

Properties provides access to normalization properties of a rune.

type Properties struct {
pos uint8
size uint8
ccc uint8
tccc uint8
nLead uint8
flags qcInfo
index uint16
}

formInfo struct #

formInfo holds Form-specific functions and tables.

type formInfo struct {
form Form
composing bool
compatibility bool
info lookupFunc
nextMain iterFunc
}

input struct #

type input struct {
str string
bytes []byte
}

nfcTrie struct #

nfcTrie. Total size: 10798 bytes (10.54 KiB). Checksum: b5981cc85e3bd14.

type nfcTrie struct {

}

nfcTrie struct #

nfcTrie. Total size: 10610 bytes (10.36 KiB). Checksum: 95e8869a9f81e5e6.

type nfcTrie struct {

}

nfcTrie struct #

nfcTrie. Total size: 10332 bytes (10.09 KiB). Checksum: 51cc525b297fc970.

type nfcTrie struct {

}

nfcTrie struct #

nfcTrie. Total size: 10442 bytes (10.20 KiB). Checksum: 4ba400a9d8208e03.

type nfcTrie struct {

}

nfcTrie struct #

nfcTrie. Total size: 10680 bytes (10.43 KiB). Checksum: a555db76d4becdd2.

type nfcTrie struct {

}

nfcTrie struct #

nfcTrie. Total size: 10586 bytes (10.34 KiB). Checksum: dd926e82067bee11.

type nfcTrie struct {

}

nfkcTrie struct #

nfkcTrie. Total size: 18684 bytes (18.25 KiB). Checksum: 113e23c477adfabd.

type nfkcTrie struct {

}

nfkcTrie struct #

nfkcTrie. Total size: 18768 bytes (18.33 KiB). Checksum: c51186dd2412943d.

type nfkcTrie struct {

}

nfkcTrie struct #

nfkcTrie. Total size: 17248 bytes (16.84 KiB). Checksum: 4fb368372b6b1b27.

type nfkcTrie struct {

}

nfkcTrie struct #

nfkcTrie. Total size: 16994 bytes (16.60 KiB). Checksum: c3ed54ee046f3c46.

type nfkcTrie struct {

}

nfkcTrie struct #

nfkcTrie. Total size: 19260 bytes (18.81 KiB). Checksum: 1a0bbc4c8c24da49.

type nfkcTrie struct {

}

nfkcTrie struct #

nfkcTrie. Total size: 17104 bytes (16.70 KiB). Checksum: d985061cf5307b35.

type nfkcTrie struct {

}

normReader struct #

type normReader struct {
rb reorderBuffer
r io.Reader
inbuf []byte
outbuf []byte
bufStart int
lastBoundary int
err error
}

normWriter struct #

type normWriter struct {
rb reorderBuffer
w io.Writer
buf []byte
}

reorderBuffer struct #

reorderBuffer is used to normalize a single segment. Characters inserted with insert are decomposed and reordered based on CCC. The compose method can be used to recombine characters. Note that the byte buffer does not hold the UTF-8 characters in order. Only the rune array is maintained in sorted order. flush writes the resulting segment to a byte array.

type reorderBuffer struct {
rune [maxBufferSize]Properties
byte [maxByteBufferSize]byte
nbyte uint8
ss streamSafe
nrune int
f formInfo
src input
nsrc int
tmpBytes input
out []byte
flushF func(*reorderBuffer) bool
}

sparseBlocks struct #

type sparseBlocks struct {
values []valueRange
offset []uint16
}

valueRange struct #

type valueRange struct {
value uint16
lo byte
hi byte
}

Functions

Append method #

Append returns f(append(out, b...)). The buffer out must be nil, empty, or equal to f(out).

func (f Form) Append(out []byte, src ...byte) []byte

AppendString method #

AppendString returns f(append(out, []byte(s))). The buffer out must be nil, empty, or equal to f(out).

func (f Form) AppendString(out []byte, src string) []byte

BoundaryAfter method #

BoundaryAfter returns true if runes cannot combine with or otherwise interact with this or previous runes.

func (p Properties) BoundaryAfter() bool

BoundaryBefore method #

BoundaryBefore returns true if this rune starts a new segment and cannot combine with any rune on the left.

func (p Properties) BoundaryBefore() bool

Bytes method #

Bytes returns f(b). May return b if f(b) = b.

func (f Form) Bytes(b []byte) []byte

CCC method #

CCC returns the canonical combining class of the underlying rune.

func (p Properties) CCC() uint8

Close method #

Close forces data that remains in the buffer to be written.

func (w *normWriter) Close() error

Decomposition method #

Decomposition returns the decomposition for the underlying rune or nil if there is none.

func (p Properties) Decomposition() []byte

Done method #

Done returns true if there is no more input to process.

func (i *Iter) Done() bool

FirstBoundary method #

FirstBoundary returns the position i of the first boundary in b or -1 if b contains no boundary.

func (f Form) FirstBoundary(b []byte) int

FirstBoundaryInString method #

FirstBoundaryInString returns the position i of the first boundary in s or -1 if s contains no boundary.

func (f Form) FirstBoundaryInString(s string) int

Init method #

Init initializes i to iterate over src after normalizing it to Form f.

func (i *Iter) Init(f Form, src []byte)

InitString method #

InitString initializes i to iterate over src after normalizing it to Form f.

func (i *Iter) InitString(f Form, src string)

IsNormal method #

IsNormal returns true if b == f(b).

func (f Form) IsNormal(b []byte) bool

IsNormalString method #

IsNormalString returns true if s == f(s).

func (f Form) IsNormalString(s string) bool

LastBoundary method #

LastBoundary returns the position i of the last boundary in b or -1 if b contains no boundary.

func (f Form) LastBoundary(b []byte) int

LeadCCC method #

LeadCCC returns the CCC of the first rune in the decomposition. If there is no decomposition, LeadCCC equals CCC.

func (p Properties) LeadCCC() uint8

Next method #

Next returns f(i.input[i.Pos():n]), where n is a boundary of i.input. For any input a and b for which f(a) == f(b), subsequent calls to Next will return the same segments. Modifying runes are grouped together with the preceding starter, if such a starter exists. Although not guaranteed, n will typically be the smallest possible n.

func (i *Iter) Next() []byte

NextBoundary method #

NextBoundary reports the index of the boundary between the first and next segment in b or -1 if atEOF is false and there are not enough bytes to determine this boundary.

func (f Form) NextBoundary(b []byte, atEOF bool) int

NextBoundaryInString method #

NextBoundaryInString reports the index of the boundary between the first and next segment in b or -1 if atEOF is false and there are not enough bytes to determine this boundary.

func (f Form) NextBoundaryInString(s string, atEOF bool) int

Pos method #

Pos returns the byte position at which the next call to Next will commence processing.

func (i *Iter) Pos() int

Properties method #

Properties returns properties for the first rune in s.

func (f Form) Properties(s []byte) Properties

PropertiesString method #

PropertiesString returns properties for the first rune in s.

func (f Form) PropertiesString(s string) Properties

QuickSpan method #

QuickSpan returns a boundary n such that b[0:n] == f(b[0:n]). It is not guaranteed to return the largest such n.

func (f Form) QuickSpan(b []byte) int

QuickSpanString method #

QuickSpanString returns a boundary n such that s[0:n] == f(s[0:n]). It is not guaranteed to return the largest such n.

func (f Form) QuickSpanString(s string) int

Read method #

Read implements the standard read interface.

func (r *normReader) Read(p []byte) (int, error)

Reader method #

Reader returns a new reader that implements Read by reading data from r and returning f(data).

func (f Form) Reader(r io.Reader) io.Reader

Reset method #

Reset implements the Reset method of the transform.Transformer interface.

func (Form) Reset()

Seek method #

Seek sets the segment to be returned by the next call to Next to start at position p. It is the responsibility of the caller to set p to the start of a segment.

func (i *Iter) Seek(offset int64, whence int) (int64, error)

Size method #

Size returns the length of UTF-8 encoding of the rune.

func (p Properties) Size() int

Span method #

Span implements transform.SpanningTransformer. It returns a boundary n such that b[0:n] == f(b[0:n]). It is not guaranteed to return the largest such n.

func (f Form) Span(b []byte, atEOF bool) (n int, err error)

SpanString method #

SpanString returns a boundary n such that s[0:n] == f(s[0:n]). It is not guaranteed to return the largest such n.

func (f Form) SpanString(s string, atEOF bool) (n int, err error)

String method #

String returns f(s).

func (f Form) String(s string) string

TrailCCC method #

TrailCCC returns the CCC of the last rune in the decomposition. If there is no decomposition, TrailCCC equals CCC.

func (p Properties) TrailCCC() uint8

Transform method #

Transform implements the Transform method of the transform.Transformer interface. It may need to write segments of up to MaxSegmentSize at once. Users should either catch ErrShortDst and allow dst to grow or have dst be at least of size MaxTransformChunkSize to be guaranteed of progress.

func (f Form) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Write method #

Write implements the standard write interface. If the last characters are not at a normalization boundary, the bytes will be buffered for the next write. The remaining bytes will be written on close.

func (w *normWriter) Write(data []byte) (n int, err error)

Writer method #

Writer returns a new writer that implements Write(b) by writing f(b) to w. The returned writer may use an internal buffer to maintain state across Write calls. Calling its Close method writes any buffered data to w.

func (f Form) Writer(w io.Writer) io.WriteCloser

_byte method #

func (in *input) _byte(p int) byte

appendFlush function #

appendFlush appends the normalized segment to rb.out.

func appendFlush(rb *reorderBuffer) bool

appendQuick function #

func appendQuick(rb *reorderBuffer, i int) int

appendRune method #

appendRune inserts a rune at the end of the buffer. It is used for Hangul.

func (rb *reorderBuffer) appendRune(r rune)

appendSlice method #

func (in *input) appendSlice(buf []byte, b int, e int) []byte

assignRune method #

assignRune sets a rune at position pos. It is used for Hangul and recomposition.

func (rb *reorderBuffer) assignRune(pos int, r rune)

backwards method #

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

buildRecompMap function #

func buildRecompMap()

bytesAt method #

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

charinfoNFC method #

func (in *input) charinfoNFC(p int) (uint16, int)

charinfoNFKC method #

func (in *input) charinfoNFKC(p int) (uint16, int)

cmpNormalBytes function #

func cmpNormalBytes(rb *reorderBuffer) bool

combine function #

combine returns the combined rune or 0 if it doesn't exist. The caller is responsible for calling recompMapOnce.Do(buildRecompMap) sometime before this is called.

func combine(a rune, b rune) rune

combineHangul method #

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 int, i int, k int)

combinesBackward method #

func (p Properties) combinesBackward() bool

combinesForward method #

func (p Properties) combinesForward() bool

compInfo function #

compInfo converts the information contained in v and sz to a Properties. See the comment at the top of the file for more information on the format.

func compInfo(v uint16, sz int) Properties

compose method #

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()

copySlice method #

func (in *input) copySlice(buf []byte, b int, e int) int

decomposeHangul method #

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)

decomposeHangul function #

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

decomposeSegment function #

decomposeSegment scans the first segment in src into rb. It inserts 0x034f (Grapheme Joiner) when it encounters a sequence of more than 30 non-starters and returns the number of bytes consumed from src or iShortDst or iShortSrc.

func decomposeSegment(rb *reorderBuffer, sp int, atEOF bool) int

decomposeToLastBoundary function #

decomposeToLastBoundary finds an open segment at the end of the buffer and scans it into rb. Returns the buffer minus the last segment.

func decomposeToLastBoundary(rb *reorderBuffer)

doAppend method #

func (f Form) doAppend(out []byte, src input, n int) []byte

doAppend function #

func doAppend(rb *reorderBuffer, out []byte, p int) []byte

doAppendInner function #

func doAppendInner(rb *reorderBuffer, p int) []byte

doFlush method #

func (rb *reorderBuffer) doFlush() bool

doNormComposed function #

func doNormComposed(i *Iter) []byte

doNormDecomposed function #

func doNormDecomposed(i *Iter) []byte

first method #

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)

firstBoundary method #

func (f Form) firstBoundary(src input, nsrc int) int

flush method #

flush appends the normalized segment to out and resets rb.

func (rb *reorderBuffer) flush(out []byte) []byte

flushCopy method #

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

flushTransform function #

func flushTransform(rb *reorderBuffer) bool

hangul method #

func (in *input) hangul(p int) (r rune)

hasDecomposition method #

func (p Properties) hasDecomposition() bool

init method #

func (rb *reorderBuffer) init(f Form, src []byte)

initString method #

func (rb *reorderBuffer) initString(f Form, src string)

inputBytes function #

func inputBytes(str []byte) input

inputString function #

func inputString(str string) input

insertCGJ method #

insertCGJ inserts a Combining Grapheme Joiner (0x034f) into rb.

func (rb *reorderBuffer) insertCGJ()

insertDecomposed method #

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

insertFlush method #

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

insertOrdered method #

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)

insertSingle method #

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)

insertUnsafe method #

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)

isHangul function #

func isHangul(b []byte) bool

isHangulString function #

func isHangulString(b string) bool

isHangulWithoutJamoT function #

func isHangulWithoutJamoT(b []byte) bool

isInert method #

func (p Properties) isInert() bool

isJamoVT function #

Caller must ensure len(b) >= 2.

func isJamoVT(b []byte) bool

isMax method #

func (ss streamSafe) isMax() bool

isYesC method #

func (p Properties) isYesC() bool

isYesD method #

func (p Properties) isYesD() bool

lastBoundary function #

func lastBoundary(fd *formInfo, b []byte) int

lastRuneStart function #

lastRuneStart returns the runeInfo and position of the last rune in buf or the zero runeInfo and -1 if no rune was found.

func lastRuneStart(fd *formInfo, buf []byte) (Properties, int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup determines the type of block n and looks up the value for b. For n < t.cutoff, the block is a simple lookup table. Otherwise, the block is a list of ranges with an accompanying value. Given a matching range r, the value for b is by r.value + (b - r.lo) * stride.

func (t *sparseBlocks) lookup(n uint32, b byte) uint16

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookup(s []byte) (v uint16, sz int)

lookupInfoNFC function #

func lookupInfoNFC(b input, i int) Properties

lookupInfoNFKC function #

func lookupInfoNFKC(b input, i int) Properties

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *nfkcTrie) lookupString(s string) (v uint16, sz int)

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupStringUnsafe(s string) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfkcTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *nfcTrie) lookupUnsafe(s []byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *nfcTrie) lookupValue(n uint32, b byte) uint16

multiSegment method #

func (p Properties) multiSegment() bool

nLeadingNonStarters method #

func (p Properties) nLeadingNonStarters() uint8

nTrailingNonStarters method #

func (p Properties) nTrailingNonStarters() uint8

newNfcTrie function #

func newNfcTrie(i int) *nfcTrie

newNfcTrie function #

func newNfcTrie(i int) *nfcTrie

newNfcTrie function #

func newNfcTrie(i int) *nfcTrie

newNfcTrie function #

func newNfcTrie(i int) *nfcTrie

newNfcTrie function #

func newNfcTrie(i int) *nfcTrie

newNfcTrie function #

func newNfcTrie(i int) *nfcTrie

newNfkcTrie function #

func newNfkcTrie(i int) *nfkcTrie

newNfkcTrie function #

func newNfkcTrie(i int) *nfkcTrie

newNfkcTrie function #

func newNfkcTrie(i int) *nfkcTrie

newNfkcTrie function #

func newNfkcTrie(i int) *nfkcTrie

newNfkcTrie function #

func newNfkcTrie(i int) *nfkcTrie

newNfkcTrie function #

func newNfkcTrie(i int) *nfkcTrie

next method #

insert returns a ssState value to indicate whether a rune represented by p can be inserted.

func (ss *streamSafe) next(p Properties) ssState

nextASCIIBytes function #

func nextASCIIBytes(i *Iter) []byte

nextASCIIString function #

func nextASCIIString(i *Iter) []byte

nextBoundary method #

func (f Form) nextBoundary(src input, nsrc int, atEOF bool) int

nextCGJCompose function #

func nextCGJCompose(i *Iter) []byte

nextCGJDecompose function #

func nextCGJDecompose(i *Iter) []byte

nextComposed function #

nextComposed is the implementation of Next for forms NFC and NFKC.

func nextComposed(i *Iter) []byte

nextDecomposed function #

nextDecomposed is the implementation of Next for forms NFD and NFKD.

func nextDecomposed(i *Iter) (next []byte)

nextDone function #

func nextDone(i *Iter) []byte

nextHangul function #

func nextHangul(i *Iter) []byte

nextMulti function #

nextMulti is used for iterating over multi-segment decompositions for decomposing normal forms.

func nextMulti(i *Iter) []byte

nextMultiNorm function #

nextMultiNorm is used for iterating over multi-segment decompositions for composing normal forms.

func nextMultiNorm(i *Iter) []byte

patchTail function #

patchTail fixes a case where a rune may be incorrectly normalized if it is followed by illegal continuation bytes. It returns the patched buffer and whether the decomposition is still in progress.

func patchTail(rb *reorderBuffer) bool

quickSpan method #

quickSpan returns a boundary n such that src[0:n] == f(src[0:n]) and whether any non-normalized parts were found. If atEOF is false, n will not point past the last segment if this segment might be become non-normalized by appending other runes.

func (f *formInfo) quickSpan(src input, i int, end int, atEOF bool) (n int, ok bool)

reset method #

reset discards all characters from the buffer.

func (rb *reorderBuffer) reset()

returnSlice method #

returnSlice returns a slice of the underlying input type as a byte slice. If the underlying is of type []byte, it will simply return a slice. If the underlying is of type string, it will copy the slice to the buffer and return that.

func (i *Iter) returnSlice(a int, b int) []byte

runeAt method #

runeAt returns the rune at position n. It is used for Hangul and recomposition.

func (rb *reorderBuffer) runeAt(n int) rune

setBytes method #

func (in *input) setBytes(str []byte)

setDone method #

func (i *Iter) setDone()

setFlusher method #

func (rb *reorderBuffer) setFlusher(out []byte, f func(*reorderBuffer) bool)

setString method #

func (in *input) setString(str string)

skipASCII method #

func (in *input) skipASCII(p int, max int) int

skipContinuationBytes method #

func (in *input) skipContinuationBytes(p int) int

transform method #

transform implements the transform.Transformer interface. It is only called when quickSpan does not pass for a given string.

func (f Form) transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Generated with Arrow