// stateE0 is the state after reading the mantissa, e, optional sign,
// and at least one digit of the exponent in a number,
// such as after reading `314e-2` or `0.314e+1` or `3.14e0`.
436926
func stateE0(s *Scanner, c int) int {
	if '0' <= c && c <= '9' {
		s.Step = stateE0
		return ScanContinue
	}
	return stateEndValue(s, c)
}
684846
func lexNumber(l *lexer) stateFn {
	if !l.scanNumber() {
		return l.errorf("bad number syntax: %q", l.input[l.start:l.pos])
	}
	if sign := l.peek(); sign == '+' || sign == '-' {
		// Complex: 1+2i. No spaces, must end in 'i'.
		if !l.scanNumber() || l.input[l.pos-1] != 'i' {
			return l.errorf("bad number syntax: %q", l.input[l.start:l.pos])
		}
		l.emit(itemComplex)
	} else {
		l.emit(itemNumber)
	}
	return lexInsideAction
}
1301712
func xorInGeneric(d *state, buf []byte) {
	n := len(buf) / 8

	for i := 0; i < n; i++ {
		a := binary.LittleEndian.Uint64(buf)
		d.a[i] ^= a
		buf = buf[8:]
	}
}
682377
func state1(s *scanner, c int) int {
	if '0' <= c && c <= '9' {
		s.step = state1
		return scanContinue
	}
	return state0(s, c)
}
928293
func state0(s *Scanner, c int) int {
	if c == '.' {
		s.Step = stateDot
		return ScanContinue
	}
	if c == 'e' || c == 'E' {
		s.Step = stateE
		return ScanContinue
	}
	return stateEndValue(s, c)
}
1287767
func LexLimit(l *Lexer) StateFn {

	l.SkipWhiteSpaces()
	keyWord := strings.ToLower(l.PeekWord())
	//u.Debugf("LexLimit  r= '%v'", string(keyWord))

	switch keyWord {
	case "offset":
		return nil
	case "", ";":
		return nil
	case ",":
		l.ConsumeWord(keyWord)
		l.Emit(TokenComma)
		return LexNumber
	default:
		if isDigit(l.Peek()) {
			l.Push("LexLimit", LexLimit)
			return LexNumber
		}
	}
	return nil
}
994892
func stateNeg(s *scanner, c int) int {
	if c == '0' {
		s.step = state0
		return scanContinue
	}
	if '1' <= c && c <= '9' {
		s.step = state1
		return scanContinue
	}
	return s.error(c, "in numeric literal")
}
557287
func GetKeyboardState() []uint8 {
	var numkeys C.int
	start := C.SDL_GetKeyboardState(&numkeys)
	sh := reflect.SliceHeader{}
	sh.Len = int(numkeys)
	sh.Cap = int(numkeys)
	sh.Data = uintptr(unsafe.Pointer(start))
	return *(*[]uint8)(unsafe.Pointer(&sh))
}
321986
func stateLeftDelim(l *lexer) stateFn {
	l.seek(len(l.leftDelim))
	if l.peek() == '=' {
		// When the lexer encounters "{{=" it proceeds to the set delimiter
		// state which alters the left and right delimiters. This operation is
		// hidden from the parser and no tokens are emited.
		l.next()
		return stateSetDelim
	}
	l.emit(tokenLeftDelim)
	return stateTag
}
448762
func NewStateEx() *State {
	l := NewState()
	if l != nil {
		_ = AtPanic(l, func(l *State) int {
			s, _ := l.ToString(-1)
			fmt.Fprintf(os.Stderr, "PANIC: unprotected error in call to Lua API (%s)\n", s)
			return 0
		})
	}
	return l
}
297338
func isHexadecimal(ch rune) bool {
	return '0' <= ch && ch <= '9' || 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F'
}
994409
func stateBeginValue(s *scanner, c int) int {
	if c <= ' ' && isSpace(rune(c)) {
		return scanSkipSpace
	}
	switch c {
	case '{':
		s.step = stateBeginStringOrEmpty
		s.pushParseState(parseObjectKey)
		return scanBeginObject
	case '[':
		s.step = stateBeginValueOrEmpty
		s.pushParseState(parseArrayValue)
		return scanBeginArray
	case '"':
		s.step = stateInString
		return scanBeginLiteral
	case '-':
		s.step = stateNeg
		return scanBeginLiteral
	case '0': // beginning of 0.123
		s.step = state0
		return scanBeginLiteral
	case 't': // beginning of true
		s.step = stateT
		return scanBeginLiteral
	case 'f': // beginning of false
		s.step = stateF
		return scanBeginLiteral
	case 'n': // beginning of null
		s.step = stateN
		return scanBeginLiteral
	}
	if '1' <= c && c <= '9' { // beginning of 1234.5
		s.step = state1
		return scanBeginLiteral
	}
	return s.error(c, "looking for beginning of value")
}
971759
func (d *JsonNullDetector) nextState(b byte) int {
	switch d.state {
	case stateInit:
		if isJsonSpace(b) {
			return stateInit
		}
		if b == 'n' {
			return stateN
		}
	case stateN:
		if b == 'u' {
			return stateU
		}
	case stateU:
		if b == 'l' {
			return stateL
		}
	case stateL:
		if b == 'l' {
			return stateAccept
		}
	case stateAccept:
		if isJsonSpace(b) {
			return stateAccept
		}
	}
	return stateInvalid
}
1365843
func (a *Automaton) step(state, label int) int {
	assert(state >= 0)
	assert(label >= 0)
	if 2*state >= len(a.states) {
		return -1 // invalid state
	}
	trans := a.states[2*state]
	limit := trans + 3*a.states[2*state+1]
	// TODO binary search
	for trans < limit {
		dest, min, max := a.transitions[trans], a.transitions[trans+1], a.transitions[trans+2]
		if min <= label && label <= max {
			return dest
		}
		trans += 3
	}
	return -1
}
906745
func (p *ProtobufCarrier) State() (traceID types.TraceID, spanID uint64, parentSpanID *uint64, sampled bool, flags flag.Flags) {
	traceID.Low = p.TraceId
	traceID.High = p.TraceIdHigh
	spanID = p.SpanId
	sampled = p.Sampled
	flags = flag.Flags(p.Flags)
	if flags&flag.IsRoot == 0 {
		parentSpanID = &p.ParentSpanId
	}
	return traceID, spanID, parentSpanID, sampled, flags
}
405689
func (z *nstate) dec(s string) {
	b := []byte(s)
	i, n := binary.Uvarint(b)
	if n <= 0 {
		bug()
	}
	b = b[n:]
	z.partial = rune(i)
	i, n = binary.Uvarint(b)
	if n <= 0 {
		bug()
	}
	b = b[n:]
	z.flag = flags(i)
	z.q.Reset()
	last := ^uint32(0)
	for len(b) > 0 {
		i, n = binary.Uvarint(b)
		if n <= 0 {
			bug()
		}
		b = b[n:]
		last += uint32(i)
		z.q.Add(last)
	}
}
463530
func (d *ConsulStateDriver) ReadState(key string, value core.State,
	unmarshal func([]byte, interface{}) error) error {
	key = processKey(key)
	encodedState, err := d.Read(key)
	if err != nil {
		return err
	}

	return unmarshal(encodedState, value)
}