Ejemplo n.º 1
0
// ignore returns an initialized boolean array based on the given Level.
// A negative value means using the default setting of quaternary.
func ignore(level colltab.Level) (ignore [colltab.NumLevels]bool) {
	if level < 0 {
		level = colltab.Quaternary
	}
	for i := range ignore {
		ignore[i] = level < colltab.Level(i)
	}
	return ignore
}
Ejemplo n.º 2
0
func (p processor) Insert(level int, str, context, extend string) error {
	str = context + str
	if *test {
		testInput.add(str)
	}
	// TODO: mimic bug in old maketables: remove.
	err := p.t.Insert(colltab.Level(level-1), str, context+extend)
	failOnError(err)
	return nil
}
Ejemplo n.º 3
0
func (o opts) collator() *Collator {
	c := &Collator{
		options: options{
			ignore:      ignore(colltab.Level(o.lev - 1)),
			alternate:   o.alt,
			backwards:   o.backwards,
			caseLevel:   o.caseLevel,
			variableTop: uint32(o.top),
		},
	}
	return c
}