// run runs the state machine for the lexer.
559925
func (l *selLexer) run() {
	for l.state = selLexText; l.state != nil; {
		l.state = l.state(l)
	}
	close(l.items)
}
650559
func (e *Archive) Run(c *fi.Context) error {
	return fi.DefaultDeltaRunMethod(e, c)
}
1347446
func Run() {
	dec := json.NewDecoder(os.Stdin)
	for {
		var doc map[string]interface{}
		err := dec.Decode(&doc)
		if err == io.EOF {
			return
		} else if err != nil {
			log.Println(err)
			return
		}
		err = Save(viper.GetString("collection"), &doc)
		if err != nil {
			log.Println(err)
		}
	}
}
229548
func (ctx *BatchedContext) Run(errChan chan error) error {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	for {
		select {
		case <-ctx.workAvailable:
			ctx.DoWork()
			if err := ctx.Errors(); err != nil {
				if errChan == nil {
					return err
				}
				errChan <- err

			}
		case w := <-ctx.Work():
			ctx.ErrChan() <- w()
		}
	}
}
408192
func (m *Mux) Run(phase string, ctx *c.Context) *c.Context {
	return m.Middleware.Run(phase, ctx)
}
1299409
func (e *MirrorKeystore) Run(c *fi.Context) error {
	return fi.DefaultDeltaRunMethod(e, c)
}
461003
func (cmd *GenerateConfigCommand) Run(_ context.Context) error {
	conf := server.NewConfig()
	ret, err := toml.Marshal(*conf)
	if err != nil {
		return errors.Wrap(err, "unmarshalling default config")
	}
	fmt.Fprintf(cmd.Stdout, "%s\n", ret)
	return nil
}
1193448
func (s *StateSyncer) Run() {
	if s.ClusterSize == nil {
		panic("ClusterSize not set")
	}
	s.runFSM(fullSyncState, s.nextFSMState)
}
497876
func (e *PGPKeyfinder) Run(m libkb.MetaContext) error {
	e.loadUsers(m)
	e.loadKeys(m)
	return e.runerr
}
935557
func (m *DFA) Run(init interface{}) (State, bool) {
	// Check some pre-conditions.
	if init == nil {
		panic("initial stateful computation is nil")
	}
	if m.q0 == State("") {
		panic("no start state definied")
	}
	if len(m.f) == 0 {
		panic("no terminal states definied")
	}
	if _, ok := m.q[m.q0]; !ok {
		panic(fmt.Sprintf("start state '%v' is not in the set of states", m.q0))
	}
	for s, _ := range m.f {
		if _, ok := m.q[s]; !ok {
			panic(fmt.Sprintf("terminal state '%v' is not in the set of states", s))
		}
	}
	// Run the DFA.
	go func() {
		defer close(m.done)
		// The current state, starts at q0.
		s := m.q0
		// Run the initial stateful computation.
		if m.f[s] {
			// If the state is a terminal state then the DFA has
			// accepted the input sequence and it can stop.
			m.done <- laststate{s, true}
			return
		} else {
			// Otherwise continue reading generated input
			// by starting the next stateful computation.
			switch init := init.(type) {
			case func():
				m.logger(s)
				init()
			case func() Letter:
				m.logger(s)
				l := init()
				m.input = &l
			}
		}
		for {
			var stopnow bool
			select {
			case <-m.stop:
				stopnow = true
			default:
			}
			if stopnow {
				break
			}
			if m.input != nil {
				l := *m.input
				// Reject upfront if letter is not in alphabet.
				if !m.e[l] {
					panic(fmt.Sprintf("letter '%v' is not in alphabet", l))
				}
				// Compose the domain element, so that the co-domain
				// element can be found via the transition function.
				de := domainelement{l: l, s: s}
				// Check the transition function.
				if coe := m.d[de]; coe != nil {
					s = coe.s
					switch exec := coe.exec.(type) {
					case func():
						m.logger(s)
						exec()
					case func() Letter:
						m.logger(s)
						l := exec()
						m.input = &l
					}
					if m.f[s] {
						// If the new state is a terminal state then
						// the DFA has accepted the input sequence
						// and it can stop.
						m.done <- laststate{s, true}
						return
					}
				} else {
					// Otherwise stop the DFA with a rejected state,
					// the DFA has rejected the input sequence.
					panic(fmt.Sprintf("no state transition for input '%v' from '%v'", l, s))
				}
			}
		}
		// The caller has closed the input channel, check if the
		// current state is accepted or rejected by the DFA.
		if m.f[s] {
			m.done <- laststate{s, true}
		} else {
			m.done <- laststate{s, false}
		}
	}()
	return m.result()
}
183909
func (e *PaperKeySubmit) Run(m libkb.MetaContext) error {
	me, err := libkb.LoadMe(libkb.NewLoadUserArgWithMetaContext(m))
	if err != nil {
		return err
	}

	e.deviceWithKeys, err = matchPaperKey(m, me, e.paperPhrase)
	if err != nil {
		return err
	}

	m.ActiveDevice().CacheProvisioningKey(m, e.deviceWithKeys)

	// send a notification that a paper key has been cached
	// for rekey purposes
	m.G().NotifyRouter.HandlePaperKeyCached(me.GetUID(), e.deviceWithKeys.EncryptionKey().GetKID(), e.deviceWithKeys.SigningKey().GetKID())

	// XXX - this is temporary until KBFS handles the above notification
	m.G().UserChanged(m.Ctx(), me.GetUID())

	return nil
}
547761
func (e *Echo) Run(eng engine.Engine, handler ...engine.Handler) error {
	err := e.setEngine(eng).start(handler...)
	if err != nil {
		fmt.Println(err)
	}
	return err
}
953132
func (e *ElasticIP) Run(c *fi.Context) error {
	return fi.DefaultDeltaRunMethod(e, c)
}
175775
func (driver *MesosExecutorDriver) Run() (mesosproto.Status, error) {
	driver.lock.Lock()
	defer driver.lock.Unlock()
	return driver.run()
}
492053
func (d *LSM303) Run() error {
	go func() {
		d.quit = make(chan struct{})

		timer := time.Tick(time.Duration(d.Poll) * time.Millisecond)

		var heading float64

		for {
			select {
			case <-timer:
				h, err := d.measureHeading()
				if err == nil {
					heading = h
				}
				if err == nil && d.headings == nil {
					d.headings = make(chan float64)
				}
			case d.headings <- heading:
			case <-d.quit:
				d.headings = nil
				return
			}

		}
	}()

	return nil
}
802638
func (e *CopyFile) Run(c *fi.Context) error {
	return fi.DefaultDeltaRunMethod(e, c)
}
843327
func (s *Simple) run() {
	for {
		select {
		case <-time.After(s.config.GCPeriodicity):
			s.GC()
		case <-s.halt:
			s.closeError <- nil
			// there is no cleanup required, so we just return
			return
		}
	}
}