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.
7 // Normalization table generator.
8 // Data read from the web.
9 // See forminfo.go for a description of the trie values associated with each rune.
23 "golang.org/x/text/internal/gen"
24 "golang.org/x/text/internal/triegen"
25 "golang.org/x/text/internal/ucd"
32 loadCompositionExclusions()
33 completeCharFields(FCanonical)
34 completeCharFields(FCompatibility)
35 computeNonStarterCounts()
44 tablelist = flag.String("tables",
46 "comma-separated list of which tables to generate; "+
47 "can be 'decomp', 'recomp', 'info' and 'all'")
48 test = flag.Bool("test",
50 "test existing tables against DerivedNormalizationProps and generate test data for regression testing")
51 verbose = flag.Bool("verbose",
53 "write data to stdout as it is parsed")
56 const MaxChar = 0x10FFFF // anything above this shouldn't exist
58 // Quick Check properties of runes allow us to quickly
59 // determine whether a rune may occur in a normal form.
60 // For a given normal form, a rune may be guaranteed to occur
61 // verbatim (QC=Yes), may or may not combine with another
62 // rune (QC=Maybe), or may not occur (QC=No).
66 QCUnknown QCResult = iota
72 func (r QCResult) String() string {
81 return "***UNKNOWN***"
85 FCanonical = iota // NFC or NFD
86 FCompatibility // NFKC or NFKD
91 MComposed = iota // NFC or NFKC
92 MDecomposed // NFD or NFKD
96 // This contains only the properties we're interested in.
99 codePoint rune // if zero, this index is not a valid code point.
100 ccc uint8 // canonical combining class
102 excludeInComp bool // from CompositionExclusions.txt
103 compatDecomp bool // it has a compatibility expansion
105 nTrailingNonStarters uint8
106 nLeadingNonStarters uint8 // must be equal to trailing if non-zero
108 forms [FNumberOfFormTypes]FormInfo // For FCanonical and FCompatibility
113 var chars = make([]Char, MaxChar+1)
114 var cccMap = make(map[uint8]uint8)
116 func (c Char) String() string {
117 buf := new(bytes.Buffer)
119 fmt.Fprintf(buf, "%U [%s]:\n", c.codePoint, c.name)
120 fmt.Fprintf(buf, " ccc: %v\n", c.ccc)
121 fmt.Fprintf(buf, " excludeInComp: %v\n", c.excludeInComp)
122 fmt.Fprintf(buf, " compatDecomp: %v\n", c.compatDecomp)
123 fmt.Fprintf(buf, " state: %v\n", c.state)
124 fmt.Fprintf(buf, " NFC:\n")
125 fmt.Fprint(buf, c.forms[FCanonical])
126 fmt.Fprintf(buf, " NFKC:\n")
127 fmt.Fprint(buf, c.forms[FCompatibility])
132 // In UnicodeData.txt, some ranges are marked like this:
133 // 3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
134 // 4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
135 // parseCharacter keeps a state variable indicating the weirdness.
139 SNormal State = iota // known to be zero for the type
145 var lastChar = rune('\u0000')
147 func (c Char) isValid() bool {
148 return c.codePoint != 0 && c.state != SMissing
151 type FormInfo struct {
152 quickCheck [MNumberOfModes]QCResult // index: MComposed or MDecomposed
153 verified [MNumberOfModes]bool // index: MComposed or MDecomposed
155 combinesForward bool // May combine with rune on the right
156 combinesBackward bool // May combine with rune on the left
157 isOneWay bool // Never appears in result
158 inDecomp bool // Some decompositions result in this char.
160 expandedDecomp Decomposition
163 func (f FormInfo) String() string {
164 buf := bytes.NewBuffer(make([]byte, 0))
166 fmt.Fprintf(buf, " quickCheck[C]: %v\n", f.quickCheck[MComposed])
167 fmt.Fprintf(buf, " quickCheck[D]: %v\n", f.quickCheck[MDecomposed])
168 fmt.Fprintf(buf, " cmbForward: %v\n", f.combinesForward)
169 fmt.Fprintf(buf, " cmbBackward: %v\n", f.combinesBackward)
170 fmt.Fprintf(buf, " isOneWay: %v\n", f.isOneWay)
171 fmt.Fprintf(buf, " inDecomp: %v\n", f.inDecomp)
172 fmt.Fprintf(buf, " decomposition: %X\n", f.decomp)
173 fmt.Fprintf(buf, " expandedDecomp: %X\n", f.expandedDecomp)
178 type Decomposition []rune
180 func parseDecomposition(s string, skipfirst bool) (a []rune, err error) {
181 decomp := strings.Split(s, " ")
182 if len(decomp) > 0 && skipfirst {
185 for _, d := range decomp {
186 point, err := strconv.ParseUint(d, 16, 64)
190 a = append(a, rune(point))
195 func loadUnicodeData() {
196 f := gen.OpenUCDFile("UnicodeData.txt")
200 r := p.Rune(ucd.CodePoint)
203 char.ccc = uint8(p.Uint(ucd.CanonicalCombiningClass))
204 decmap := p.String(ucd.DecompMapping)
206 exp, err := parseDecomposition(decmap, false)
210 exp, err = parseDecomposition(decmap, true)
212 log.Fatalf(`%U: bad decomp |%v|: "%s"`, r, decmap, err)
218 char.name = p.String(ucd.Name)
220 char.forms[FCompatibility].decomp = exp
222 char.forms[FCanonical].decomp = exp
224 char.compatDecomp = true
227 char.forms[FCompatibility].decomp = exp
230 if err := p.Err(); err != nil {
235 // compactCCC converts the sparse set of CCC values to a continguous one,
236 // reducing the number of bits needed from 8 to 6.
238 m := make(map[uint8]uint8)
239 for i := range chars {
244 for v, _ := range m {
245 cccs = append(cccs, int(v))
248 for i, c := range cccs {
249 cccMap[uint8(i)] = uint8(c)
250 m[uint8(c)] = uint8(i)
252 for i := range chars {
258 log.Fatalf("too many difference CCC values: %d >= 64", len(m))
262 // CompositionExclusions.txt has form:
264 // See http://unicode.org/reports/tr44/ for full explanation
265 func loadCompositionExclusions() {
266 f := gen.OpenUCDFile("CompositionExclusions.txt")
270 c := &chars[p.Rune(0)]
272 log.Fatalf("%U: Duplicate entry in exclusions.", c.codePoint)
274 c.excludeInComp = true
276 if e := p.Err(); e != nil {
281 // hasCompatDecomp returns true if any of the recursive
282 // decompositions contains a compatibility expansion.
283 // In this case, the character may not occur in NFK*.
284 func hasCompatDecomp(r rune) bool {
289 for _, d := range c.forms[FCompatibility].decomp {
290 if hasCompatDecomp(d) {
297 // Hangul related constants.
300 HangulEnd = 0xD7A4 // hangulBase + Jamo combinations (19 * 21 * 28)
309 JamoLVTCount = 19 * 21 * 28
313 func isHangul(r rune) bool {
314 return HangulBase <= r && r < HangulEnd
317 func isHangulWithoutJamoT(r rune) bool {
322 return r < JamoLVTCount && r%JamoTCount == 0
325 func ccc(r rune) uint8 {
329 // Insert a rune in a buffer, ordered by Canonical Combining Class.
330 func insertOrdered(b Decomposition, r rune) Decomposition {
337 if ccc(b[n-1]) <= cc {
347 // Recursively decompose.
348 func decomposeRecursive(form int, r rune, d Decomposition) Decomposition {
349 dcomp := chars[r].forms[form].decomp
351 return insertOrdered(d, r)
353 for _, c := range dcomp {
354 d = decomposeRecursive(form, c, d)
359 func completeCharFields(form int) {
360 // Phase 0: pre-expand decomposition.
361 for i := range chars {
362 f := &chars[i].forms[form]
363 if len(f.decomp) == 0 {
366 exp := make(Decomposition, 0)
367 for _, c := range f.decomp {
368 exp = decomposeRecursive(form, c, exp)
370 f.expandedDecomp = exp
373 // Phase 1: composition exclusion, mark decomposition.
374 for i := range chars {
378 // Marks script-specific exclusions and version restricted.
379 f.isOneWay = c.excludeInComp
382 f.isOneWay = f.isOneWay || len(f.decomp) == 1
384 // Non-starter decompositions
385 if len(f.decomp) > 1 {
386 chk := c.ccc != 0 || chars[f.decomp[0]].ccc != 0
387 f.isOneWay = f.isOneWay || chk
390 // Runes that decompose into more than two runes.
391 f.isOneWay = f.isOneWay || len(f.decomp) > 2
393 if form == FCompatibility {
394 f.isOneWay = f.isOneWay || hasCompatDecomp(c.codePoint)
397 for _, r := range f.decomp {
398 chars[r].forms[form].inDecomp = true
402 // Phase 2: forward and backward combining.
403 for i := range chars {
407 if !f.isOneWay && len(f.decomp) == 2 {
408 f0 := &chars[f.decomp[0]].forms[form]
409 f1 := &chars[f.decomp[1]].forms[form]
411 f0.combinesForward = true
414 f1.combinesBackward = true
417 if isHangulWithoutJamoT(rune(i)) {
418 f.combinesForward = true
422 // Phase 3: quick check values.
423 for i := range chars {
428 case len(f.decomp) > 0:
429 f.quickCheck[MDecomposed] = QCNo
430 case isHangul(rune(i)):
431 f.quickCheck[MDecomposed] = QCNo
433 f.quickCheck[MDecomposed] = QCYes
437 f.quickCheck[MComposed] = QCNo
438 case (i & 0xffff00) == JamoLBase:
439 f.quickCheck[MComposed] = QCYes
440 if JamoLBase <= i && i < JamoLEnd {
441 f.combinesForward = true
443 if JamoVBase <= i && i < JamoVEnd {
444 f.quickCheck[MComposed] = QCMaybe
445 f.combinesBackward = true
446 f.combinesForward = true
448 if JamoTBase <= i && i < JamoTEnd {
449 f.quickCheck[MComposed] = QCMaybe
450 f.combinesBackward = true
452 case !f.combinesBackward:
453 f.quickCheck[MComposed] = QCYes
455 f.quickCheck[MComposed] = QCMaybe
460 func computeNonStarterCounts() {
461 // Phase 4: leading and trailing non-starter count
462 for i := range chars {
465 runes := []rune{rune(i)}
466 // We always use FCompatibility so that the CGJ insertion points do not
467 // change for repeated normalizations with different forms.
468 if exp := c.forms[FCompatibility].expandedDecomp; len(exp) > 0 {
471 // We consider runes that combine backwards to be non-starters for the
472 // purpose of Stream-Safe Text Processing.
473 for _, r := range runes {
474 if cr := &chars[r]; cr.ccc == 0 && !cr.forms[FCompatibility].combinesBackward {
477 c.nLeadingNonStarters++
479 for i := len(runes) - 1; i >= 0; i-- {
480 if cr := &chars[runes[i]]; cr.ccc == 0 && !cr.forms[FCompatibility].combinesBackward {
483 c.nTrailingNonStarters++
485 if c.nTrailingNonStarters > 3 {
486 log.Fatalf("%U: Decomposition with more than 3 (%d) trailing modifiers (%U)", i, c.nTrailingNonStarters, runes)
489 if isHangul(rune(i)) {
490 c.nTrailingNonStarters = 2
491 if isHangulWithoutJamoT(rune(i)) {
492 c.nTrailingNonStarters = 1
496 if l, t := c.nLeadingNonStarters, c.nTrailingNonStarters; l > 0 && l != t {
497 log.Fatalf("%U: number of leading and trailing non-starters should be equal (%d vs %d)", i, l, t)
499 if t := c.nTrailingNonStarters; t > 3 {
500 log.Fatalf("%U: number of trailing non-starters is %d > 3", t)
505 func printBytes(w io.Writer, b []byte, name string) {
506 fmt.Fprintf(w, "// %s: %d bytes\n", name, len(b))
507 fmt.Fprintf(w, "var %s = [...]byte {", name)
508 for i, c := range b {
511 fmt.Fprintf(w, "\n// Bytes %x - %x\n", i, i+63)
515 fmt.Fprintf(w, "0x%.2X, ", c)
517 fmt.Fprint(w, "\n}\n\n")
520 // See forminfo.go for format.
521 func makeEntry(f *FormInfo, c *Char) uint16 {
523 if r := c.codePoint; HangulBase <= r && r < HangulEnd {
526 if f.combinesForward {
529 if f.quickCheck[MDecomposed] == QCNo {
532 switch f.quickCheck[MComposed] {
539 log.Fatalf("Illegal quickcheck value %v.", f.quickCheck[MComposed])
541 e |= uint16(c.nTrailingNonStarters)
545 // decompSet keeps track of unique decompositions, grouped by whether
546 // the decomposition is followed by a trailing and/or leading CCC.
547 type decompSet [7]map[string]bool
556 firstStarterWithNLead
560 var cname = []string{"firstMulti", "firstCCC", "endMulti", "firstLeadingCCC", "firstCCCZeroExcept", "firstStarterWithNLead", "lastDecomp"}
562 func makeDecompSet() decompSet {
565 m[i] = make(map[string]bool)
569 func (m *decompSet) insert(key int, s string) {
573 func printCharInfoTables(w io.Writer) int {
574 mkstr := func(r rune, f *FormInfo) (int, string) {
575 d := f.expandedDecomp
576 s := string([]rune(d))
577 if max := 1 << 6; len(s) >= max {
578 const msg = "%U: too many bytes in decomposition: %d >= %d"
579 log.Fatalf(msg, r, len(s), max)
581 head := uint8(len(s))
582 if f.quickCheck[MComposed] != QCYes {
585 if f.combinesForward {
588 s = string([]byte{head}) + s
591 tccc := ccc(d[len(d)-1])
593 if cc != 0 && lccc == 0 && tccc == 0 {
594 log.Fatalf("%U: trailing and leading ccc are 0 for non-zero ccc %d", r, cc)
596 if tccc < lccc && lccc != 0 {
597 const msg = "%U: lccc (%d) must be <= tcc (%d)"
598 log.Fatalf(msg, r, lccc, tccc)
600 index := normalDecomp
601 nTrail := chars[r].nTrailingNonStarters
602 nLead := chars[r].nLeadingNonStarters
603 if tccc > 0 || lccc > 0 || nTrail > 0 {
606 s += string([]byte{tccc})
608 for _, r := range d[1:] {
613 if lccc > 0 || nLead > 0 {
614 s += string([]byte{lccc})
615 if index == firstCCC {
616 log.Fatalf("%U: multi-segment decomposition not supported for decompositions with leading CCC != 0", r)
618 index = firstLeadingCCC
622 log.Fatalf("%U: for lccc != ccc, expected ccc to be 0; was %d", r, cc)
624 index = firstCCCZeroExcept
626 } else if len(d) > 1 {
632 decompSet := makeDecompSet()
633 const nLeadStr = "\x00\x01" // 0-byte length and tccc with nTrail.
634 decompSet.insert(firstStarterWithNLead, nLeadStr)
636 // Store the uniqued decompositions in a byte buffer,
637 // preceded by their byte length.
638 for _, c := range chars {
639 for _, f := range c.forms {
640 if len(f.expandedDecomp) == 0 {
643 if f.combinesBackward {
644 log.Fatalf("%U: combinesBackward and decompose", c.codePoint)
646 index, s := mkstr(c.codePoint, &f)
647 decompSet.insert(index, s)
651 decompositions := bytes.NewBuffer(make([]byte, 0, 10000))
653 positionMap := make(map[string]uint16)
654 decompositions.WriteString("\000")
655 fmt.Fprintln(w, "const (")
656 for i, m := range decompSet {
662 for _, s := range sa {
663 p := decompositions.Len()
664 decompositions.WriteString(s)
665 positionMap[s] = uint16(p)
668 fmt.Fprintf(w, "%s = 0x%X\n", cname[i], decompositions.Len())
671 fmt.Fprintln(w, "maxDecomp = 0x8000")
673 b := decompositions.Bytes()
674 printBytes(w, b, "decomps")
677 varnames := []string{"nfc", "nfkc"}
678 for i := 0; i < FNumberOfFormTypes; i++ {
679 trie := triegen.NewTrie(varnames[i])
681 for r, c := range chars {
683 d := f.expandedDecomp
685 _, key := mkstr(c.codePoint, &f)
686 trie.Insert(rune(r), uint64(positionMap[key]))
687 if c.ccc != ccc(d[0]) {
688 // We assume the lead ccc of a decomposition !=0 in this case.
690 log.Fatalf("Expected leading CCC to be non-zero; ccc is %d", c.ccc)
693 } else if c.nLeadingNonStarters > 0 && len(f.expandedDecomp) == 0 && c.ccc == 0 && !f.combinesBackward {
694 // Handle cases where it can't be detected that the nLead should be equal
696 trie.Insert(c.codePoint, uint64(positionMap[nLeadStr]))
697 } else if v := makeEntry(&f, &c)<<8 | uint16(c.ccc); v != 0 {
698 trie.Insert(c.codePoint, uint64(0x8000|v))
701 sz, err := trie.Gen(w, triegen.Compact(&normCompacter{name: varnames[i]}))
710 func contains(sa []string, s string) bool {
711 for _, a := range sa {
723 if *tablelist == "" {
726 list := strings.Split(*tablelist, ",")
727 if *tablelist == "all" {
728 list = []string{"recomp", "info"}
731 // Compute maximum decomposition size.
733 for _, c := range chars {
734 if n := len(string(c.forms[FCompatibility].expandedDecomp)); n > max {
739 fmt.Fprintln(w, "const (")
740 fmt.Fprintln(w, "\t// Version is the Unicode edition from which the tables are derived.")
741 fmt.Fprintf(w, "\tVersion = %q\n", gen.UnicodeVersion())
743 fmt.Fprintln(w, "\t// MaxTransformChunkSize indicates the maximum number of bytes that Transform")
744 fmt.Fprintln(w, "\t// may need to write atomically for any Form. Making a destination buffer at")
745 fmt.Fprintln(w, "\t// least this size ensures that Transform can always make progress and that")
746 fmt.Fprintln(w, "\t// the user does not need to grow the buffer on an ErrShortDst.")
747 fmt.Fprintf(w, "\tMaxTransformChunkSize = %d+maxNonStarters*4\n", len(string(0x034F))+max)
748 fmt.Fprintln(w, ")\n")
750 // Print the CCC remap table.
752 fmt.Fprintf(w, "var ccc = [%d]uint8{", len(cccMap))
753 for i := 0; i < len(cccMap); i++ {
757 fmt.Fprintf(w, "%3d, ", cccMap[uint8(i)])
759 fmt.Fprintln(w, "\n}\n")
761 if contains(list, "info") {
762 size += printCharInfoTables(w)
765 if contains(list, "recomp") {
766 // Note that we use 32 bit keys, instead of 64 bit.
767 // This clips the bits of three entries, but we know
768 // this won't cause a collision. The compiler will catch
769 // any changes made to UnicodeData.txt that introduces
771 // Note that the recomposition map for NFC and NFKC
776 for _, c := range chars {
777 f := c.forms[FCanonical]
778 if !f.isOneWay && len(f.decomp) > 0 {
784 fmt.Fprintf(w, "// recompMap: %d bytes (entries only)\n", sz)
785 fmt.Fprintln(w, "var recompMap = map[uint32]rune{")
786 for i, c := range chars {
787 f := c.forms[FCanonical]
789 if !f.isOneWay && len(d) > 0 {
790 key := uint32(uint16(d[0]))<<16 + uint32(uint16(d[1]))
791 fmt.Fprintf(w, "0x%.8X: 0x%.4X,\n", key, i)
794 fmt.Fprintf(w, "}\n\n")
797 fmt.Fprintf(w, "// Total size of tables: %dKB (%d bytes)\n", (size+512)/1024, size)
798 gen.WriteGoFile("tables.go", "norm", w.Bytes())
803 for _, c := range chars {
804 if !c.isValid() || c.state == SMissing {
812 // verifyComputed does various consistency tests.
813 func verifyComputed() {
814 for i, c := range chars {
815 for _, f := range c.forms {
816 isNo := (f.quickCheck[MDecomposed] == QCNo)
817 if (len(f.decomp) > 0) != isNo && !isHangul(rune(i)) {
818 log.Fatalf("%U: NF*D QC must be No if rune decomposes", i)
821 isMaybe := f.quickCheck[MComposed] == QCMaybe
822 if f.combinesBackward != isMaybe {
823 log.Fatalf("%U: NF*C QC must be Maybe if combinesBackward", i)
825 if len(f.decomp) > 0 && f.combinesForward && isMaybe {
826 log.Fatalf("%U: NF*C QC must be Yes or No if combinesForward and decomposes", i)
829 if len(f.expandedDecomp) != 0 {
832 if a, b := c.nLeadingNonStarters > 0, (c.ccc > 0 || f.combinesBackward); a != b {
833 // We accept these runes to be treated differently (it only affects
834 // segment breaking in iteration, most likely on improper use), but
835 // reconsider if more characters are added.
836 // U+FF9E HALFWIDTH KATAKANA VOICED SOUND MARK;Lm;0;L;<narrow> 3099;;;;N;;;;;
837 // U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK;Lm;0;L;<narrow> 309A;;;;N;;;;;
838 // U+3133 HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<compat> 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;;
839 // U+318E HANGUL LETTER ARAEAE;Lo;0;L;<compat> 11A1;;;;N;HANGUL LETTER ALAE AE;;;;
840 // U+FFA3 HALFWIDTH HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<narrow> 3133;;;;N;HALFWIDTH HANGUL LETTER GIYEOG SIOS;;;;
841 // U+FFDC HALFWIDTH HANGUL LETTER I;Lo;0;L;<narrow> 3163;;;;N;;;;;
842 if i != 0xFF9E && i != 0xFF9F && !(0x3133 <= i && i <= 0x318E) && !(0xFFA3 <= i && i <= 0xFFDC) {
843 log.Fatalf("%U: nLead was %v; want %v", i, a, b)
847 nfc := c.forms[FCanonical]
848 nfkc := c.forms[FCompatibility]
849 if nfc.combinesBackward != nfkc.combinesBackward {
850 log.Fatalf("%U: Cannot combine combinesBackward\n", c.codePoint)
855 // Use values in DerivedNormalizationProps.txt to compare against the
856 // values we computed.
857 // DerivedNormalizationProps.txt has form:
858 // 00C0..00C5 ; NFD_QC; N # ...
859 // 0374 ; NFD_QC; N # ...
860 // See http://unicode.org/reports/tr44/ for full explanation
862 f := gen.OpenUCDFile("DerivedNormalizationProps.txt")
873 ftype, mode = FCanonical, MComposed
875 ftype, mode = FCanonical, MDecomposed
877 ftype, mode = FCompatibility, MComposed
879 ftype, mode = FCompatibility, MDecomposed
892 log.Fatalf(`Unexpected quick check value "%s"`, p.String(2))
894 if got := c.forms[ftype].quickCheck[mode]; got != qr {
895 log.Printf("%U: FAILED %s (was %v need %v)\n", r, qt, got, qr)
897 c.forms[ftype].verified[mode] = true
899 if err := p.Err(); err != nil {
902 // Any unspecified value must be QCYes. Verify this.
903 for i, c := range chars {
904 for j, fd := range c.forms {
905 for k, qr := range fd.quickCheck {
906 if !fd.verified[k] && qr != QCYes {
907 m := "%U: FAIL F:%d M:%d (was %v need Yes) %s\n"
908 log.Printf(m, i, j, k, qr, c.name)
915 var testHeader = `const (
921 type formData struct {
927 type runeData struct {
932 f [2]formData // 0: canonical; 1: compatibility
935 func f(qc uint8, cf bool, dec string) [2]formData {
936 return [2]formData{{qc, cf, dec}, {qc, cf, dec}}
939 func g(qc, qck uint8, cf, cfk bool, d, dk string) [2]formData {
940 return [2]formData{{qc, cf, d}, {qck, cfk, dk}}
943 var testData = []runeData{
946 func printTestdata() {
947 type lastInfo struct {
956 fmt.Fprintf(w, testHeader)
957 for r, c := range chars {
958 f := c.forms[FCanonical]
959 qc, cf, d := f.quickCheck[MComposed], f.combinesForward, string(f.expandedDecomp)
960 f = c.forms[FCompatibility]
961 qck, cfk, dk := f.quickCheck[MComposed], f.combinesForward, string(f.expandedDecomp)
963 if d == dk && qc == qck && cf == cfk {
964 s = fmt.Sprintf("f(%s, %v, %q)", qc, cf, d)
966 s = fmt.Sprintf("g(%s, %s, %v, %v, %q, %q)", qc, qck, cf, cfk, d, dk)
968 current := lastInfo{c.ccc, c.nLeadingNonStarters, c.nTrailingNonStarters, s}
970 fmt.Fprintf(w, "\t{0x%x, %d, %d, %d, %s},\n", r, c.origCCC, c.nLeadingNonStarters, c.nTrailingNonStarters, s)
975 gen.WriteGoFile("data_test.go", "norm", w.Bytes())