// Return a set of states that represent the possible ways of updating this
// state for the next character.  The resulting set of states are added to
// the "result" list.
426031
func updateStateForChar(s *state, data []byte, index int) stateSlice {
	var result stateSlice = nil
	ch := data[index]
	charInCurrentTable := charMap[s.mode][ch] > 0

	var stateNoBinary *state = nil
	for mode := mode_upper; mode <= mode_punct; mode++ {
		charInMode := charMap[mode][ch]
		if charInMode > 0 {
			if stateNoBinary == nil {
				// Only create stateNoBinary the first time it's required.
				stateNoBinary = s.endBinaryShift(index)
			}
			// Try generating the character by latching to its mode
			if !charInCurrentTable || mode == s.mode || mode == mode_digit {
				// If the character is in the current table, we don't want to latch to
				// any other mode except possibly digit (which uses only 4 bits).  Any
				// other latch would be equally successful *after* this character, and
				// so wouldn't save any bits.
				res := stateNoBinary.latchAndAppend(mode, charInMode)
				result = append(result, res)
			}
			// Try generating the character by switching to its mode.
			if _, ok := shiftTable[s.mode][mode]; !charInCurrentTable && ok {
				// It never makes sense to temporarily shift to another mode if the
				// character exists in the current mode.  That can never save bits.
				res := stateNoBinary.shiftAndAppend(mode, charInMode)
				result = append(result, res)
			}
		}
	}
	if s.bShiftByteCount > 0 || charMap[s.mode][ch] == 0 {
		// It's never worthwhile to go into binary shift mode if you're not already
		// in binary shift mode, and the character exists in your current mode.
		// That can never save bits over just outputting the char in the current mode.
		res := s.addBinaryShiftChar(index)
		result = append(result, res)
	}
	return result
}
1001760
func stateInStringEscU(s *scanner, c byte) int {
	if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
		s.step = stateInStringEscU1
		return scanContinue
	}
	// numbers
	return s.error(c, "in \\u hexadecimal character escape")
}
313459
func (f *FSM) AddState(state *FSMState) {
	if f.states == nil {
		f.states = make(map[string]*FSMState)
	}
	f.states[state.Name] = state
}
331862
func (m *DFA) States() []State {
	q := make([]State, 0, len(m.q))
	for s, _ := range m.q {
		q = append(q, s)
	}
	return q
}
1153327
func (b *Backend) getStates(taskUUIDs ...string) ([]*tasks.TaskState, error) {
	taskStates := make([]*tasks.TaskState, len(taskUUIDs))

	conn := b.open()
	defer conn.Close()

	// conn.Do requires []interface{}... can't pass []string unfortunately
	taskUUIDInterfaces := make([]interface{}, len(taskUUIDs))
	for i, taskUUID := range taskUUIDs {
		taskUUIDInterfaces[i] = interface{}(taskUUID)
	}

	reply, err := redis.Values(conn.Do("MGET", taskUUIDInterfaces...))
	if err != nil {
		return taskStates, err
	}

	for i, value := range reply {
		stateBytes, ok := value.([]byte)
		if !ok {
			return taskStates, fmt.Errorf("Expected byte array, instead got: %v", value)
		}

		taskState := new(tasks.TaskState)
		decoder := json.NewDecoder(bytes.NewReader(stateBytes))
		decoder.UseNumber()
		if err := decoder.Decode(taskState); err != nil {
			log.ERROR.Print(err)
			return taskStates, err
		}

		taskStates[i] = taskState
	}

	return taskStates, nil
}
1181933
func (l *State) CheckStates() map[types.CheckID]*CheckState {
	l.RLock()
	defer l.RUnlock()

	m := make(map[types.CheckID]*CheckState)
	for id, c := range l.checks {
		if c.Deleted {
			continue
		}
		m[id] = c.Clone()
	}
	return m
}
1359809
func (c *upgradeContext) State() StateBackend {
	if c.st == nil {
		panic("State not available from this context")
	}
	return c.st
}
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)
}
725551
func GetState(s string) (State, error) {
	lower := strings.ToLower(s)
	switch {
	case lower == "":
		return State_STATE_UNSPECIFIED, nil
	case strings.HasPrefix("free", lower):
		return State_FREE, nil
	case strings.HasPrefix("prerelease", lower):
		return State_PRERELEASE, nil
	case strings.HasPrefix("serving", lower):
		return State_SERVING, nil
	case strings.HasPrefix("test", lower):
		return State_TEST, nil
	case strings.HasPrefix("repair", lower):
		return State_REPAIR, nil
	case strings.HasPrefix("decommissioned", lower):
		return State_DECOMMISSIONED, nil
	default:
		return -1, errors.Reason("string %q did not match any known state", s).Err()
	}
}
935648
func (ss *SuccessState) AdjacentStates() []MachineState {
	if ss.next == nil {
		return nil
	}
	return []MachineState{ss.next}
}
724202
func (l *Lexer) Next() (TokenType, []byte) {
	tt := UnknownToken
	c := l.r.Peek(0)
	switch c {
	case '(':
		if l.state == StmtParensState {
			l.enterContext(StmtParensContext)
		} else {
			l.enterContext(ExprParensContext)
		}
		l.state = ExprState
		l.r.Move(1)
		tt = PunctuatorToken
	case ')':
		if l.leaveContext() == StmtParensContext {
			l.state = ExprState
		} else {
			l.state = SubscriptState
		}
		l.r.Move(1)
		tt = PunctuatorToken
	case '{':
		l.enterContext(BracesContext)
		l.state = ExprState
		l.r.Move(1)
		tt = PunctuatorToken
	case '}':
		if l.leaveContext() == TemplateContext && l.consumeTemplateToken() {
			tt = TemplateToken
		} else {
			// will work incorrectly for objects or functions divided by something,
			// but that's an extremely rare case
			l.state = ExprState
			l.r.Move(1)
			tt = PunctuatorToken
		}
	case ']':
		l.state = SubscriptState
		l.r.Move(1)
		tt = PunctuatorToken
	case '[', ';', ',', '~', '?', ':':
		l.state = ExprState
		l.r.Move(1)
		tt = PunctuatorToken
	case '<', '>', '=', '!', '+', '-', '*', '%', '&', '|', '^':
		if l.consumeHTMLLikeCommentToken() {
			return SingleLineCommentToken, l.r.Shift()
		} else if l.consumePunctuatorToken() {
			l.state = ExprState
			tt = PunctuatorToken
		}
	case '/':
		if tt = l.consumeCommentToken(); tt != UnknownToken {
			return tt, l.r.Shift()
		} else if l.state == ExprState && l.consumeRegexpToken() {
			l.state = SubscriptState
			tt = RegexpToken
		} else if l.consumePunctuatorToken() {
			l.state = ExprState
			tt = PunctuatorToken
		}
	case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.':
		if l.consumeNumericToken() {
			tt = NumericToken
			l.state = SubscriptState
		} else if c == '.' {
			l.state = PropNameState
			l.r.Move(1)
			tt = PunctuatorToken
		}
	case '\'', '"':
		if l.consumeStringToken() {
			l.state = SubscriptState
			tt = StringToken
		}
	case ' ', '\t', '\v', '\f':
		l.r.Move(1)
		for l.consumeWhitespace() {
		}
		return WhitespaceToken, l.r.Shift()
	case '\n', '\r':
		l.r.Move(1)
		for l.consumeLineTerminator() {
		}
		tt = LineTerminatorToken
	case '`':
		if l.consumeTemplateToken() {
			tt = TemplateToken
		}
	default:
		if l.consumeIdentifierToken() {
			tt = IdentifierToken
			if l.state != PropNameState {
				switch hash := ToHash(l.r.Lexeme()); hash {
				case 0, This, False, True, Null:
					l.state = SubscriptState
				case If, While, For, With:
					l.state = StmtParensState
				default:
					// This will include keywords that can't be followed by a regexp, but only
					// by a specified char (like `switch` or `try`), but we don't check for syntax
					// errors as we don't attempt to parse a full JS grammar when streaming
					l.state = ExprState
				}
			} else {
				l.state = SubscriptState
			}
		} else if c >= 0xC0 {
			if l.consumeWhitespace() {
				for l.consumeWhitespace() {
				}
				return WhitespaceToken, l.r.Shift()
			} else if l.consumeLineTerminator() {
				for l.consumeLineTerminator() {
				}
				tt = LineTerminatorToken
			}
		} else if c == 0 && l.r.Err() != nil {
			return ErrorToken, nil
		}
	}

	l.emptyLine = tt == LineTerminatorToken

	if tt == UnknownToken {
		_, n := l.r.PeekRune(0)
		l.r.Move(n)
	}
	return tt, l.r.Shift()
}
415473
func (r *TasksService) GetStates() *TasksGetStatesCall {
	c := &TasksGetStatesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	return c
}
1334083
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)
}
1265049
func (d *decoder) state() json.Delim {
	if len(d.parseState) == 0 {
		return 0
	}
	return d.parseState[len(d.parseState)-1]
}
1274590
func stateInStringEscU12(s *Scanner, c int) int {
	if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
		s.Step = stateInStringEscU123
		return ScanContinue
	}
	// numbers
	return s.error(c, "in \\u hexadecimal character escape")
}
308493
func (wd *WaitDelay) AdjacentStates() []MachineState {
	if wd.next == nil {
		return nil
	}
	return []MachineState{wd.next}
}
512142
func copyStates(m map[string]*ExchangeState) map[string]*ExchangeState {
	c := make(map[string]*ExchangeState)
	for k, v := range m {
		c[k] = v
	}
	return c
}