// 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.
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.
// 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 *trie) lookup(s []byte) (v uint16, sz int) {
	c0 := s[0]
	switch {
	case c0 < tx:
		return t.values[c0], 1
	case c0 < t2:
		return 0, 1
	case c0 < t3:
		if len(s) < 2 {
			return 0, 0
		}
		i := t.index[c0]
		c1 := s[1]
		if c1 < tx || t2 <= c1 {
			return 0, 1
		}
		return t.lookupValue(i, c1), 2
	case c0 < t4:
		if len(s) < 3 {
			return 0, 0
		}
		i := t.index[c0]
		c1 := s[1]
		if c1 < tx || t2 <= c1 {
			return 0, 1
		}
		o := uint16(i)<<6 + uint16(c1)&maskx
		i = t.index[o]
		c2 := s[2]
		if c2 < tx || t2 <= c2 {
			return 0, 2
		}
		return t.lookupValue(i, c2), 3
	case c0 < t5:
		if len(s) < 4 {
			return 0, 0
		}
		i := t.index[c0]
		c1 := s[1]
		if c1 < tx || t2 <= c1 {
			return 0, 1
		}
		o := uint16(i)<<6 + uint16(c1)&maskx
		i = t.index[o]
		c2 := s[2]
		if c2 < tx || t2 <= c2 {
			return 0, 2
		}
		o = uint16(i)<<6 + uint16(c2)&maskx
		i = t.index[o]
		c3 := s[3]
		if c3 < tx || t2 <= c3 {
			return 0, 3
		}
		return t.lookupValue(i, c3), 4
	}
	return 0, 1
}
func ( t * trie ) lookup ( s [ ] byte ) ( v uint16 , sz int ) { c0 := s [ 0 ] switch { case c0 < tx : return t . values [ c0 ] , 1 case c0 < t2 : return 0 , 1 case c0 < t3 : if len ( s ) < 2 { return 0 , 0 } i := t . index [ c0 ] c1 := s [ 1 ] if c1 < tx || t2 <= c1 { return 0 , 1 } return t . lookupValue ( i , c1 ) , 2 case c0 < t4 : if len ( s ) < 3 { return 0 , 0 } i := t . index [ c0 ] c1 := s [ 1 ] if c1 < tx || t2 <= c1 { return 0 , 1 } o := uint16 ( i ) << 6 + uint16 ( c1 ) & maskx i = t . index [ o ] c2 := s [ 2 ] if c2 < tx || t2 <= c2 { return 0 , 2 } return t . lookupValue ( i , c2 ) , 3 case c0 < t5 : if len ( s ) < 4 { return 0 , 0 } i := t . index [ c0 ] c1 := s [ 1 ] if c1 < tx || t2 <= c1 { return 0 , 1 } o := uint16 ( i ) << 6 + uint16 ( c1 ) & maskx i = t . index [ o ] c2 := s [ 2 ] if c2 < tx || t2 <= c2 { return 0 , 2 } o = uint16 ( i ) << 6 + uint16 ( c2 ) & maskx i = t . index [ o ] c3 := s [ 3 ] if c3 < tx || t2 <= c3 { return 0 , 3 } return t . lookupValue ( i , c3 ) , 4 } return 0 , 1 }
lookup returns the trie value for the first UTF-8 encoding in s and
the width in bytes of this encoding.
lookup returns the trie value for the first UTF - 8 encoding in s and the width in bytes of this encoding .
// Illegal rune